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

How to change the border color for static cells that have focus and use the standard border color for regular cell

Thread ID:

Created:

Updated:

Platform:

Replies:

52581 Nov 30,2006 03:00 PM UTC Dec 4,2006 05:19 AM UTC Windows Forms 3
loading
Tags: Grouping
James Blibo
Asked On November 30, 2006 03:00 PM UTC

When the current cell is a static cell, I want to change the cell border color to a different color or prevent the cell from having a border at all, so as to indicate to the user that the cell is not editable. How can I go about doing this?

Also, How can I select the all the text in the active cell or move the mouse caret to the beginning of the text instead of at the end?

Administrator [Syncfusion]
Replied On December 1, 2006 05:38 AM UTC

Hi James,

Issue 1:

You can handle the TableControlPrepareViewStyleInfo event and change the border style of the static current cell by checking Style.Celltype and e.RowIndex/ColIndex. Here is a code snippet to show this.

private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableControl tc = e.TableControl as GridTableControl;
if( tc.CurrentCell.RowIndex == e.Inner.RowIndex && tc.CurrentCell.ColIndex == e.Inner.ColIndex
&& e.Inner.Style.CellType == "Static" )
{
e.Inner.Style.Borders.All = new GridBorder(GridBorderStyle.Solid,Color.Blue);
}
}

Issue 2:

There is a property to specify the current cell active behavior when moving the current cell or click inside the current cell. You can specify it using this code:

this.gridGroupingControl1.TableControl.Model.Options.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll;

Please refer the attached sample for implementation.
GGCStaticBorderStyle.zip

Best Regards,
Haneef

James Blibo
Replied On December 1, 2006 05:55 AM UTC

The black border is still showing. The code just adds another border around the cell. In this sample, is you selected a lighter color for the new border color, you will see that the black border is still there, in addition to the new border.

Administrator [Syncfusion]
Replied On December 4, 2006 05:19 AM UTC

Hi James,

You can use the ShowCurrentCellBorderBehavior property to control the currentcell border/frame in a grid. Here is a code to hide the default currentcell border.

this.gridGroupingControl1.TableControl.Model.Options.ShowCurrentCellBorderBehavior = GridShowCurrentCellBorder.HideAlways;

Best 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

;