Results 1 to 16 of 16

Thread: Shape Editor, including many shapes, Resize and more

Hybrid View

  1. #1
    New Member
    Join Date
    May 2012
    Posts
    14

    Re: Shape Editor, including many shapes, Resize and more

    How to add text on a shape ????

    I've added this property to base class shape _

    private string _Texto = String.Empty;
    public string Texto
    {
    get { return _Texto; }
    set
    {
    if (value.Trim() == String.Empty)
    throw new ArgumentException("Texto cannot be empty.");
    _Texto = value;
    }
    }

    But i need to extend to (for example Rectangle )...how ??

    Thanks for your great work !!

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Shape Editor, including many shapes, Resize and more

    Quote Originally Posted by dtanh View Post
    hello @NickThissen!

    can you help me about rotate rectangle in your code please!
    Rotation of shapes is not supported. You could however create a new shape that has a Rotation property, and draw your rotated rectangle accordingly inside the current bounds. That would require a little trigonometry to figure out the locations of the four corners.

    Quote Originally Posted by magefesa View Post
    How to add text on a shape ????

    I've added this property to base class shape _




    But i need to extend to (for example Rectangle )...how ??

    Thanks for your great work !!
    You could create your own class that inherits RectangleShape (or just Shape), add the Text property in that class (instead of the base class), and then override the Draw method and use Graphics.DrawString to draw the text.

  3. #3
    New Member
    Join Date
    Jul 2012
    Posts
    2

    Re: Shape Editor, including many shapes, Resize and more

    Quote Originally Posted by NickThissen View Post
    Rotation of shapes is not supported. You could however create a new shape that has a Rotation property, and draw your rotated rectangle accordingly inside the current bounds. That would require a little trigonometry to figure out the locations of the four corners.
    Thanks for your reply! i have been tried to rotate my rectangle, but not good. My rectangle is the current bound.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width