是否可以从剪贴板或通过拖放来将图像插入Telerik RadRichTextBox?
我尝试将复制的图像粘贴到剪贴板。正如我们在下面的照片中看到的那样,白色背景的东西被插入。但这不是一张预期的照片。
<telerik:RadRichTextBox x:Name="RADRichTextBox" MaxWidth="250" BorderBrush="Black" IsSelectionMiniToolBarEnabled="True" DocumentInheritsDefaultStyleSettings="True" FontSize="14" ForceCursor="True" IsSpellCheckingEnabled="True" Height="50" MaxHeight="100">
<telerik:RadDocument x:Name="RADDocument" DefaultPageLayoutSettings="600,800" />
</telerik:RadRichTextBox>
&#13;
提前谢谢!
答案 0 :(得分:0)
CommandExecuting="RADRichTextBox_CommandExecuting"
if (e.Command is PasteCommand)
{
e.Cancel = true;
if (System.Windows.Forms.Clipboard.ContainsImage())
{
MemoryStream lStream = new MemoryStream();
System.Drawing.Image lImage = null;
lImage = System.Windows.Forms.Clipboard.GetImage();
lImage.Save(lStream, System.Drawing.Imaging.ImageFormat.Png);
lStream.Position = 0;
this.RADRichTextBox.InsertImage(lStream, "Png");
}
else if (System.Windows.Forms.Clipboard.ContainsText())
{
this.RADRichTextBox.Insert(System.Windows.Forms.Clipboard.GetText());
}
}