CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2000
    Location
    Indianapolis, IN
    Posts
    123

    How to get a label onto a frame at run-time

    I need to be able to place label controls on an existing frame control at run-time. I want to be able to dynamically draw a label (which is the easy part) but need it to show on the form. I know all about ZOrder and the 3 layers. I know a label will show on a frame if it was added at design-time but how can I make that happen at run-time?

    Thanks for any help,
    Tobey



  2. #2
    Join Date
    Feb 2000
    Location
    Indianapolis, IN
    Posts
    123

    Re: How to get a label onto a frame at run-time

    One more thing. I have been trying to get this for a while now but o no luck. Is there any kind of call that could made to the API to get this to work? I know how to do this with a window and the SetWindowPos function, but I am not sure how to do that with a control.

    Thanks again..



  3. #3
    Join Date
    Jun 2001
    Location
    Israel
    Posts
    228

    Re: How to get a label onto a frame at run-time

    if you don't have to use an Image control but may use the Picture control you may try this:
    on the form, draw the frame first and the Picture second, that way if you put the picture in the same place the frame is it will be above the frame. image works a bit differently but you can try manipulating with this.

    ----------
    The @host is everywhere!
    ----------

  4. #4
    Join Date
    Feb 2000
    Location
    Indianapolis, IN
    Posts
    123

    Re: How to get a label onto a frame at run-time

    Well, I am not sure I understand your idea. I am not using an image control or a picture control. Basically, what I am doing, is making a Visual Basic-type IDE for a proprietary language. I need to be able to dynamically create controls. I can draw any of them, including the frame and label however when I draw a label on the frame it is behind the frame. All of the others are just fine but I need the label to be visible on the form. Clear as mud?


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

    Re: How to get a label onto a frame at run-time

    In code....

    set lblTemp(lIndex).Container = fraTemp(lIndex)




    Makes the label a child of the frame. Note that you cannot use API calls to achieve this because a label is a lightweight control i.e. it doesn't have a true window of its own.

    Hope this helps,
    Duncan

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  6. #6
    Join Date
    Feb 2000
    Location
    Indianapolis, IN
    Posts
    123

    Re: How to get a label onto a frame at run-time

    oh my goodness! I forgot all about that. worked like a charm. thanks ever so much..

    Tobey


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