473,406 Members | 2,867 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.

How do I prevent appearance inheritance?

This is THE most annoying feature of VB.Net I've ever seen. *I'LL*
decide what my controls will do and look like, thanks.

I have an overridden panel control with a gradient background and 3D
raised border. Any control I drag into this panel inherits the 3D
border. (like transparent labels)

How do I shut this feature off entirely? It's wasting an incredible
amount of time.

Thanks!

Nov 20 '05 #1
4 1506
* Fred Flintstone <id**********@nospam.com> scripsit:
This is THE most annoying feature of VB.Net I've ever seen. *I'LL*
decide what my controls will do and look like, thanks.

I have an overridden panel control with a gradient background and 3D
raised border. Any control I drag into this panel inherits the 3D
border. (like transparent labels)

How do I shut this feature off entirely? It's wasting an incredible
amount of time.


Inside the control, you can use 'Me.DesignMode' to check if the control
runs in design mode.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
On Tue, 22 Jun 2004 12:50:36 -0400, Fred Flintstone wrote:
I have an overridden panel control with a gradient background and 3D


I don't have an answer for you, just a related question. When you inherit
from the Panel control, where do you handle the painting to override the
panel? In OnPaint? or in the Paint event? And do you call the
MyBase.OnPaint, or MyBase.Paint? Just trying to understand it

Thanks,

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 20 '05 #3
How does that disable visual inheritance?
On 22 Jun 2004 20:13:54 +0200, hi***************@gmx.at (Herfried K.
Wagner [MVP]) wrote:
* Fred Flintstone <id**********@nospam.com> scripsit:
This is THE most annoying feature of VB.Net I've ever seen. *I'LL*
decide what my controls will do and look like, thanks.

I have an overridden panel control with a gradient background and 3D
raised border. Any control I drag into this panel inherits the 3D
border. (like transparent labels)

How do I shut this feature off entirely? It's wasting an incredible
amount of time.


Inside the control, you can use 'Me.DesignMode' to check if the control
runs in design mode.


Nov 20 '05 #4
In the Paint Event:

Private Sub uc3DPanel_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim rec As Rectangle = New Rectangle(3, 3, Me.Width - 6,
Me.Height - 6)
Dim myBrush As Brush = New Drawing2D.LinearGradientBrush(rec,
GradientColor1, GradientColor2, GradientT)
Select Case miDrawstyle
Case 1
ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle,
Border3DStyle.Bump)
Case 2
ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle,
Border3DStyle.Etched)
Case 3
ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle,
Border3DStyle.Flat)
Case 4
ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle,
Border3DStyle.Raised)
Case 5
ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle,
Border3DStyle.RaisedInner)
Case 6
ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle,
Border3DStyle.RaisedOuter)
Case 7
ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle,
Border3DStyle.Sunken)
Case 8
ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle,
Border3DStyle.SunkenInner)
Case 9
ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle,
Border3DStyle.SunkenOuter)
End Select
If UseGradients = True Then
e.Graphics.FillRectangle(myBrush, rec)
End If
myBrush = Nothing
End Sub

I solved the inheritance problem (kind of) by drawing the gradient
last. If I draw the gradient first and then apply the border, every
control placed in the panel has that border. I also had to reduce the
area drawn by the gradient because it would erase the border.
However, it's a nifty accidental feature cause at 3 pixels or more, it
retains the border and allows the true BackColor to come through as a
seondary inside border.

The only real problem left is that in design view, if you change a
color, the change doesn't appear. I have to switch to code view then
back to design to see the change. Don't know why or where to begin
with that one.

I'll post the entire source if I can get this figured out. I'd still
like to know how to disable visual inheritance tho.

Fred.
On Tue, 22 Jun 2004 15:45:41 -0500, Chris Dunaway
<"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> wrote:
On Tue, 22 Jun 2004 12:50:36 -0400, Fred Flintstone wrote:
I have an overridden panel control with a gradient background and 3D


I don't have an answer for you, just a related question. When you inherit
from the Panel control, where do you handle the painting to override the
panel? In OnPaint? or in the Paint event? And do you call the
MyBase.OnPaint, or MyBase.Paint? Just trying to understand it

Thanks,


Nov 20 '05 #5

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

Similar topics

8
by: Bryan Parkoff | last post by:
I find an interesting issue that one base class has only one copy for each derived class. It looks like that one base class will be copied into three base classes while derived class from base...
20
by: modemer | last post by:
Question is as in subject. For example: class BaseClass { public: void func() { do something; } // I don't want this function being overloaded in its inherited class };
6
by: Squeamz | last post by:
Hello, Say I create a class ("Child") that inherits from another class ("Parent"). Parent's destructor is not virtual. Is there a way I can prevent Parent's destructor from being called when a...
3
by: Nicolas | last post by:
I want to display in my application a PropertyGrid showing only the "Appearance" of a control (ie. textBox) so the user can change it. Bare with me, I'm new in csharp. Where do I go from:...
3
by: Tony Maresca | last post by:
Hi. I have a class derived from a UserControl, that I want to allow others to derive controls from. I don't want them to design the base class (which is derived from a UserControl). I know that...
5
by: Charles Law | last post by:
Sorry for reposting this question, but I did not get a single answer last time, and I'm sure you guys must have some thoughts on the matter. I have a user control which can be dragged and dropped...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
6
by: namewitheldbyrequest | last post by:
Is there a way to disable a web form control (change the Enabled property to false) without the control being dimmed out when it's rendered? I have quite a few of them on the form and they are hard...
2
by: Devendra Singh | last post by:
Hi Everybody, How can I prevent my class from inheritance in C++?. There are three ways which I found in some sites-> 1. Using Named constructor 2. Using friend function 3. Commant appraoch....
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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,...
0
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...

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.