Custom Shape Editor

10 posts, 0 answers
  1. British
    British avatar
    12 posts
    Member since:
    Jul 2014

    Posted 24 Feb Link to this post

    Hi

    i use telerik 2015 q3 for winforms

    i wanna change the shape of my labels. i have several labels and each of them must have their own shape.

    i use the shape property in the in smart tag -> edit ui element -> root element -> shape

    and select my predefiened shape and then change the border primitive shape and my label shape change successfully.

    but when i use the create new shape instead of select predefined shape nothing happen and when i finish create new one in custom shape editor and click ok, no chnage apeare.

    could you please tell me right way

    Regard

  2. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 25 Feb Link to this post

    Hello,

    Thank you for writing.

    In order to display the borders, you also need to set the BorderVisible property of your label to true. Considering the custom shapes defined in the designer, we have an issue logged in our feedback portal. You can track its progress, subscribe to status changes and add your vote/comment to it on the following link - feedback item

    As a workaround solution, I can suggest creating your custom shape in the editor tool and then copy the value of its AsString property.Then create a new custom shape at run-time and set its AsString property to the value you have copied from the editor: 
    protected override void OnShown(EventArgs e)
    {
        base.OnShown(e);
     
        this.radLabel1.BorderVisible = true;
        CustomShape shape = new CustomShape();
        shape.AsString = "20,20,200,100:20,20,False,0,0,0,0,0:196.0684,40.76923,False,0,0,0,0,0:219.6581,119.7436,False,0,0,0,0,0:45.64103,103.3333,False,0,0,0,0,0:";
        this.radLabel1.LabelElement.LabelBorder.Shape = shape;
    }

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    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 WinForms is Visual Studio 2017 Ready
  4. British
    British avatar
    12 posts
    Member since:
    Jul 2014

    Posted 27 Feb in reply to Hristo Merdjanov Link to this post

    Hi

    Thank you for the reply

    i come over that in design time

    here is solution:

    1. create new custom shape in the shape property of the root element of control.

    2. copy AsString value

    3 paste above value in shape property of Border Primitive

    shape will be apply to control. i did this with a label and worked fine

    Best Regard

     

  5. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 29 Feb Link to this post

    Hello,

    Thank you for sharing your solution with the community.

    I confirm that the approach is valid and you can go ahead with it since it fits your scenario.

    Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    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. peter
    peter avatar
    5 posts
    Member since:
    Jun 2016

    Posted 15 Jun Link to this post

    hi

    i mad a shaped label as what picture attached.

    when i set the back color of the label it apply to label and not just colorize the label to its border i defined.

    i mean i want colorize my label to its border not total label. the color goes furter the border.

    could you please give the solution?

    thanks

  7. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 15 Jun Link to this post

    Hi Peter,

    Thank you for writing.

    Please make sure that you are applying the same shape to the FillPrimitive object. You can access it through the LabelFill property of the label element. Please check my code snippet below:
    protected override void OnShown(EventArgs e)
    {
        base.OnShown(e);
     
        this.radLabel1.BorderVisible = true;
        CustomShape shape = new CustomShape();
        shape.AsString = "20,20,200,100:20,20,False,0,0,0,0,0:196.0684,40.76923,False,0,0,0,0,0:219.6581,119.7436,False,0,0,0,0,0:45.64103,103.3333,False,0,0,0,0,0:";
        this.radLabel1.LabelElement.LabelBorder.Shape = shape;
     
        this.radLabel1.LabelElement.LabelFill.BackColor = Color.Red;
        this.radLabel1.LabelElement.LabelFill.Shape = shape;
    }

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  8. peter
    peter avatar
    5 posts
    Member since:
    Jun 2016

    Posted 21 Jun Link to this post

    hi

    i have a pageview that has three tab. in each tab i  have several shaped label.

    i want to use several shaped label in another form, but when i copy them they do not look wyhat i want. is there any way to save or copy the created shaped control?

    thanks in advanced

  9. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 21 Jun Link to this post

    Hello Peter,

    Thank you for writing back.

    Could you please make sure that the issue you are experiencing is not related to the following feedback item?If that is the case you would need to set the shape programmatically as I suggested in one of my previous posts.

    If you keep experiencing the issue please open up a support ticket and send us your project so that we can investigate it locally.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  10. peter
    peter avatar
    5 posts
    Member since:
    Jun 2016

    Posted 22 Jun in reply to Hristo Merdjanov Link to this post

    hi

    i have no problem with create shape control from the designer.

    i create my shape from border primitive in custom shape editor and give it a unique name. and i also give the created shape to fill primitive shape property to fit color to the correct border.

    i have 16 shaped label in each page of my page view and they work fine.

    i just want copy for example one of my shaped control and use it in another form.

    but when i copy and paste the cpied control is not what i want.i have to again copy the AsString property of my created shaped control and the create my label in the target form and paste fill primitive and border primitive As string shape proprty to work fine.

     

    i just want when i copy a shaped control from a form and paste it to another form it's shape keep and do not change.

     

    by the way i will send here a tutorial file that show how create shape control to use by other(if have time).

    Thanks

  11. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 22 Jun Link to this post

    Hi Peter,

    Thank you for writing back.

    The custom shapes are serialized as separate components and they are not copied when you move the label from one form to another. As you noted, you would need to set the AsString property individually for each of the copied labels. Alternatively, you can also do this at run-time.

    I hope this helps. Should you have further questions please do not hesitate to write back. 

    Regards,
    Hristo Merdjanov
    Telerik
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready