473,379 Members | 1,252 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,379 software developers and data experts.

ParentColor

Is there a VB equivalent to Delphi's ParentColor property?
Nov 21 '05 #1
3 1144
"Alex" <pl*****@no.mail> schrieb:
Is there a VB equivalent to Delphi's ParentColor property?

Never assign a color to the control's 'BackColor' property, then the
control's background color will stay the same as the containing container's
background color.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OT*************@TK2MSFTNGP12.phx.gbl...
Is there a VB equivalent to Delphi's ParentColor property?

Never assign a color to the control's 'BackColor' property, then the
control's background color will stay the same as the containing container's
background color.


Thanks, but I would like to achieve just the opposite. For example:

'***
Public Class Form1

Private Sub Form1_DoubleClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.DoubleClick
Me.BackColor = Color.Yellow ' The form's color changes to Yellow
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
DirectCast(sender, Button).Parent.BackColor = Color.AliceBlue ' The forms
'color changes to AliceBlue
End Sub

End Class
'****

Given the code above , how do I get the button's color to remain its default
gray regardless of the color changes in the form that contains it?



Nov 21 '05 #3
"Alex" <pl*****@no.mail> schrieb:
> Is there a VB equivalent to Delphi's ParentColor property?


Never assign a color to the control's 'BackColor' property, then the
control's background color will stay the same as the containing
container's
background color.


Thanks, but I would like to achieve just the opposite. For example:

'***
Public Class Form1

Private Sub Form1_DoubleClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.DoubleClick
Me.BackColor = Color.Yellow ' The form's color changes to Yellow
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
DirectCast(sender, Button).Parent.BackColor = Color.AliceBlue ' The
forms
'color changes to AliceBlue
End Sub

End Class
'****

Given the code above , how do I get the button's color to remain its
default
gray regardless of the color changes in the form that contains it?


Explicitly assign 'SystemColors.Control' to the label's 'BackColor'
property, for example, in the form's constructor after the call to
'InitializeComponent' or the form's 'Load' event handler.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

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

Similar topics

2
by: Carl Johansson | last post by:
In the Delphi VCL, most controls have Boolean "parent" properties, for example ParentFont, ParentColor, ParentShowHint, and so on. This is a very convenient way to determine whether the control...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.