Draw Text Tool

3 posts, 0 answers
  1. Jonah
    Jonah avatar
    29 posts
    Member since:
    Oct 2012

    Posted 07 Mar 2014 Link to this post

    I made a custom settings container for my image editor. I am wondering on the draw text tool, how can I bind the properties there to my custom settings UI? Also wondering if I can change the background of the textblock that is displayed? Is there a custom tool demo that closely resembles the DrawTextTool?

    Thank you
  2. Jonah
    Jonah avatar
    29 posts
    Member since:
    Oct 2012

    Posted 07 Mar 2014 Link to this post

    Ended up just copying the Telerik DrawText tool and adding a background there. I did have another question. The default ok/cancel buttons on the editor, is there somewhere I can catch that event so I can change it to commitTool(False) so it doesn't keep opening the same tool, or is there somewhere that can be set on the imageeditor?
  3. UI for WPF is Visual Studio 2017 Ready
  4. Yancho
    Admin
    Yancho avatar
    72 posts

    Posted 10 Mar 2014 Link to this post

    Hi Jonah,

    Thank you for your interest in RadImageEditor!

    I’m very happy to inform you that we have recently introduced ToolCommitting and ToolCommited events which allow to manipulating RadImageEditor easily. Please take a look at this SDK demo project which illustrates how to use them.

    In this line of thoughts, to disable the DrawText tool after single usage you can handle CommandExecuting and CommandExecuted events. This code-snippet explains how this could be achieved:
    private bool isFirst = true;
    ....
     this.ImageEditorUI.ImageEditor.CommandExecuting += ImageEditor_CommandExecuting;
     
     this.ImageEditorUI.ImageEditor.CommandExecuted += ImageEditor_CommandExecuted;
     ....
     private void ImageEditor_CommandExecuted(object sender, ImageCommandExecutedEventArgs e)
     {
         if (e.Command is OpenImageCommand)
         {
             this.isFirst = true;
         }
     }
     
     void ImageEditor_CommandExecuting(object sender, ImageCommandExecutingEventArgs e)
     {
     
         if(e.CommandParameter is DrawTextTool)
         {
             if (isFirst != true)
             {
                 e.Cancel = true;
             }
         }
     
         if (ImageEditorUI.ImageEditor.ExecutingTool is DrawTextTool)
         {
             if (this.ImageEditorUI.ImageEditor.ExecutingTool != null)
             {
                 isFirst = false;
             }
         }
     }

    I hope this helps! Let me know how it goes.

    Regards,
    Yancho
    Telerik

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Back to Top