Custom Save Button

5 posts, 1 answers
  1. Ali
    Ali avatar
    15 posts
    Member since:
    Aug 2013

    Posted 06 Jan Link to this post

    Hi Team.

    How can I create a custom save button to save the edited Image directly into the sql sever database or use the default save button to save the image directly to the the database.

    However, the only option I have right now is to save the image to file and then save image file to the database, which I want to avoid because I will end up having two save buttons.

    Thank you.

  2. Dimitar
    Admin
    Dimitar avatar
    2728 posts

    Posted 07 Jan Link to this post

    Hi Ali,

    Here is how you can override the default action:
    class MyImageEditor : RadImageEditor
    {
        protected override RadImageEditorElement CreateImageEditorElement()
        {
            return new MyImageEditorElement();
        }
    }
    class MyImageEditorElement : RadImageEditorElement
    {
        protected override Type ThemeEffectiveType
        {
            get
            {
                return typeof(RadImageEditorElement);
            }
        }
        public override void SaveImageAs()
        {
           //add your code
        }
    }

    I hope this will be useful.  

    Regards,
    Dimitar
    Progress TelerikRadImageEditor for Winforms
  3. Ali
    Ali avatar
    15 posts
    Member since:
    Aug 2013

    Posted 07 Jan Link to this post

    Hi Dimitar,

    Thank you. I have implemented the code and initialize it as below:

    Sub New()
            ' This call is required by the designer.
            InitializeComponent()
            Me.RadImageEditor1 = New MyImageEditor

    End Sub

    and on my form Load I try to create a blank bitmap image

    Private Sub formImageEditor_Load(sender As Object, e As EventArgs) Handles Me.Load
                RadImageEditor1.OpenImage(New Bitmap(500, 500))
    End Sub

    but then it keeps opening the file open dialog when ever I try to Draw something.

    Regards.

     

     

     

     

  4. Ali
    Ali avatar
    15 posts
    Member since:
    Aug 2013

    Posted 07 Jan Link to this post

    Hi Dimitar,

    I have resolve it. I just have to replace the RadImageEditor1 initialization directly within the designer.vb file.

    e.i Me.RadImageEditor1 = New MyImageEditor()

    Thank you.

  5. Answer
    Dimitar
    Admin
    Dimitar avatar
    2728 posts

    Posted 08 Jan Link to this post

    Hello Ali,

    Yes, this is the correct approach. Do not hesitate to contact us if you have other questions.
     
    Regards,
    Dimitar
    Progress TelerikRadImageEditor for Winforms
Back to Top