|
-
Feb 24th, 2010, 09:44 PM
#6
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|