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

Set default value for Draw Shape and Draw Text.

3 Answers 127 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
sabel
Top achievements
Rank 1
sabel asked on 09 Nov 2020, 10:19 AM

Hi, how can I set the default value for Draw Shape and Draw Text element. For example I set the default value border thickness=3 , shape color = red, shape fill = transparent. For now, all the setting I need to set at the DrawShapeDialog. Can I hide this pop up? So that user can straight forward to make a draw.

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Nov 2020, 01:13 PM
Hello, Sabel, 

The following code snippets demonstrates how to draw directly a predefined shape or text in RadImageEditor without the necessity of showing the respective dialog:
       private void radButton1_Click(object sender, EventArgs e)
        {
            ShapeInfo info = new ShapeInfo(ShapeType.Square, Color.Red, Color.Yellow,3);
            this.radImageEditor1.ImageEditorElement.StartDrawing(info);
        }

        private void radButton2_Click(object sender, EventArgs e)
        {
            this.radImageEditor1.ImageEditorElement.DrawString(
                "Text to draw",
                18, //font size
                Color.Yellow, //Text color
                100, //horizontal position
                50, //vertical position
                45);
        }

I hope this information helps. If you need any further assistance please don't hesitate to contact me.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
sabel
Top achievements
Rank 1
answered on 10 Nov 2020, 04:14 AM

Hi Dess, thank you for your reply.

 

Here I create a custom dialog for DrawShapeDialog, 

The problem is I get error for RadColorBoxBorderColor. Its say that How can I access the Border Color value?

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Nov 2020, 10:12 AM

Hello, Sabel,  

Please refer to the following modified code snippet demonstrating how to access the RadColorBox control which controls the border color:
        public class CustomImageEditorDialogFactory : ImageEditorDialogFactory
        {
            public override ImageEditorBaseDialog CreateDialog(Type type, RadImageEditorElement imageEditorElement)
            {
                ImageEditorBaseDialog dialog = base.CreateDialog(type, imageEditorElement);
                if (dialog is DrawShapeDialog)
                {
                    ((RadColorBox)dialog.Controls[0].Controls["radColorBoxBorder"]).Value= Color.Red;
                }
                return dialog;
            }
        }

If you are not sure what is the name of the exact control, you can always download the source code from your Telerik account and inspect the default implementation for the dialog.

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
ImageEditor
Asked by
sabel
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
sabel
Top achievements
Rank 1
Share this question
or