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
close icon

GridListControl and selected row

Hi together, when I select an item in my gridlistcontrol - the item is highlighted (background blue colored) with a dotted rectangle. How can I disable the dotted rectangle? Cheers, Markus

14 Replies

AD Administrator Syncfusion Team September 1, 2005 03:23 PM UTC

Try subscribing to the grid''s DrawCell event and reset the borders there. this.gridListControl1.Grid.DrawCell += new GridDrawCellEventHandler(Grid_DrawCell); private void Grid_DrawCell(object sender, GridDrawCellEventArgs e) { e.Style.ResetBorders(); }


AD Administrator Syncfusion Team September 2, 2005 06:32 AM UTC

Hi Clay, that works (the dotted line isn''t visible anymore). But now the text jumps (moves a little bit) when I highlight an iteam. How can I stop that?


AD Administrator Syncfusion Team September 2, 2005 07:47 AM UTC

Try this.
private void Grid_DrawCell(object sender, GridDrawCellEventArgs e)
{
	GridControl grid = sender as GridControl;
	if(grid.CurrentCell.HasCurrentCellAt(e.RowIndex))
	{
		e.Style.ResetBorders();
		e.Style.BorderMargins.Top = 1;
		if(e.ColIndex == this.ListBox1.ImageColumn)
			e.Style.BorderMargins.Left = 2;
	}
}


AD Administrator Syncfusion Team September 2, 2005 08:45 AM UTC

Thank''s clay - that works


AD Administrator Syncfusion Team September 2, 2005 09:02 AM UTC

Sorry, I was too fast. The text is still "jumping" when you highlight an item in the gridlistcontrol and then click on another control in the application?


AD Administrator Syncfusion Team September 2, 2005 11:40 AM UTC

You can check to see if the grid has focus before making the adjustment.
private void Grid_DrawCell(object sender, GridDrawCellEventArgs e)
{
	GridControl grid = sender as GridControl;
	if(grid.CurrentCell.HasCurrentCellAt(e.RowIndex))
	{
		e.Style.ResetBorders();
		if(grid.Focused)
		{
			e.Style.BorderMargins.Top = 1;
			if(e.ColIndex == this.ListBox1.ImageColumn)
				e.Style.BorderMargins.Left = 2;
		}
	}
}
            


AD Administrator Syncfusion Team September 2, 2005 12:26 PM UTC

Thanks Clay - great!!! But one further question :-)) How can I get to the GridListControl object from GridControl grid = sender as GridControl; I don''t want to specify explicitly: this.ListBox1.ImageColumn cause I want to use this method for multiple gridlistcontrols. >You can check to see if the grid has focus before making the adjustment. >
>private void Grid_DrawCell(object sender, GridDrawCellEventArgs e)
>{
>	GridControl grid = sender as GridControl;
>	if(grid.CurrentCell.HasCurrentCellAt(e.RowIndex))
>	{
>		e.Style.ResetBorders();
>		if(grid.Focused)
>		{
>			e.Style.BorderMargins.Top = 1;
>			if(e.ColIndex == this.ListBox1.ImageColumn)
>				e.Style.BorderMargins.Left = 2;
>		}
>	}
>}
>
            


AD Administrator Syncfusion Team September 2, 2005 03:44 PM UTC

Try casting grid.Parent to a GridListControl to see if that will do it.


GP Greg Patterson December 2, 2005 02:35 PM UTC

I have this same problem with the dotted lines and gridgrouping control. I tried using a modified version of the code you suggested: private void gcEmailGrouping_TableControlDrawCell(object sender,GridTableControlDrawCellEventArgs e) { e.Inner.Style.ResetBorders(); } but the dotted lines remains. Thanks, Greg >Hi together, > >when I select an item in my gridlistcontrol - the item is highlighted (background blue colored) with a dotted rectangle. > >How can I disable the dotted rectangle? > >Cheers, >Markus


AD Administrator Syncfusion Team December 2, 2005 02:55 PM UTC

What dotted lines are you trying to remove? Can you tell us how to see the problem in one of our samples, or can you upload a sample project showing the problem, or maybe a picture marked up showing the lines you want to get rid of?


GP Greg Patterson December 2, 2005 03:25 PM UTC

It is a solid line in the attached screen shots, but you can see it around the "From" column of the highlighted row. I have the grid set to select the entire row but the clicked cell still gets an outline. The second screen shot shows when a covered range is clicked to highlight the row. How can I change to color of the covered range to be highlighted?

GGCScreenShot200501202.zip


AD Administrator Syncfusion Team December 2, 2005 03:43 PM UTC

I think the rectangle you are showing is the currentcell border. Try setting this property to remove it: this.gridGroupingControl1.TableModel.Options.ShowCurrentCellBorderBehavior = GridShowCurrentCellBorder.HideAlways; How to control the selection backcolor depends on selection architecture you are using. But here is one set of properties that gives you access to the selection color you see. this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One; this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None; // this.gridGroupingControl1.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.DrawAlphablend; this.gridGroupingControl1.TableOptions.SelectionBackColor = Color.Red;


GP Greg Patterson December 2, 2005 04:15 PM UTC

Thanks Clay, the cell borders are gone, but I don''t think I asked my second question very well. How can I make the covered range (mailicon) in a row change it''s background to be highlighted when the row is selected?


AD Administrator Syncfusion Team December 2, 2005 04:34 PM UTC

Is the white part of the bitmap? If the white is part of the bitmap, then you can try setting a transparent color for the bitmap. But if that does not work, the only way I would know to do it is to use alphablending instead drawing the background.

Loader.
Live Chat Icon For mobile
Up arrow icon