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

paste image

I want to paste a single cell. The problem that is possible paste a image in a cell. have a mode to disable this ?

thanks.

Question.zip

5 Replies

AD Administrator Syncfusion Team August 21, 2006 05:37 AM UTC

Hi Marcia,

You can prevent a paste by subscribing to the grid.Model.ClipboardCanPaste event and setting e.Handled = true and doing nothing in your handler.

private void Model_ClipboardCanPaste(object sender, GridCutPasteEventArgs e)
{
if( this.gridControl1.CurrentCell.RowIndex == 1 || e.RangeList.Contains(GridRangeInfo.Row(1)) )
{
e.Handled = true;
e.Result = false;
}
}

Let me know if this helps.
Best Regards,
Haneef


AD Administrator Syncfusion Team August 21, 2006 04:28 PM UTC

Hi Haneef!!!

Thanks for your reply. But this not resolve my problem. My problem is when select something in cell and click in ctrl+c. At moment appers image.I want disable a property to paste a image in cell. Is this possible ????


steps:
-> select the text in the cell.
-> with a image in clipboard paste in cell.

thanks!!!!

>Hi Marcia,

You can prevent a paste by subscribing to the grid.Model.ClipboardCanPaste event and setting e.Handled = true and doing nothing in your handler.

private void Model_ClipboardCanPaste(object sender, GridCutPasteEventArgs e)
{
if( this.gridControl1.CurrentCell.RowIndex == 1 || e.RangeList.Contains(GridRangeInfo.Row(1)) )
{
e.Handled = true;
e.Result = false;
}
}

Let me know if this helps.
Best Regards,
Haneef


AD Administrator Syncfusion Team August 22, 2006 10:22 AM UTC

Hi Marcia,

There is no default property setting to paste a image in a cell. You need to set the CellType to InPlaceRichText and override InPlaceRichText CellRenderer''s CanPaste method. Please refer the attached sample for more details and let me know if you looking something different.

private void Model_ClipboardCanPaste(object sender, GridCutPasteEventArgs e)
{
InPlaceRichTextCellRenderer cr = this.gridDataBoundGrid1.CurrentCell.Renderer as InPlaceRichTextCellRenderer;
if( cr != null)
{
cr.Paste();
}
}

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/PasteinRichTextInPlaceCellContol_5a51719e.zip

Also refer the KB Article for InPlaceRichText CellType.
http://www.syncfusion.com/Support/article.aspx?id=10495

Best Regards,
Haneef


MA Marcia August 23, 2006 05:07 PM UTC

Hi!!

thanks for your replay again. But your code only function with "celltype" of type GridRichTextBoxCellRenderer. Others types like for example GridTextBoxCellRenderer no function. My grid`s have several types : static cells ,button cells.

Please help me !!! :)

>Hi Marcia,

There is no default property setting to paste a image in a cell. You need to set the CellType to InPlaceRichText and override InPlaceRichText CellRenderer''s CanPaste method. Please refer the attached sample for more details and let me know if you looking something different.

private void Model_ClipboardCanPaste(object sender, GridCutPasteEventArgs e)
{
InPlaceRichTextCellRenderer cr = this.gridDataBoundGrid1.CurrentCell.Renderer as InPlaceRichTextCellRenderer;
if( cr != null)
{
cr.Paste();
}
}

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/PasteinRichTextInPlaceCellContol_5a51719e.zip

Also refer the KB Article for InPlaceRichText CellType.
http://www.syncfusion.com/Support/article.aspx?id=10495

Best Regards,
Haneef


AD Administrator Syncfusion Team August 24, 2006 07:29 AM UTC

Hi Márcia,

I am afraid that this feature is not currently supported by Essentail Grid. But you can paste a image in a cell using the InPlaceRichTextBox celltype. Please refer the below sample for more details.

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/PasteinRichTextInPlaceCellContol_5a51719e.zip

Thanks for your patience.
Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon