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

changing a gridgroupdroparea

Hello. I would like to change the way the items are drawed in a gridgroupdroparea. For example one item under the other instead of a line. Is it possible to do that? thx

7 Replies

AD Administrator Syncfusion Team April 11, 2005 10:12 PM UTC

It''s not perfect, but attached find a try at this: CS.zip. Look for this code in form1.cs int levelOffsetInPixels = 6; int maximumLevels = 3; // reserve space for 3 more levels (3*4) protected override void OnLoad(EventArgs e) { base.OnLoad (e); int extraHeight = levelOffsetInPixels * maximumLevels; this.groupingGrid1.GridGroupDropArea.Model.RowHeights[2] = 18 + extraHeight; this.groupingGrid1.GridGroupDropArea.Height += extraHeight; this.groupingGrid1.GridGroupDropArea.Parent.Height += extraHeight; this.groupingGrid1.GridGroupDropArea.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(GridGroupDropArea_PrepareViewStyleInfo); } private void GridGroupDropArea_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { GridGroupDropArea grid = (GridGroupDropArea) sender; TableDescriptor td = grid.Model.GridTableModel.Table.TableDescriptor; if (e.RowIndex == 2) { int extraHeight = levelOffsetInPixels * maximumLevels; int groupedColumn = grid.Model.ColIndexToField(e.ColIndex); int offset = Math.Min(maximumLevels-1, groupedColumn) * levelOffsetInPixels; e.Style.BorderMargins.Top = offset; e.Style.BorderMargins.Bottom = extraHeight - offset; e.Style.BackColor = grid.Model.TableStyle.BackColor; } } Stefan


JG Julien Goldberg April 12, 2005 09:48 AM UTC

Thank You. Yes it''s not perfect but it''s a good start. The issue is that I would like to have different colors for the cells and the droparea background. So if the cells are heighter it gonna be dirty. But i''m working on it. thx


JG Julien Goldberg April 12, 2005 10:04 AM UTC

And i''m trying to change the weight of the cells dynamicaly trying to catch the gridgrouparea.dragenter and dragleave but it never hits these events.


JG Julien Goldberg April 12, 2005 02:38 PM UTC

I''m trying to do something else: creating, a new row (setting the rowcount field), each time a new item is droped into the gridgrouparea. Do you think it can be a good way to do this? (i don''t find some events to know when an item is drop into the gridgrouparea). Thx


AD Administrator Syncfusion Team April 12, 2005 02:39 PM UTC

Julien, try the CellMouseHoverEnter and CellMouseHoverLeave events, e.g. private void GridGroupDropArea_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { GridGroupDropArea grid = (GridGroupDropArea) sender; TableDescriptor td = grid.Model.GridTableModel.Table.TableDescriptor; if (e.RowIndex == 2) { int extraHeight = levelOffsetInPixels * maximumLevels; int groupedColumn = grid.Model.ColIndexToField(e.ColIndex); int offset = Math.Min(maximumLevels-1, groupedColumn) * levelOffsetInPixels; e.Style.BorderMargins.Top = offset; e.Style.BorderMargins.Bottom = extraHeight - offset; e.Style.BackColor = grid.Model.TableStyle.BackColor; if (e.RowIndex == hoverRowIndex && e.ColIndex == hoverColIndex) { e.Style.Font.Bold = true; } } } int hoverRowIndex, hoverColIndex; private void GridGroupDropArea_CellMouseHoverEnter(object sender, GridCellMouseEventArgs e) { hoverRowIndex = e.RowIndex; hoverColIndex = e.ColIndex; } private void GridGroupDropArea_CellMouseHoverLeave(object sender, GridCellMouseEventArgs e) { hoverRowIndex = -1; hoverColIndex = -1; } Stefan >And i''m trying to change the weight of the cells dynamicaly trying to catch the gridgrouparea.dragenter and dragleave but it never hits these events.


JG Julien Goldberg April 12, 2005 02:55 PM UTC

>try the CellMouseHoverEnter and CellMouseHoverLeave events, e.g. > There is an event for the real drag and drop and not just for the mouse into the gridgrouparea? What is the purpose of the dragenter and the dragleave events? cheers


AD Administrator Syncfusion Team April 12, 2005 05:30 PM UTC

DragEnter and DragLeave are called by Ole Drag and Drop functionality of the base class (when Control.AllowDrop= true). The GridDragGroupArea however has no support for Ole Drag and Drop and therefore these events will never get called. The logic for dragging columns is all implemented within the GroupDropAreaDragHeaderMouseController mouse controller. You could check whether a MouseDown occured by handling the MouseDown event, e.g. private void GridGroupDropArea_MouseDown(object sender, MouseEventArgs e) { Point pt = new Point(e.X, e.Y); Console.WriteLine(((GridControlBase) sender).PointToRangeInfo(pt)); } Stefan > >>try the CellMouseHoverEnter and CellMouseHoverLeave events, e.g. >> > >There is an event for the real drag and drop and not just for the mouse into the gridgrouparea? > >What is the purpose of the dragenter and the dragleave events? > >cheers >

Loader.
Live Chat Icon For mobile
Up arrow icon