Disable image editor pop up

4 posts, 0 answers
  1. Romel
    Romel avatar
    20 posts
    Member since:
    May 2012

    Posted 27 Jun 2018 Link to this post

    Hi all,

    When clicking the "Draw Shape", "Draw Text", etc, buttons on the image editor, is there a way to disable the pop up windows that comes up by default?

    I don't want my users to be able to select the colors when they draw. Thank you.

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3209 posts

    Posted 28 Jun 2018 Link to this post

    Hello, Romel,   

    Note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so we suggest you using a support ticket, which would be handled before a forum thread and a reply from a Telerik support engineer is guaranteed.

    As to the question at hand, when you click the 'Draw Shape' button, an appropriate dialog is shown, e.g. DrawShapeDialog. This behavior is controlled by the ShowDrawShapeDialog method of RadImageEditorElement. Hence, you can create a derivative of the RadImageEditorElement and override this method in order to control what dialog to be shown or whether to be shown. Then, create a custom RadImageEditor and replace the default RadImageEditorElement with the custom one in the CreateImageEditorElement method.

    I hope this information helps. If you have any additional questions, please let me know. 

    Regards,
    Dess
    Progress TelerikRadImageEditor for Winforms
  3. Romel
    Romel avatar
    20 posts
    Member since:
    May 2012

    Posted 28 Jun 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hi Dess,

    Thanks again for the response. I kind of had an idea that I would have to override, but I just wanted to make sure that there wasn't a property that I could just enable/disable somewhere.... =)

    So do I need to create a "custom" control, or can I go with a "user control"? Thank you.

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3209 posts

    Posted 29 Jun 2018 Link to this post

    Hello, Romel,   

    It is not necessary to create a UserControl. You can simply create the custom RadImageEditor as follows:

    public class CustomImageEditor : RadImageEditor
    {
        protected override RadImageEditorElement CreateImageEditorElement()
        {
            return new CustomRadImageEditorElement();
        }
    }
     
    public class CustomRadImageEditorElement:RadImageEditorElement
    {
        public override void ShowDrawShapeDialog()
        {
            //TODO
     
            //prevent the basic logic in order to skip shoing the dialog
            //base.ShowDrawShapeDialog();
        }
    }

    Then, in the Designer.cs replace the initialization of the RadImageEditor with the custom class.

    private void InitializeComponent()
     {
         this.radImageEditor1 = new CustomImageEditor();
    //other code
     }

    I hope this information helps. If you have any additional questions, please let me know. 
       
    Regards,
    Dess
    Progress TelerikRadImageEditor for Winforms
Back to Top