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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Windows grid backcolor

Thread ID:

Created:

Updated:

Platform:

Replies:

40556 Feb 6,2006 09:31 PM UTC Feb 14,2006 02:22 PM UTC Windows Forms 9
loading
Tags: GridControl
Roman
Asked On February 6, 2006 09:31 PM UTC

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?

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;