Results 1 to 6 of 6

Thread: Set Label/Shape controls Parent ?

  1. #1

    Thread Starter
    Member
    Join Date
    May 2011
    Posts
    35

    Question Set Label/Shape controls Parent ?

    How can i Set Label/Shape controls Parent ---Set Parent function is not working with these controls...

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Set Label/Shape controls Parent ?

    SetParent API only works for controls with hWnds. Labels, shape controls are windowless. You cannot move a windowless control from one form to another form, but you can move it in/out of containers within the form.... Let's say Label1 was on the form & you want to put it inside a picturebox on the same form:

    Set Label1.Container = Picture1

    Edited: So not using SetParent API, but using Set .Parent property? Either way, no can do. Set the .Container property as I described above.
    Last edited by LaVolpe; Jun 6th, 2011 at 02:35 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Set Label/Shape controls Parent ?

    You don't use Set Parent.

    Labels and shapes cannot be set as Parents but they can be the child of another control

    Set Label1.Container = Picture1


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  4. #4

    Thread Starter
    Member
    Join Date
    May 2011
    Posts
    35

    Re: Set Label/Shape controls Parent ?

    Thank you guys...

    I have a picture1(0) and a Shape1(0) inside the picture1(0)...I am trying create controls at run time...

    i want to create multiple picture1 + Shape1 sets... i.e picture1(1) + inside Shape1(1), picture1(2) + inside Shape1(2) etc...I can load the controls...but the shape controls not siting inside picture box

    I have used:

    Shape1(1).Container=picture1(1) but not getting the result...


    Any help?

  5. #5

    Thread Starter
    Member
    Join Date
    May 2011
    Posts
    35

    Re: Set Label/Shape controls Parent ?

    Oh guys i am sorry...
    I have to use:
    Set Shape1(1).Container=picture1(1):
    i used:
    Shape1(1).Container=picture1(1)

    It's working...thank you guys once again

  6. #6
    Hyperactive Member
    Join Date
    Dec 2009
    Posts
    340

    Re: Set Label/Shape controls Parent ?

    i am having same problem but the problem is i need to use set parent api because the target control is from another app. i move a control from a background running app to my app (to show status) and i need to place my label on that control. and i only have hwnd for that control. So, how i can achieve that?

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