Hi, Eddie,
You can use the following workaround:
public class CustomImageEditDialog : ImageEditorDialog
{
private RadButton okButton;
public CustomImageEditDialog() : base()
{
this.okButton = new RadButton();
this.okButton.Parent = this;
RadButton oldOkButton = this.Controls.Find("radButton1", true)[0] as RadButton;
this.okButton.Text = oldOkButton.Text;
this.okButton.Location = oldOkButton.Location;
this.okButton.Size = oldOkButton.Size;
this.okButton.Click += OkButton_Click;
oldOkButton.Hide();
}
private void OkButton_Click(object sender, EventArgs e)
{
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
RadImageEditor radImageEditor1 = this.Controls.Find("radImageEditor1", true)[0] as RadImageEditor;
radImageEditor1.ImageEditorElement.SaveImage(stream, System.Drawing.Imaging.ImageFormat.Png);
Telerik.WinControls.RichTextEditor.UI.Size newSize = new Telerik.WinControls.RichTextEditor.UI.Size(radImageEditor1.CurrentBitmap.Size.Width, radImageEditor1.CurrentBitmap.Size.Height);
Type type = typeof(ImageEditorDialog);
var inlineField = type.GetField("originalInline", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
ImageInline originalInline = inlineField.GetValue(this) as ImageInline;
var actionField = type.GetField("replaceCurrentInlineCallback", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
Action<Inline, Inline> replaceCurrentInlineCallback = actionField.GetValue(this) as Action<Inline, Inline>;
ImageInline newInline = new ImageInline(stream, newSize, originalInline.Extension);
replaceCurrentInlineCallback(originalInline, newInline);
}
this.DialogResult = DialogResult.OK;
}
protected override void OnClientSizeChanged(EventArgs e)
{
base.OnClientSizeChanged(e);
var c = this.Controls.Find("radButton2", true);
if (c == null || c.Length == 0)
{
return;
}
RadButton cancelButton = c[0] as RadButton;
this.okButton.Left = cancelButton.Left - this.okButton.Width - 10;
this.okButton.Top = cancelButton.Top;
this.okButton.Height = cancelButton.Height;
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
ImageEditorDialog d = new CustomImageEditDialog();
this.radRichTextEditor1.RichTextBoxElement.ImageEditorDialog = d;
}
}
Regards,
Nadya | Tech Support Engineer
Progress Telerik