473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

design mode for controls inherited from Windows.Forms.UserControl

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
11 5251
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
"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
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
"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
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
"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
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
"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
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris Capel | last post by:
Is there any boolean flag set during design time that a UserControl can test to see whether to run code that only works during runtime (because of complicated initialization)? Like this: ...
4
by: Paradox | last post by:
Hey, I'm trying to figure out what situations call for the use of a derived form control such as: public class myListBox : System.Windows.Forms.ListBox and what situations call for the use...
3
by: Adam Nowotny | last post by:
I've created a user control: Public Class Button Inherits System.Windows.Forms.UserControl (at this point VS added this to toolbox on my computer) and then changed MANUALLY (is there any...
4
by: Dennis | last post by:
I am trying to set the default design proerties in a control I have derived from the Panel Class. I thought I'd found how to do it from the MSDN but the following line doesn't work: Inherits...
1
by: Ray Cassick \(Home\) | last post by:
Ok, here is apparently another odd one... I am (as I said in a previous posting here) building a user control that inherits from System.Windows.Forms.UserControl. This base class contains a...
13
by: alex sparsky | last post by:
I have a custom collection in my c# winform ui control called Items. Items is a built in collection type that does not allow itself to be replace (you can't 'set' the itemscollection in the...
2
by: Steve | last post by:
This is a weird one. I have a series of "SmartParts" which are CAB (Composite Application Block) Views which are finally just UserControls (99% of the time) Anyway, I layout my UserControl in...
11
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.