Changing the BackColor of a Button

  • Thread starter Thread starter Mark Seabourne
  • Start date Start date
M

Mark Seabourne

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.
 
Hi Mark,
The Button.BackColor property is not supported. For more information on
supported classes, methods, properties etc, see:
http://msdn.microsoft.com/library/d..._spchk/html/conClassLibraryComparisonTool.asp

You may find this article interesting:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/ImageButton.asp

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

This posting is provided "AS IS" with no warranties, and confers no rights.
 
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>
 
Back
Top