This is a migrated thread and some comments may be shown as answers.

Customizing the control and adding features to it

1 Answer 108 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Hass
Top achievements
Rank 1
Hass asked on 04 Feb 2020, 02:46 PM

Hi,

I have 2 questions about Image Editor:

1- I want to make the image which i open to fulfill the whole area, how?

2- I want to control the vertical menu width, how?

3- I want to add a button on top of the opened image, but I want to that the drawings to appear on top of the added button, how?

4- I want to add an entry to the menu (flag) where when clicking it it adds an flag png image to the image where i can drag/drop it and draw on top of it, any idea?

Thx

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 07 Feb 2020, 12:02 PM

Hello Hass,

Straight to your questions:

1. If you need to auto adjust the image size to fit the boundaries of RadImageEditor, it is necessary to handle the RadImageEditor.ImageLoaded event and execute the following code: 

private void RadImageEditor1_ImageLoaded(object sender, AsyncCompletedEventArgs e)
{
    float factor = this.GetAutoZoomFactor();
    this.radImageEditor1.ImageEditorElement.ZoomFactor = new SizeF(factor, factor);
}

private float GetAutoZoomFactor()
{
    float factorX = (this.radImageEditor1.ImageEditorElement.Size.Width - this.radImageEditor1.ImageEditorElement.CommandsElementWidth) / (float)System.Convert.ToSingle(this.radImageEditor1.ImageEditorElement.CurrentBitmap.Width);
    float factorY = (this.radImageEditor1.ImageEditorElement.Size.Height - this.radImageEditor1.ImageEditorElement.ZoomElementHeight) / (float)System.Convert.ToSingle(this.radImageEditor1.ImageEditorElement.CurrentBitmap.Height);
    return Math.Min(factorX, factorY);
}

2. In order to change the width of the menu area, you should specify the CommandsElementWidth property:

 this.radImageEditor1.ImageEditorElement.CommandsElementWidth = 60;

3. It is not very clear to me what exactly your custom requirement is. Could you please specify where exactly you want to add a button. If the drawings appear over a button how the button should be clickable? It would be greatly appreciated if you can provide a picture in order to understand better your idea.

4. If I understand you correctly, you would like to drag a picture over an already loaded picture and be able to drag and drop it. Currently, this is not a supported feature for RadImageEditor. However, I found this a reasonable request and I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik Points.

I am looking forward to your reply.

Regards,
Nadya
Progress Telerik

RadImageEditor for Winforms
Tags
ImageEditor
Asked by
Hass
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or