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

Windows grid backcolor

Can''t aply grid back color.It doesn''t change. Works only if i apply any background image and then delete it. Is this new SyncFusion feature?

9 Replies

AD Administrator Syncfusion Team February 7, 2006 09:38 AM UTC

Hi Roman, We are not able to trace out the problem in V4.1, as we may not followed the steps actually you have done. Kindly post a sample showing this problem or tell us how to see it in the browser sample, as the sample code is working fine here. Try this code snippet. //For Gridcontrol this.gridControl1.BackColor = Color.Orange; //For GridDataBoundGrid Control this.gridDataBoundGrid1.BackColor = Color.PaleGreen; Exactly what version of Windows are you using? What version of Syncfusion/(.NET framework and VS) are you upgrading? Kindly provide us more information, as we will try to suggest you some solution. Regards, Madhan.


AD Administrator Syncfusion Team February 7, 2006 02:32 PM UTC

Let’s assume that u have two rows on Windows Grid. Color.Red will be assigned to cells, but not to control . Header Row BackColor will not be affected as well as control back color. Now: Apply any background image to Background Image property. Then delete image and apply BackGround Color. See the difference. I am running Windows Grid v.1.1.4322, framework 1.1, WinXP sp2. I can send you image samples if need. Also how to change Selected Row ForeColor ? Can I Change Header Row ForeColor? Is AlphaBlendSelectionColor is Selected ForeColor ? If it is, then it does not work properly, or let’s say behave different way then Selected Fore Color Thanks. >Hi Roman, > >We are not able to trace out the problem in V4.1, as we may not followed the steps actually you have done. Kindly post a sample showing this problem or tell us how to see it in the browser sample, as the sample code is working fine here. >Try this code snippet. > > //For Gridcontrol > this.gridControl1.BackColor = Color.Orange; > >//For GridDataBoundGrid Control > this.gridDataBoundGrid1.BackColor = Color.PaleGreen; > >Exactly what version of Windows are you using? >What version of Syncfusion/(.NET framework and VS) are you upgrading? > >Kindly provide us more information, as we will try to suggest you some solution. > >Regards, >Madhan.


AD Administrator Syncfusion Team February 8, 2006 12:36 PM UTC

Hi Roman, Thanks for your feedback. The secnerio, you have faced is due to the precedence level. In general, if you set the backcolor, the transparentbackground property will be false ( back color excluding headers). But, if you set the background image it becomes true ( see this : in the windows generated code of gridcontrol ). If you set this property to false then, it behaves normallyas before, as you set the backcolor. The Forecolor, generally means the textcolor in the grid. In the syncfusion grid, there is a property called TextColor, using this you can set the grid forecolor / text color. You can use the prepareviewstyleinfo event to change the Header row forecolor and the SelectionChanging event to change the Selected fore color. Here is the code snippet. private void gridControl1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e) { if(e.ColIndex > 0 && e.RowIndex == 0) { e.Style.TextColor = Color.White; } } private void gridControl1_SelectionChanging(object sender, Syncfusion.Windows.Forms.Grid.GridSelectionChangingEventArgs e) { GridStyleInfo style = new GridStyleInfo(); style.TextColor = Color.Blue; this.gridControl1.ChangeCells(e.Range,style); } The Alphablendselectioncolor, is used to set the selection color ( selecting datas / rows / columns using mouse ) Here is a sample for implemnting it. Let us know if you need any further assistance. Regards, Madhan.


AD Administrator Syncfusion Team February 8, 2006 05:38 PM UTC

GridSelectionChangedEventArgs contains OldRanges object which is always null. As result i can''t reset default TextColor of the previosly selected row [Color.Blue] as by your example. Is there any other way ? >Hi Roman, > >Thanks for your feedback. The secnerio, you have faced is due to the precedence level. In general, if you set the backcolor, the transparentbackground property will be false ( back color excluding headers). But, if you set the background image it becomes true ( see this : in the windows generated code of gridcontrol ). If you set this property to false then, it behaves normallyas before, as you set the backcolor. >The Forecolor, generally means the textcolor in the grid. In the syncfusion grid, there is a property called TextColor, using this you can set the grid forecolor / text color. You can use the prepareviewstyleinfo event to change the Header row forecolor and the SelectionChanging event to change the Selected fore color. Here is the code snippet. > > private void gridControl1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e) > { > if(e.ColIndex > 0 && e.RowIndex == 0) > { > e.Style.TextColor = Color.White; > } > } > > private void gridControl1_SelectionChanging(object sender, Syncfusion.Windows.Forms.Grid.GridSelectionChangingEventArgs e) > { > GridStyleInfo style = new GridStyleInfo(); > style.TextColor = Color.Blue; > this.gridControl1.ChangeCells(e.Range,style); > } > >The Alphablendselectioncolor, is used to set the selection color ( selecting datas / rows / columns using mouse ) >Here is a sample for implemnting it. > >Let us know if you need any further assistance. > >Regards, >Madhan.


AD Administrator Syncfusion Team February 9, 2006 10:46 AM UTC

Hi Roman, Please try this code snippet for resetting the TextColor. private void gridControl1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e) { GridRangeInfo cc = this.gridControl1.Model.SelectedRanges.ActiveRange; if(e.ColIndex > 0 && e.RowIndex == 0) { e.Style.TextColor = Color.White; } else if(e.ColIndex > 0 && e.RowIndex > 0 && cc.Contains(GridRangeInfo.Cell(e.RowIndex,e.ColIndex))) { e.Style.TextColor = Color.Red; } } Here is a sample implementing it. Let us know if you need further assistance, Regards, Madhan.


AD Administrator Syncfusion Team February 9, 2006 04:36 PM UTC

Another thing. Scenario: if(e.RowIndex==0 & e.ColIndex==0) {this.gridControl1.AllowSelection=GridSelectionFlags.None; } else { this.gridControl1.AllowSelection = GridSelectionFlags.Any & ~GridSelectionFlags.Column; } As you can see, selection is turned off when index 0,0 mouse click still highlights ALL grid !!! That''s when backcolor is white, but when is changed then all grid become Color.Brown and TextColor become white.!! I do not need any changes on click 0,0 Thanks.


AD Administrator Syncfusion Team February 10, 2006 07:23 AM UTC

Hi Roman, If you want to cancel the table selection, when the user clicks on the cell(0,0). You can use the following code snippet. // In Form_Load Event this.gridControl1.AllowSelection= GridSelectionFlags.Any & ~GridSelectionFlags.Table; // Similarly way row, column, multiple selections can be cancelled and it will be better to set the selection flag during intialization. Regards, Madhan.


AD Administrator Syncfusion Team February 10, 2006 06:01 PM UTC

i need to change selection on the fly. From row to col or disable it on 0,0 click. But disable does not work that way. Table remains highlited.


AD Administrator Syncfusion Team February 14, 2006 02:22 PM UTC

Hi Roman, Please refer the Browser sample for highlighting the Current Row:(Essential Studio Sample ->Grid Sample ->Quick Start ->HighlightCurrentRow \Essential Studio\4.1.0.57\windows\Grid.Windows\Samples\Quick Start\HighlightCurrentRow\cs and Also refer the Forum Thread for more details For GridDataBoundGrid : http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=39142 For GridControl : gcMouseOverhightLight.zip Let me know if you need any further assistance. Regards, Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon