By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,222 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,222 IT Pros & Developers. It's quick & easy.

design mode for controls inherited from Windows.Forms.UserControl

P: n/a
I need to derive the Windows.Forms.Control 2 times so I design a class like
this

Public Class BMControl
Inherits System.Windows.Forms.UserControl

Public Class MapControl
Inherits BMControl
Now, how can I make MapControl editable in design mode just like standard
System.Windows.Forms.UserControl?
Right now, I dont see a UserControl form in design mode, but a large area
non editable....I cant set the size, add controls, and stuffs like it was
System.Windows.Forms.UserControl
--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------
Nov 20 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
No ideeas?

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Crirus" <Cr****@datagroup.ro> wrote in message
news:e0**************@TK2MSFTNGP12.phx.gbl...
I need to derive the Windows.Forms.Control 2 times so I design a class like this

Public Class BMControl
Inherits System.Windows.Forms.UserControl

Public Class MapControl
Inherits BMControl
Now, how can I make MapControl editable in design mode just like standard
System.Windows.Forms.UserControl?
Right now, I dont see a UserControl form in design mode, but a large area
non editable....I cant set the size, add controls, and stuffs like it was
System.Windows.Forms.UserControl
--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

Nov 20 '05 #2

P: n/a
"Crirus" <Cr****@datagroup.ro> schrieb
I need to derive the Windows.Forms.Control 2 times so I design a
class like this

Public Class BMControl
Inherits System.Windows.Forms.UserControl

Public Class MapControl
Inherits BMControl
Now, how can I make MapControl editable in design mode just like
standard System.Windows.Forms.UserControl?
Right now, I dont see a UserControl form in design mode, but a large
area non editable....I cant set the size, add controls, and stuffs
like it was System.Windows.Forms.UserControl


I created a new project, added 3 usercontrols, changed the inherits
statement (2nd usercontrol inherits from usercontrol1, 3rd usercontrol
inherits from usercontrol2) and opened usercontrol 3 in the designer: I can
add/modify/remove controls like on Usercontrols directly derived from
Usercontrol. (VB 2003/Framework 1.1) => not reproducable
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3

P: n/a
I inherited directly from Windows.Forms.Control
Anyway, I changed in order to inherit from a control, and still cant set
background image to most derived control
It is not painted on run-time mode, even if I can see it on designer this
time
--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Armin Zingler" <az*******@freenet.de> wrote in message
news:eG**************@TK2MSFTNGP09.phx.gbl...
"Crirus" <Cr****@datagroup.ro> schrieb
I need to derive the Windows.Forms.Control 2 times so I design a
class like this

Public Class BMControl
Inherits System.Windows.Forms.UserControl

Public Class MapControl
Inherits BMControl
Now, how can I make MapControl editable in design mode just like
standard System.Windows.Forms.UserControl?
Right now, I dont see a UserControl form in design mode, but a large
area non editable....I cant set the size, add controls, and stuffs
like it was System.Windows.Forms.UserControl
I created a new project, added 3 usercontrols, changed the inherits
statement (2nd usercontrol inherits from usercontrol1, 3rd usercontrol
inherits from usercontrol2) and opened usercontrol 3 in the designer: I

can add/modify/remove controls like on Usercontrols directly derived from
Usercontrol. (VB 2003/Framework 1.1) => not reproducable
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4

P: n/a
"Crirus" <Cr****@datagroup.ro> schrieb
I inherited directly from Windows.Forms.Control
The Usercontrol designer does not work for usual Controls. Only the
component designer is available.
Anyway, I changed in order to inherit from a control, and still cant
set background image to most derived control
It is not painted on run-time mode, even if I can see it on designer
this time


Could you please describe the steps again? I think I currently cannot follow
you.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5

P: n/a
Well, I added a Control to my application
I set the background image on it
I derive another control from it and the background image is not painted in
derived control at run time
--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Armin Zingler" <az*******@freenet.de> wrote in message
news:e4**************@tk2msftngp13.phx.gbl...
"Crirus" <Cr****@datagroup.ro> schrieb
I inherited directly from Windows.Forms.Control
The Usercontrol designer does not work for usual Controls. Only the
component designer is available.
Anyway, I changed in order to inherit from a control, and still cant
set background image to most derived control
It is not painted on run-time mode, even if I can see it on designer
this time


Could you please describe the steps again? I think I currently cannot

follow you.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6

