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.

how to hightlight col and row range like excel did , in GGC ?

Thread ID:

Created:

Updated:

Platform:

Replies:

79908 Mar 3,2009 04:54 PM Mar 10,2009 02:10 AM Windows Forms 8
loading
Tags: GridControl
David Cui
Asked On March 3, 2009 04:54 PM

how to hightlight col and row range like excel did , in GGC ?

then how to get those ranges ... from GGC.

david


Rajadurai C [Syncfusion]
Replied On March 4, 2009 11:11 AM

Hi David,

Thanks for your interest in Syncfusion products.

The excel-like cell selection range can be obtained through the following code handled in TableModel.SelectionChanged event.

this.gridGroupingControl1.TableModel.SelectionChanged += new GridSelectionChangedEventHandler(TableModel_SelectionChanged);

void TableModel_SelectionChanged(object sender, GridSelectionChangedEventArgs e)
{
Console.WriteLine(e.Range.ToString());
}


Regards,
Rajadurai


David Cui
Replied On March 4, 2009 02:28 PM


Rajadurai,

Maybe I didn't make myself clear.

the problem is, I even can not to highlight muliple rows / columns. If i put the cusor, try to drag it. try to highlight block of grid. Somehow, it doesn't allow me to do it.

My purpose, is, use control v, control c to copy the highlighted block of the grid.

david



>Hi David,

Thanks for your interest in Syncfusion products.

The excel-like cell selection range can be obtained through the following code handled in TableModel.SelectionChanged event.

this.gridGroupingControl1.TableModel.SelectionChanged += new GridSelectionChangedEventHandler(TableModel_SelectionChanged);

void TableModel_SelectionChanged(object sender, GridSelectionChangedEventArgs e)
{
Console.WriteLine(e.Range.ToString());
}


Regards,
Rajadurai




Rajadurai C [Syncfusion]
Replied On March 5, 2009 08:56 AM

Hi David,

Please try to set the following code as this allows you to do selection of a range of cells.

this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;


With this, copy and paste through Ctrl+C and Ctrl+V respectively can be handled.

Regards,
Rajadurai


David Cui
Replied On March 5, 2009 09:59 AM

some how it is not working for me. can you send a simple sample ?

David


>Hi David,

Please try to set the following code as this allows you to do selection of a range of cells.

this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;


With this, copy and paste through Ctrl+C and Ctrl+V respectively can be handled.

Regards,
Rajadurai




David Cui
Replied On March 6, 2009 01:03 AM


Sorry I figured it out. seems selectionMode=One can not mixed with selectionMode = any. You can not have both.

However, when i hightlight the range, it disappeared if i do right-click context menu. Is there way to preserve the hightlight (selection) range for i do right-click to do contextMenu cmd ?

thx.


>some how it is not working for me. can you send a simple sample ?

David


>Hi David,

Please try to set the following code as this allows you to do selection of a range of cells.

this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;


With this, copy and paste through Ctrl+C and Ctrl+V respectively can be handled.

Regards,
Rajadurai






Rajadurai C [Syncfusion]
Replied On March 6, 2009 10:11 AM

Hi David,

The AllowSelection property and ListBoxSelectionMode property cannot be used together. If one is used, another property must be set to None.

The selected range can be preserved on right click through setting SelectCellsMouseButtonsMask property to MouseButtons.Left.

Please refer to the following code.

this.gridGroupingControl1.TableControl.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;


Regards,
Rajadurai


David Cui
Replied On March 9, 2009 11:18 AM


Rajadurai, Thanks, it is really helpful info. It works for me.

Only question is, ctr c. ctr v, is automatically works Or i need to explicitly implment clipboard ... ?

David


>Hi David,

The AllowSelection property and ListBoxSelectionMode property cannot be used together. If one is used, another property must be set to None.

The selected range can be preserved on right click through setting SelectCellsMouseButtonsMask property to MouseButtons.Left.

Please refer to the following code.

this.gridGroupingControl1.TableControl.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;


Regards,
Rajadurai




Rajadurai C [Syncfusion]
Replied On March 10, 2009 02:10 AM

Hi David,

The operation of Ctrl +C, Ctrl +V normally works with grid by default. If you need to customize the clipboard copy & paste, you can stop this default operation by setting Handled property to true in ClipboardCopy and ClipboardPaste events and your own code in it.

this.gridControl1.ClipboardCopy += new GridCutPasteEventHandler(gridControl1_ClipboardCopy);
void gridControl1_ClipboardCopy(object sender, GridCutPasteEventArgs e)
{
e.Handled = true;//cancels the default copy
//own code
}


Regards,
Rajadurai


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.

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.

;