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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Pasting over cells with Syles

Thread ID:





25697 Mar 3,2005 09:37 PM UTC Mar 4,2005 08:36 AM UTC WinForms 3
Tags: GridControl
John Baker
Asked On March 3, 2005 09:37 PM UTC

How would I go about removing the style for cells that are changed as a result of a paste event? I am trying to set the style in Grid.CellsChanging, but the grid is aparently ignoring my changes.

Administrator [Syncfusion]
Replied On March 4, 2005 12:04 AM UTC

I am not sure I understand what you need. But if you want to turn off pasting styles (and only paste text), you can set: this.gridControl1.CutPaste.ClipboardFlags &= ~GridDragDropFlags.Styles;

John Baker
Replied On March 4, 2005 02:28 AM UTC

Let me try to clarify. I have selected a range A1-A5 (or any arbitrary range from the grid or external source). I set C2 as the current cell. Cells C3 and C5 both have a background color set to Red. Since the range I am pasting will overwrite those cells, I want the red background to go back to white. >I am not sure I understand what you need. > >But if you want to turn off pasting styles (and only paste text), you can set: > >this.gridControl1.CutPaste.ClipboardFlags &= ~GridDragDropFlags.Styles; >

Administrator [Syncfusion]
Replied On March 4, 2005 08:36 AM UTC

Is this a GridControl? If so, try setting e.Style.BackColor in SaveCellInfo for the pasted cells. You can set a flag in gridControl.ClipboardPaste, and test it in SaveCellInfo to indicate you need to set the e.Style.BackColor, and then turn the flag off in gridControl1.Model.ClipboardPasted. If this is a gridDataBoundGrid, then you cannot set backcolors of individual cells. Instead, you woul dneed to handle grid.prepareViewStyleInfo and set e.Style.backColor there dynamically based on e.RowIndex and e.ColIndex. This means you would have to maintin a list of cells you want to specially color, and then check for these cells in PrepareViewStyleInfo.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon