I doubt that you can do this

  • Thread starter Thread starter active
  • Start date Start date
A

active

I want to make my own picture box which is the VB picture box plus things
like scrollbars.

I'd like to inherit the VB picturebox but need to add additional controls to
my picturebox.

I don't imagine there is any way I can automatically have all the VB
picturebox properties be also my picturebox properties. Which is what
inheritance would give me.

Is there anything close?


Thanks
Cal
 
If you make a new class that inherits from the picture box class, why
wouldn't you have all the properties of a picture box?
 
* " active said:
I want to make my own picture box which is the VB picture box plus things
like scrollbars.

I'd like to inherit the VB picturebox but need to add additional controls to
my picturebox.

I don't imagine there is any way I can automatically have all the VB
picturebox properties be also my picturebox properties. Which is what
inheritance would give me.

The easiest way to do inherit from
'System.Windows.Forms.ScrollableControl' and extend it with the
functionality of a picturebox.
 
I already have the code to add and use the scrollbars.. Would there be a big
advantage to using ScrollableControl over using Control and Scrollbars (I
assume there is still a scrollbar control.)

Thank
Cal
 
* " active said:
I already have the code to add and use the scrollbars.. Would there be a big
advantage to using ScrollableControl over using Control and Scrollbars (I
assume there is still a scrollbar control.)

Where do you use the scrollbars? Did you add them to the picturebox?
 
* " active said:
If I inherit how can I add scrollbars?
Is there a way to do that?

Not so easy, because 'PictureBox' doesn't inherit from
'ScrollableControl' and multiple inheritance is not supported by .NET.
 
* " active said:
I have a usercontrol that contains a picturebox and two scrollbars

That will work too, but why not inherit from 'ScrollableControl' and
add a picturebox?
 
Just pointing out, you can set the AutoScroll property of any control
container to True and it will automatically show scrollbars if any controls
are outside the visible boundaries of the container. Maybe you could use
that instead?

Andrew
 
Back
Top