Hi,
I have a wingrid where I want to disable the editing of certain cells. I can set cell.Activation to ActivateOnly or NoEdit and that disables editing and the cell can still be activated. However the foreground color is the same color as with AllowEdit (black). I want the font color to be gray, as per when setting cell.Activation to Disabled.
Our problem with using Disabled is that cell activation is disabled also. In this case our cells have to remain activated.
Is there a way to set the font color other than through the Appearance object?
Thanks,
Bill
Hi Bill,
wugates said:Is there a way to set the font color other than through the Appearance object?
Your question puzzles me. Why are you looking for a way other than the Appearance object? What's wrong with the Appearance object?
There is already a very simple and easy way to do this, so what are you looking for a different way?
Hi Mike,
Thanks for the reply. The reason for the inquiry is because when setting cell.Activation = Activation.Disabled, one automatically gets a gray font. Since this doesn't seem to be implemented by an Appearance object, I wanted to find out if there was some other property that could be set to cause the font to be displayed with Disabled font characteristics without having to use an Appearance object.
Internet searches on this subject turned up nothing additional, so in the meantime I went ahead and implemented it using an Appearance object. That was easy to do.
Oh, I see. So you are looking for some way to automatically assign a color to the cell based on the activation setting? No, there's nothing built-in to the grid to do that. You have to use an appearance.
I have a few number of columns is dis-activated from user to modify with code below,
this.ugt.Bands[0].Columns[0].CellActivation = Activation.Disabled;
if I want to change my dis-activated cell font color to others color than grey, how should i code it ?
Thanks
Hello PeaceSea,
Please try the following code:
e.Layout.Override.CellAppearance.ForeColorDisabled = Color.Red;
in the 'InitializeLayout' event of the 'WinGrid' control.
thanks Boris, is working.
I'm interested to know, how can I just change the font color for disable fields when the particular row is selected?
Thank you very much.
Hello,
You could try:
e.Layout.Override.SelectedRowAppearance.ForeColorDisabled
or
e.Layout.Override.SelectedCellAppearance.ForeColorDisabled