We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

User Control

Hi, I Just created a User Control using Essential Grid Control. I Just setting the properties for the grid in the Sub Initialize Component which is in Windows Designer. Here I am seting the Height of the 0th Row to some size. It works fine If I am not changing the property of the grid in the inherited form. If I am doing that, then my defined size changed to default size why it is so. Then another one is In Runtime the size of the row (Height) is changing (i.e. not consistent) i.e. sometimes it is default size some other times it is user defined size. So I am not be able to predict the grid properties. So Plz help me. Thanks

8 Replies

AD Administrator Syncfusion Team January 7, 2005 06:31 AM UTC

We currently support visual inheritance only in our Tools editor controls. None of our grids support visual inheritance currently. So, if you want a grid on a usercontrol to be designable, that is not supported at this time. If you want to derive a grid and make that derived grid designable, then that can be done now.


RA Rajesh January 7, 2005 08:52 AM UTC

Hi, What do you mean by Visual Inheritance and Deriving the Grid. Just I derive the GridControl in my User Control and I started working on that to set the predifined properties Some Properties works fine Some Properties works fine in some time and not works in some other time So I Just attached my User Control Just look over it. I Set the Row Height of the header to 40 But it works sometime and some time not. Please give a solution. thanks for ur quick response Thanks Rajesh UserControls_3496.zip


AD Administrator Syncfusion Team January 7, 2005 09:09 AM UTC

>>What do you mean by Visual Inheritance and Deriving the Grid. In the designer dragging from the toolbox a UserControl that holds a GridControl onto a form, and then trying to set properties on the embedded Gridcontrol in the designer. This is not supported. In the designer, draqgging a derived grid from the toolbox onto a form, and then setting the grid properties from the designer is supported.


RA Rajesh January 8, 2005 05:03 AM UTC

>>>What do you mean by Visual Inheritance and Deriving the Grid. > >In the designer dragging from the toolbox a UserControl that holds a GridControl onto a form, and then trying to set properties on the embedded Gridcontrol in the designer. This is not supported. > >In the designer, draqgging a derived grid from the toolbox onto a form, and then setting the grid properties from the designer is supported. Can you plz give an example code snippets or simple solution thro'' we can set some properties to the grid such as row heights, back color etc.. with the derived grid. which will took effect even after we change the properties of the grid in the inherited form. thanks for ur quick response, we still ned ur help Thanks Rajesh


AD Administrator Syncfusion Team January 9, 2005 08:02 AM UTC

Here is one way I think you can accomplish what you are trying to do. In your derived grid class, only do things like override methods or subscribe to events. Do not set properties. Instead, use a dummy form and a standard GridControl to ''design'' the look of your derived Grid. So in the standard is where you would set rowheights/cell properties, etc. Once you have the standard grid looking the way you want it, save a Template (clicking teh export template verb under the propertygrid for this standard grid). You could event include this designable dummy form in your UserControls library as the design portion of the derived grid. This way you could modify the template in the future as needed. So, now you have a derived grid that has hold the ''feel'' of your custom grid (overrides) and a template that holds the ''look'' of your custom grid. So to use this custom grid in another project, you would drag an instance from the toolbox onto your new form/user control. This would give your new the feel of the custon grid. To give your new grid the look of your custom grid, you would click the import template verb under its property grid and select the saved template. Now your new grid will have both the look and feel of your custom grid and you will be able to set further properties on it. Now this is not exactly the same as inheriting the ''look'' properties from the derived grid, but it does allow you to have a single custom grid with a particular look and feel and then be able to create a series of grids using the designer with the same base look and feel. I will discuss the original problem with the grid architect to see to what we can do about it. One other comment on something you were doing. You were trying to set headertext to be a space using properties. If you serialize a style holding a single space, the serialization code trims the text currently and this means you lose the single space. As a work around, instead of setting the space as part of the ''look'', override OnPrepareViewStyleInfo, and set it there. Protected Overrides Sub OnPrepareViewStyleInfo(ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) If e.ColIndex > 0 AndAlso e.RowIndex <= Me.Rows.HeaderCount AndAlso e.Style.Text.Length = 0 Then e.Style.Text = " " End If End Sub


RA Rajesh January 10, 2005 07:09 AM UTC

