Results 1 to 36 of 36

Thread: UserControl ScaleMode issue

Threaded View

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

    Re: UserControl ScaleMode issue

    Maybe Resizer, Autosizer might be better search terms.

    Well, you cannot subclass a windowless control. It is impossible because in order to subclass, you need a window handle. Windowless controls don't have those.

    I took a look at your project and suggest two things.
    1. Move it to this thread so people don't have to jump to another thread to look at it.
    2. I don't see any code in there where you are using MoveWindow or SetWindowPos APIs. You may not be using them correctly; but we don't know.

    A slightly different approach to your project is not to use a containerized usercontrol. Maybe just use one usercontrol where the coder adds control hWnds to it via a method like: Public Function AttachHwnd(theHwnd As Long); the actual control isn't placed inside the uc, only its hWnd is used for subclassing purposes. This would allow the user to place just one control on their form and subclass any hWnd they send to your usercontrol. Just an idea.

    Oh, and what happens if someone drops multiple controls in your uc? How are you going to resize it to the group of controls? Image this can get really nasty. Example: if there were 5 controls like the 5 dots on a dice. If user adds the 4 corner dots to your uc, then tries to add the middle dot to another uc, one uc will overlap the other.

    And one last thing. I doubt anyone is going to want to see your uc's text and borders in runtime. If you continue with using a containerized uc, you may want to test for runtime/designtime and do not draw text/borders at runtime. This of course means that you'll have two resize scenarios because the uc won't be the same size during runtime/designtime if you go that route.
    Last edited by LaVolpe; Feb 25th, 2010 at 12:40 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}

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