Nevron Forum

ColorScheme.Longhorn NDataGridView issues

https://www.nevron.com/Forum/Topic5878.aspx

By Brad Swearingen - Friday, November 18, 2011

I'm setting my color scheme to be longhorn (using the 11.1.17.12 build):

NUIManager.Palette.Scheme = ColorScheme.Longhorn;

 

When I use an NDataGridView I noticed there are two color problems with it:

1) When I click to edit a cell I can't see what I am typing.  The text foreground and the cell background appear both to be white.

2) If I stick a combobox on the cell (such as with the code below) and try to select items from the combo box I can't  see the combo box list items unless I highlight it with the mouse.  Seems the foreground and background color are both white.

DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();

cmb.HeaderText = "Select Data";

cmb.Name = "cmb";

cmb.MaxDropDownItems = 4;

cmb.Items.Add("True");

cmb.Items.Add("False");

nDataGridView1.Columns.Add(cmb);

3) I also noticed that the mouse cursor I-beam shape over an NTextBox is very hard to see.

We like the longhorn scheme.  Do you have any recommendations on how to fix these issues?  Can these schemes be updated somehow?

By Nevron Support - Friday, November 18, 2011

Hello Brad,

By default the back color of cell in edit mode in NDataGridView when Longhorn palette is applied is white and the color of the text is black.

1st and 2nd problems may be caused if NDataGridView.DefaultCellStyle.ForeColor is set to white.


Indeed, when Longhorn palette is applied on NTextBox the mouse cursor color is close to the back color of the text box.

However, you can modify palette by changing some of its color property.

Please, check the following page from our documentation for more info:

http://helpdotnetvision.nevron.com/UsersGuide_Palettes_Using_Palettes.html
By Brad Swearingen - Friday, November 18, 2011

Thanks very much for the website tip.  For the NDataGridView I'm not setting the foreColor.  I just dropped an NDataGridView on a new form (test project) and tried to use that scheme with it.  (I noticed ColorScheme.Blue has the same issue).  Here's what the designer produced:

            this.nDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.nDataGridView1.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(225)))), ((int)(((byte)(225)))), ((int)(((byte)(225)))));
            this.nDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.nDataGridView1.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
            this.nDataGridView1.Location = new System.Drawing.Point(12, 12);
            this.nDataGridView1.Name = "nDataGridView1";
            this.nDataGridView1.Size = new System.Drawing.Size(260, 226);
            this.nDataGridView1.TabIndex = 2;
            this.nDataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.nDataGridView1_CellClick);

I tried removing the setting of the BackgroundColor and the GridColor and this change didn't help.  Perhaps this has been addressed in the current Nevron UI build.

By Brad Swearingen - Monday, November 21, 2011

I just tried this on the latest Nevron UI build and both white on white issues remain.  I'm running on Win7.
By Nevron Support - Tuesday, November 22, 2011

Hello Brad,

Finally, I manage to reproduce the problem.

The reason I couldn't was that my NDataGridView control was hosted in Form instead of NForm.

When you apply a Longhorn palette to the NUIManager, NForm.ForeColor takes its value from it. For Longhorn palette this color is white.
On the other hand the controls hosted in Form or NForm (NForm subclass Form) inherits this property and NDataGridView.DefaultCellStyle.ForeColor takes its value from the form that resides. Therefore NDataGridView.DefaultCellStyle.ForeColor becomes white.

NDataGridView inherits DataGridView and this "feature" comes from base DataGridView control.

As a solution, I can suggest explicitly to set NDataGridView.DefaultCellStyle.ForeColor to Black or other suitable color.
By Brad Swearingen - Tuesday, November 22, 2011

Thanks very much.  Yes, I'm putting a grid on an NForm.  That looks to be a suitable workaround for this issue.  It might be a good change to a future Nevron UI build to add that code automatically by the VS designer when dropping a grid on a form.