473,594 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

design mode for controls inherited from Windows.Forms.U serControl

I need to derive the Windows.Forms.C ontrol 2 times so I design a class like
this

Public Class BMControl
Inherits System.Windows. Forms.UserContr ol

Public Class MapControl
Inherits BMControl
Now, how can I make MapControl editable in design mode just like standard
System.Windows. Forms.UserContr ol?
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.UserContr ol
--
Ceers,
Crirus

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

------------------------------
Nov 20 '05 #1
11 5280
No ideeas?

--
Ceers,
Crirus

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

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

"Crirus" <Cr****@datagro up.ro> wrote in message
news:e0******** ******@TK2MSFTN GP12.phx.gbl...
I need to derive the Windows.Forms.C ontrol 2 times so I design a class like this

Public Class BMControl
Inherits System.Windows. Forms.UserContr ol

Public Class MapControl
Inherits BMControl
Now, how can I make MapControl editable in design mode just like standard
System.Windows. Forms.UserContr ol?
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.UserContr ol
--
Ceers,
Crirus

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

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

Nov 20 '05 #2
"Crirus" <Cr****@datagro up.ro> schrieb
I need to derive the Windows.Forms.C ontrol 2 times so I design a
class like this

Public Class BMControl
Inherits System.Windows. Forms.UserContr ol

Public Class MapControl
Inherits BMControl
Now, how can I make MapControl editable in design mode just like
standard System.Windows. Forms.UserContr ol?
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.UserContr ol


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.C ontrol
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*******@free net.de> wrote in message
news:eG******** ******@TK2MSFTN GP09.phx.gbl...
"Crirus" <Cr****@datagro up.ro> schrieb
I need to derive the Windows.Forms.C ontrol 2 times so I design a
class like this

Public Class BMControl
Inherits System.Windows. Forms.UserContr ol

Public Class MapControl
Inherits BMControl
Now, how can I make MapControl editable in design mode just like
standard System.Windows. Forms.UserContr ol?
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.UserContr ol
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****@datagro up.ro> schrieb
I inherited directly from Windows.Forms.C ontrol
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*******@free net.de> wrote in message
news:e4******** ******@tk2msftn gp13.phx.gbl...
"Crirus" <Cr****@datagro up.ro> schrieb
I inherited directly from Windows.Forms.C ontrol
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****@datagro up.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.BackgroundIm age = Image.FromFile( "d:\windows\win nt.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.EventArg s) _
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*******@free net.de> wrote in message
news:ug******** ********@TK2MSF TNGP10.phx.gbl. ..
"Crirus" <Cr****@datagro up.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.BackgroundIm age = Image.FromFile( "d:\windows\win nt.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.EventArg s) _
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****@datagro up.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*******@free net.de> wrote in message
news:OO******** ******@TK2MSFTN GP11.phx.gbl...
"Crirus" <Cr****@datagro up.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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1483
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: public class MyControl : UserControl { public MyControl() { InitializeComponent(); if (!System.ComponentModel.Design.MagicClass.IsDesignTime)
4
6064
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 of a Custom User Control, generated by adding a new Custom User Control to a project with VS.NET.
3
1913
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 other way to inherit from built-in controls?) to: Public Class Button Inherits System.Windows.Forms.Button
4
2432
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 System.Windows.Forms.Design.ControlDesigner I get an error saying that the Type is not defined. I cut and pasted all the imports and line from the MSDN. Would appreciate any help.
1
1077
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 ForeColor property that I leave exposed in my inherited class. My intent here is to allow users to set this property and then use it as the color for several controls that I dynamically place onto the base Usercontrol as needed. I am placing...
13
7876
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 control). However, the contents of the Items collection is persisted through designtime. Currently this all works except for the following. When you bring up the custom collection editor and add new items then close the collection editor.
2
5051
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 the VS2005 designer, but at runtime, the controls are in different locations and different sizes. I have been able to restore their sizes by putting a hack together that will set their sizes to the correct values in the UserControl's Resize...
11
18100
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 ListView columns so it should be doable, thanks
12
11048
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. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed! (He knows this I'm sure, but just didn't think this was my problem; LOL, I am needling him) If...
0
7877
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8240
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6661
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5411
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1482
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1216
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.