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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

changing a gridgroupdroparea

Thread ID:

Created:

Updated:

Platform:

Replies:

27359 Apr 11,2005 03:28 PM UTC Apr 12,2005 05:30 PM UTC WinForms 7
loading
Tags: Grouping
Julien Goldberg
Asked On April 11, 2005 03:28 PM UTC

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

Administrator [Syncfusion]
Replied On 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

Julien Goldberg
Replied On 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

Julien Goldberg
Replied On 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.

Julien Goldberg
Replied On 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

Administrator [Syncfusion]
Replied On 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.

Julien Goldberg
Replied On 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

Administrator [Syncfusion]
Replied On 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 >

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

;