Hi, Thanks for your mail. can you provide with the some example code. Regards Rajesh >Here is one way I think you can accomplish what you are trying to do. > >In your derived grid class, only do things like override methods or subscribe to events. Do not set properties. Instead, use a dummy form and a standard GridControl to ''design'' the look of your derived Grid. So in the standard is where you would set rowheights/cell properties, etc. Once you have the standard grid looking the way you want it, save a Template (clicking teh export template verb under the propertygrid for this standard grid). You could event include this designable dummy form in your UserControls library as the design portion of the derived grid. This way you could modify the template in the future as needed. > >So, now you have a derived grid that has hold the ''feel'' of your custom grid (overrides) and a template that holds the ''look'' of your custom grid. So to use this custom grid in another project, you would drag an instance from the toolbox onto your new form/user control. This would give your new the feel of the custon grid. To give your new grid the look of your custom grid, you would click the import template verb under its property grid and select the saved template. Now your new grid will have both the look and feel of your custom grid and you will be able to set further properties on it. > >Now this is not exactly the same as inheriting the ''look'' properties from the derived grid, but it does allow you to have a single custom grid with a particular look and feel and then be able to create a series of grids using the designer with the same base look and feel. > >I will discuss the original problem with the grid architect to see to what we can do about it. > >One other comment on something you were doing. You were trying to set headertext to be a space using properties. If you serialize a style holding a single space, the serialization code trims the text currently and this means you lose the single space. As a work around, instead of setting the space as part of the ''look'', override OnPrepareViewStyleInfo, and set it there. > > > Protected Overrides Sub OnPrepareViewStyleInfo(ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) > If e.ColIndex > 0 AndAlso e.RowIndex <= Me.Rows.HeaderCount AndAlso e.Style.Text.Length = 0 Then > e.Style.Text = " " > End If > End Sub >


RA Rajesh January 10, 2005 07:11 AM UTC

Hi, Some Issues to clarify, 1. Alternate color for rows while inserting new row at runtime ( any specific property is available) 2. Focussing the Control on Cols. after opening a window and trying to focus on another Col.(not the adjacent one) for example, on pressing a cell of celltype "Image"(Source form), we will going to display a form. on selecting a col. in the displayed form, we are going to focus the control on some other col. in the source form. we can''t place the control by the following control Grid.Currentcell.Moveto(1,4) we are expecting a Positive and Quick response Thanks Rajesh


AD Administrator Syncfusion Team January 10, 2005 08:28 AM UTC

First Post: Regarding your request for sample code when you are asking questions about design time work. I do not know how to give you sample code that shows you how to use the designer. I can give you code that is the results of using the designer. But it will not show you what was done in the designer to generate the code. Here is your sample usercontrols back with the steps I described above done to it. http://www.syncfusion.com/forums/Uploads/UserControls-011005.zip But I do not know if this will be helpful to you as it gives you no more information about how to do what I described above. To do the test project, I dropped your derived grid on a form. I then imported a template file (test1.egt) using the import template verb to apply the row heights settings you were doing in your derived grid (and which I removed from your derived grid). I then used the designer to set a grid.Properties.BackGroundColor property to show that new properties could be applied to the grid without losing the properties set from the template. Second Post: 1) In GridControl, there is no property to do this. If you always want alternating row colors, then instead of using the RowStyles[] to set the BackColor property as you did in the UserControl you sent, you should use the PrepareViewStyleInfo event as described in this KB (which explicitly uses GridDataBoundGrid but the same code works for GridControl). http://64.78.18.34/Support/article.aspx?id=10418 2)I do not know exactly what kind of framework you have handling these multiple forms, but in addition to Grid.Currentcell.Moveto(1,4) I suspect before moving the currentcell, you have to possibly activate the form holding the grid, set the grid to be its active control, maybe call grid.Focus, and then call grid.CurrentCell.MoveTo. CurrentCell.MoveTo may not do anything unless the grid is the active control. If you cannot come up with the right set of calls to activatee the form and grid, if you will upload a sample showing how you are managing these multiple forms, then we can try to find the proper set of method call to set teh grid active. >>we are expecting a Positive and Quick response If you need to be guaranteed timely response, you are using the wrong support venue. This is a public forum and your questions may go un-responded to. In practice, Syncfusion does try to respond to posts. But it is possible a post not not get responded to and there is no accounting system that would monitor this. If you want a guaranteed response, you should use our Direct Trac support system as that will give both parties notification of updates as well as allow for tracking an incident to a resolution. In this public forum, there are no such safe guards.

Loader.
Live Chat Icon For mobile
Up arrow icon