T
Tony
So, here is the (back of a cigarette packet) spec for a
new UserControl I am trying to develop -
1. It needs to be a control container
2. Scroll bars should appear if any contained control is
outside the visible area
3. A navigation button should appear if any contained
control is outside the visible area
4. Clicking the button should cause a context menu to
appear offering -
Top
Bottom
Left
Right
-
Top Left
Top Right
Bottom Left
Bottom Right
5. Clicking one of the menu options should move to the
appropriate location
6. If any contained control recieves the focus, the
container should ensure that the contained control is in
the visible region, if not then it should be automatically
scrolled into the visible region.
I have written this control in VB6 and it took me a couple
of hours. In VB.Net, I can't even get the new control to
act as a container. I have tried -
Me.SetStyle(ControlStyles.ContainerControl, True)
Me.UpdateStyles()
in the .New method but it doesn't seem to make any
difference, when a control is pasted into my new control,
it doesn't end up contained (i.e. it's parent is still the
windows form rather than my new control). I have searched
the help and various web sites for an example of a
UserControl that acts as a container (and still has a
surface that I can place the scroll bars and button on) to
no avail.
Am I missing something fundamental here? I have been
writing code for 25 years (starting out on a ZX Spectrum
and moving through GW Basic, QuickBasic versions 1 through
7 and finally all the Visual basic releases) and have
never come across anything so infuriating.
I would appreciate any help that you could offer.
Cheers, Tony Harrison
Microsoft Development Environment 2002 Version 7.0.9466
Microsoft .NET Framework 1.0 Version 1.0.3705
new UserControl I am trying to develop -
1. It needs to be a control container
2. Scroll bars should appear if any contained control is
outside the visible area
3. A navigation button should appear if any contained
control is outside the visible area
4. Clicking the button should cause a context menu to
appear offering -
Top
Bottom
Left
Right
-
Top Left
Top Right
Bottom Left
Bottom Right
5. Clicking one of the menu options should move to the
appropriate location
6. If any contained control recieves the focus, the
container should ensure that the contained control is in
the visible region, if not then it should be automatically
scrolled into the visible region.
I have written this control in VB6 and it took me a couple
of hours. In VB.Net, I can't even get the new control to
act as a container. I have tried -
Me.SetStyle(ControlStyles.ContainerControl, True)
Me.UpdateStyles()
in the .New method but it doesn't seem to make any
difference, when a control is pasted into my new control,
it doesn't end up contained (i.e. it's parent is still the
windows form rather than my new control). I have searched
the help and various web sites for an example of a
UserControl that acts as a container (and still has a
surface that I can place the scroll bars and button on) to
no avail.
Am I missing something fundamental here? I have been
writing code for 25 years (starting out on a ZX Spectrum
and moving through GW Basic, QuickBasic versions 1 through
7 and finally all the Visual basic releases) and have
never come across anything so infuriating.
I would appreciate any help that you could offer.
Cheers, Tony Harrison
Microsoft Development Environment 2002 Version 7.0.9466
Microsoft .NET Framework 1.0 Version 1.0.3705