P: n/a
"Crirus" <Cr****@datagroup.ro> schrieb
Well, I added a Control to my application
A control or a usercontrol? (derived from Control or from Usercontrol?)
I set the background image on it
how? in code? Using the designer? (there is no designer with a control)
I derive another control from it and the background image is not
painted in derived control at run time

The following code works for me:

Public Class Control1
Inherits System.Windows.Forms.Control

Sub New()
Me.BackgroundImage = Image.FromFile("d:\windows\winnt.bmp")
End Sub
End Class

Public Class Control2
Inherits Control1
End Class
Form:
Private Sub Form1_Load( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load

Dim c As New Control2
c.Size = New Size(100, 100)
Me.Controls.Add(c)
End Sub
It also works doing the following steps:
1. new project
2. add Usercontrol1
3. Set property backgroundimage of usercontrol1
4. add usercontrol2
5. in usercontrol2: change to "inherits Usercontrol1"
6. build
7. put usercontrol2 on the form => backgroundimage already visible
8. run
9. backgroundimage still visible
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
Nov 20 '05 #7

P: n/a
OK, I have a class derived from UserControl called BMouse
That class modifies mousemove event...
My UserControl is derived from that class, BMouse
I try to set a picture as background of my UserControl
The picture can be seen in design window of the control but is not painted
on runing version...

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Armin Zingler" <az*******@freenet.de> wrote in message
news:ug****************@TK2MSFTNGP10.phx.gbl...
"Crirus" <Cr****@datagroup.ro> schrieb
Well, I added a Control to my application


A control or a usercontrol? (derived from Control or from Usercontrol?)
I set the background image on it


how? in code? Using the designer? (there is no designer with a control)
I derive another control from it and the background image is not
painted in derived control at run time

The following code works for me:

Public Class Control1
Inherits System.Windows.Forms.Control

Sub New()
Me.BackgroundImage = Image.FromFile("d:\windows\winnt.bmp")
End Sub
End Class

Public Class Control2
Inherits Control1
End Class
Form:
Private Sub Form1_Load( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load

Dim c As New Control2
c.Size = New Size(100, 100)
Me.Controls.Add(c)
End Sub
It also works doing the following steps:
1. new project
2. add Usercontrol1
3. Set property backgroundimage of usercontrol1
4. add usercontrol2
5. in usercontrol2: change to "inherits Usercontrol1"
6. build
7. put usercontrol2 on the form => backgroundimage already visible
8. run
9. backgroundimage still visible
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #8

P: n/a
"Crirus" <Cr****@datagroup.ro> schrieb
OK, I have a class derived from UserControl called BMouse
That class modifies mousemove event...
My UserControl is derived from that class, BMouse
I try to set a picture as background of my UserControl
Of which Usercontrol? You have two. I assume it is the latter one.

Where do you set the picture? Did you open the 2nd Usercontrol in the
designer and set the picture or did you put the 2nd Usercontrol on a Form
and set the picture of the Usercontrol instance? I assume the former.
The picture can be seen in design window of the control but is not
painted on runing version...


I still can not reproduce the problem. How did you add the Usercontrol(s)?
Reason for the question: Is there a "windows forms designer generated code"
region in both controls?


Did you try the steps I described? Which result?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #9

P: n/a
I tryed every posibility
Right now I had added the image to the UserControl in design properties and
also to the instance added to the form
None of this show it in run mode

If I open the UserControl in design I can see the background
But if I open the form with the control added, the control is painted black

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Armin Zingler" <az*******@freenet.de> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl...
"Crirus" <Cr****@datagroup.ro> schrieb
OK, I have a class derived from UserControl called BMouse
That class modifies mousemove event...
My UserControl is derived from that class, BMouse
I try to set a picture as background of my UserControl
Of which Usercontrol? You have two. I assume it is the latter one.

Where do you set the picture? Did you open the 2nd Usercontrol in the
designer and set the picture or did you put the 2nd Usercontrol on a Form
and set the picture of the Usercontrol instance? I assume the former.
The picture can be seen in design window of the control but is not
painted on runing version...


I still can not reproduce the problem. How did you add the Usercontrol(s)?
Reason for the question: Is there a "windows forms designer generated

code" region in both controls?


Did you try the steps I described? Which result?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #10

P: n/a
"Crirus" <Cr****@datagroup.ro> schrieb

Did you try the steps I described? Which result?

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #11

P: n/a
As I told you...
--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Armin Zingler" <az*******@freenet.de> wrote in message
news:uZ**************@tk2msftngp13.phx.gbl...
"Crirus" <Cr****@datagroup.ro> schrieb

Did you try the steps I described? Which result?

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.