DrawTextTool Default Font Size

6 posts, 0 answers
  1. Nisarg
    Nisarg avatar
    25 posts
    Member since:
    Dec 2011

    Posted 25 Sep 2015 Link to this post

    Hi,

    How can I set default font size to 20 instead of 36 for DrawTextTool of RadImageEditor.

    Please see attached image.

    Thanks

     

  2. Tanya
    Admin
    Tanya avatar
    402 posts

    Posted 29 Sep 2015 Link to this post

    Hi Nisarg,

    There is no an out-of-the-box way to change the default settings of the DrawTextTool and we have logged a task to expose an API, which will allow setting them easily. You could track our progress on it following the related public item.

    To achieve the goal, you could inherit the default tool and implement a custom one, which overrides the ResetSetting() method to return the desired value for the FontSize property:
    public class CustomDrawTextTool : DrawTextTool
    {
        private DrawTextToolSettings SettingsUI
        {
            get
            {
                return (DrawTextToolSettings)this.GetSettingsUI();
            }
        }
     
        public override void ResetSettings()
        {
            base.ResetSettings();
            this.SettingsUI.TextFontSize = 20;
        }
    }

    More information about creating a custom tool you could find in our documentation.

    Regards,
    Tanya
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Nisarg
    Nisarg avatar
    25 posts
    Member since:
    Dec 2011

    Posted 30 Sep 2015 in reply to Tanya Link to this post

    Hi Tanya,

    I have tried above code by crating CustomDrawTextTool  but it gives me error when I rebuild project.

    ResetSettings() method is not virtual, abstract, or override type.

    Error : CustomDrawTextTool.ResetSettings()': cannot override inherited member 'Telerik.Windows.Media.Imaging.Tools.DrawTextTool.ResetSettings()'
     because it is not marked virtual, abstract, or override.

    Thanks

     

  5. Tanya
    Admin
    Tanya avatar
    402 posts

    Posted 02 Oct 2015 Link to this post

    Hi Nisarg,

    The ResetSettings() method and the DrawTextTool class are marked as public and the signature of the method is as follows:
    public override void ResetSettings()

    Thus, you should be able to override the method in the CustomDrawTextTool class. I wasn't able to reproduce a similar issue in the test application and cannot say what may cause it. Please find attached my test project and let me know if I am missing something.

    Regards,
    Tanya
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Nisarg
    Nisarg avatar
    25 posts
    Member since:
    Dec 2011

    Posted 08 Oct 2015 Link to this post

    Hi Tanya,

    Thanks for the reply.

    As you mentioned above, public override void ResetSettings()  but when I checked it, this is not Override method and I am not able to build "ImageEditorCustomToolDemo" project due to this method.

    Please see attached file of telerik DrawTextTool class.

    Thanks

     

     

  7. Todor
    Admin
    Todor avatar
    168 posts

    Posted 12 Oct 2015 Link to this post

    Hello Nisarg,

    Since our Q1 2015 release, we introduced the abstract ToolBase class which implements the ITool interface and is inherited by all built-in RadImageEditor tools. The reason you are not able to override the ResetSettings() method is that the binaries you are using are older than the above-mentioned version. Tanya suggested you that approach because the version in the thread info is from our Q2 release - 2015.2.728.

    You could implement the ITool interface and implement your own DrawText tool, or you could upgrade to a version where the ToolBase class exists and use the suggest approach by Tanya.

    I hope this helps.
    If you need further assistance, please get back to us again.

    Regards,
    Todor
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready