CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2000
    Posts
    45

    Drawing controls on a form at runtime like VB does?

    Hello,

    I would like to know how you can dynamically add controls to a form by allowing the user to draw the control onto the form like you do in VB when you design a program.

    Any help would be appreciated.




  2. #2
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Drawing controls on a form at runtime like VB does?

    You need to start with one of each typoe of control with the index 0 on your form.
    To add a new control you need to:

    Load (TextBoxCtl(TextBoxCtl.Count))




    Then you need to simulate the size boxes. I'd suggest picture boxes about 5 pixels square with their background dark blue or black. In the picturebox MouseMove event, if the left button is down, vreate a drag outline and when the button is released resize the control to that outline's size.

    HTH,
    D.

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

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

Featured