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

Draw Text Tool

2 Answers 75 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Jonah
Top achievements
Rank 1
Jonah asked on 07 Mar 2014, 03:17 PM
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 Answers, 1 is accepted

Sort by
0
Jonah
Top achievements
Rank 1
answered on 07 Mar 2014, 09:38 PM
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?
0
Missing User
answered on 10 Mar 2014, 04:18 PM
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.

Tags
ImageEditor
Asked by
Jonah
Top achievements
Rank 1
Answers by
Jonah
Top achievements
Rank 1
Missing User
Share this question
or