PC Review


Reply
Thread Tools Rate Thread

BackColor behaviour also crazy

 
 
C
Guest
Posts: n/a
 
      1st Aug 2010
Changing the background colour of a Form changed the background colour
of several controls on it, as if they were transparent. I think this
change from VB6 is quite crazy, and I wonder if there are simple ways
around this.

The only thing I can think of is to change the colour of all controls
in a For loop - not a very decent solution, but Microsoft seems to do
a lot of illogical things - user hostile.

Something like

Dim ctrl As Control
For Each ctrl In Form1.Controls
If Type ctrl Is button Then ctrl.BackColor =
Color.FromArgb(128, 255, 92)
If Type ctrl Is label Then ctrl.BackColor =
Color.FromArgb(128, 128, 128)
Next
 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      1st Aug 2010
Am 01.08.2010 21:17, schrieb C:
> Changing the background colour of a Form changed the background colour
> of several controls on it, as if they were transparent. I think this
> change from VB6 is quite crazy, and I wonder if there are simple ways
> around this.



See 2nd paragraph in the "remarks" section

http://msdn.microsoft.com/en-us/libr...backcolor.aspx

and the (therein linked) 3rd paragraph here

http://msdn.microsoft.com/en-us/libr...s.control.aspx

about "ambient properties".


> The only thing I can think of is to change the colour of all controls
> in a For loop - not a very decent solution, but Microsoft seems to do
> a lot of illogical things - user hostile.


Well, I am happy that I don't have to manually change the colors
of all controls if I change the Form color because it's done
automatically. ;-)

> Something like
>
> Dim ctrl As Control
> For Each ctrl In Form1.Controls
> If Type ctrl Is button Then ctrl.BackColor =
> Color.FromArgb(128, 255, 92)
> If Type ctrl Is label Then ctrl.BackColor =
> Color.FromArgb(128, 128, 128)
> Next


You can also select multiple controls in the designer, then set
their backcolor properties in one go.

--
Armin
 
Reply With Quote
 
C
Guest
Posts: n/a
 
      2nd Aug 2010
On 1 elo, 22:37, Armin Zingler <az.nos...@freenet.de> wrote:
> Am 01.08.2010 21:17, schrieb C:
>
> > Changing the background colour of a Form changed the background colour
> > of several controls on it, as if they were transparent. I think this
> > change from VB6 is quite crazy, and I wonder if there are simple ways
> > around this.

>
> See 2nd paragraph in the "remarks" section
>
> http://msdn.microsoft.com/en-us/libr....forms.control....
>
> and the (therein linked) 3rd paragraph here
>
> http://msdn.microsoft.com/en-us/libr....forms.control....
>
> about "ambient properties".
>


I read it. New way of thinking.

> > The only thing I can think of is to change the colour of all controls
> > in a For loop - not a very decent solution, but Microsoft seems to do
> > a lot of illogical things - user hostile.

>
> Well, I am happy that I don't have to manually change the colors
> of all controls if I change the Form color because it's done
> automatically. ;-)


You have a point. For labels and check boxes this might be a good
thing. For some other controls, may be not.

>
> > Something like

>
> > Dim ctrl As Control
> > * * * * For Each ctrl In Form1.Controls
> > * * * * * * If Type ctrl Is button Then ctrl.BackColor =
> > Color.FromArgb(128, 255, 92)
> > * * * * * * If Type ctrl Is label Then ctrl.BackColor =
> > Color.FromArgb(128, 128, 128)
> > * * * * Next

>
> You can also select multiple controls in the designer, then set
> their backcolor properties in one go.


This too is nice. I have all commands in one column, so it will be
easy to pick all of them with the arrow without getting other things
in the selection.

Thanks.

>
> --
> Armin


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Going crazy trying to understand Web Services behaviour with static member fields, static classes and singleton classes. BLUE Microsoft C# .NET 2 12th Jun 2007 07:31 PM
A2002 (sub)form behaviour driving me crazy!!! =?windows-1250?Q?Vladim=EDr_Cvajniga?= Microsoft Access Forms 8 10th Mar 2007 02:05 AM
Crazy behaviour!! Lee Microsoft C# .NET 5 20th Mar 2006 11:06 PM
Re: BackColor, all time problem with BackColor!!! Peter Foot [MVP] Microsoft Dot NET Compact Framework 0 24th Nov 2003 01:38 PM
crazy behaviour from controls Chris Szabo Microsoft ASP .NET 0 16th Oct 2003 10:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:44 AM.