PC Review


Reply
Thread Tools Rate Thread

Changing the BackColor of a Button

 
 
Mark Seabourne
Guest
Posts: n/a
 
      13th Nov 2003
Hello,
Does anybody know how I can change the background color of a button from
grey to white?
The property is not in the designer but I can access it from code using the
code below but this does not make a difference when I run the program.

this.btnClose.BackColor = System.Drawing.Color.White;
this.btnClose.Font = new System.Drawing.Font("Tahoma", 9F,
System.Drawing.FontStyle.Regular);
this.btnClose.Location = new System.Drawing.Point(168, 240);
this.btnClose.Size = new System.Drawing.Size(64, 24);
this.btnClose.Text = "Close";


Thanks,
Mark.


 
Reply With Quote
 
 
 
 
Jonathan Wells [msft]
Guest
Posts: n/a
 
      13th Nov 2003
Hi Mark,
The Button.BackColor property is not supported. For more information on
supported classes, methods, properties etc, see:
http://msdn.microsoft.com/library/de...arisonTool.asp

You may find this article interesting:
http://msdn.microsoft.com/library/de...mageButton.asp

cheers jonathan
--
Jonathan Wells
Product Manager
..NET Compact Framework
Check out the .NET Compact Framework FAQ at:
http://msdn.microsoft.com/mobility/p...Q/default.aspx

This posting is provided "AS IS" with no warranties, and confers no rights.

"Mark Seabourne" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
> Does anybody know how I can change the background color of a button from
> grey to white?
> The property is not in the designer but I can access it from code using

the
> code below but this does not make a difference when I run the program.
>
> this.btnClose.BackColor = System.Drawing.Color.White;
> this.btnClose.Font = new System.Drawing.Font("Tahoma", 9F,
> System.Drawing.FontStyle.Regular);
> this.btnClose.Location = new System.Drawing.Point(168, 240);
> this.btnClose.Size = new System.Drawing.Size(64, 24);
> this.btnClose.Text = "Close";
>
>
> Thanks,
> Mark.
>
>



 
Reply With Quote
 
Maarten Struys, eMVP
Guest
Posts: n/a
 
      13th Nov 2003
Changing the background color of a button will be supported as soon as SP2
will be released, see this post from yesterday by Jonathan:

<snippet from ".NET Compact Framework 1.0 SP2 Performance and Defect Fix
Details: Prviously: CF SP2>

Here are some details on what is in the current beta of SP2:

..NET Compact Framework 1.0 Service Pack 2 details:

Performance & Other Improvements List:
- Improved performance of many data tasks, including populating DataSets,
searching DataTables, DataSet.ReadXml() method when a schema is used,
finding and indexing operations, setting DataSet.EnableConstraints property,
SqlDataReader
- Improved resource loading performance
- GUI performance improvements
- Extend keyboard events to be enabled on all controls (Control.KeyUp,
KeyDown, KeyPress)
- Added support for ForeColor &amp;/or BackColor for Button, Checkbox,
ComboBox, DomainUpDown, Label, Listbox, ListView, NumericUpDown,
RadioButton, Trackbar, TreeView

<and the list goes on for a while>


--
Regards,

Maarten Struys, eMVP
PTS Software bv

"Mark Seabourne" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
> Does anybody know how I can change the background color of a button from
> grey to white?
> The property is not in the designer but I can access it from code using

the
> code below but this does not make a difference when I run the program.
>
> this.btnClose.BackColor = System.Drawing.Color.White;
> this.btnClose.Font = new System.Drawing.Font("Tahoma", 9F,
> System.Drawing.FontStyle.Regular);
> this.btnClose.Location = new System.Drawing.Point(168, 240);
> this.btnClose.Size = new System.Drawing.Size(64, 24);
> this.btnClose.Text = "Close";
>
>
> Thanks,
> Mark.
>
>



 
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
Changing BackColor Sash Microsoft Access VBA Modules 1 10th Sep 2008 03:26 AM
Changing backcolor =?Utf-8?B?U2VjcmV0IFNxdWlycmVs?= Microsoft Access 15 6th Aug 2006 05:03 AM
Backcolor of a button Joe Williams Microsoft Access Form Coding 2 1st Dec 2004 12:43 PM
Changing BackColor of XP button? Lars Netzel Microsoft VB .NET 2 2nd Aug 2004 01:13 PM
Changing button.backcolor from listbox_doubleclick event Firewalker Microsoft VB .NET 1 9th Sep 2003 11:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:08 PM.