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

"FillRectangle" draws with a different color when DoubleBuffered

4
please test this:

Expand|Select|Wrap|Line Numbers
  1.         public Form1()
  2.         {
  3.             InitializeComponent();
  4.             this.DoubleBuffered = true;
  5.         }
  6.  
  7.         protected override void OnPaint(PaintEventArgs e)
  8.         {
  9.             e.Graphics.FillRectangle(new SolidBrush(BackColor), 0, 0, 50, 50);
  10.             base.OnPaint(e);
  11.         }
  12.  
The color it draw with is not SystemColor.BackColor but a different one. I don't know if it's by design or a bug. Can I do something to FillRectangle with pure color when double-buffered?

thank you!

If the image below is absent, please see this

Attached Images
File Type: jpg fcolor.jpg (12.8 KB, 175 views)
Mar 9 '10 #1

✓ answered by tlhintoq

'Backcolor' is a property of your form. You can set the Backcolor of your form to anything you like.

Try looking at your available choices..

Start typing Color bob = Color.FromKnownColor(KnownColor.
{Intellisense will popup here giving you a list}

To the best of my knowledge there is no such color designation as System.Backcolor

2 1348
tlhintoq
3,525 Expert 2GB
'Backcolor' is a property of your form. You can set the Backcolor of your form to anything you like.

Try looking at your available choices..

Start typing Color bob = Color.FromKnownColor(KnownColor.
{Intellisense will popup here giving you a list}

To the best of my knowledge there is no such color designation as System.Backcolor
Mar 9 '10 #2
phommy
4
I'm sorry to say that's a foolish question. I found there's no business with "DoubleBuffer".
Under 16-bit color the backcolor of control is "GetNearestColor"ed when drawn by system, so the color is different with
Expand|Select|Wrap|Line Numbers
  1. e.Graphics.FillRectangle(new SolidBrush(BackColor)
thank you all the same
Mar 10 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jack Russell | last post by:
Mabry has a nice control which shows the percentage full in both colour and as a number(i.e. If I set it to 50 and red half the box will be red, the other half white and the number 50 will appear)....
1
by: Robin Tucker | last post by:
Hi ppl, My owner draw list box controls do not "refresh" old selected items when a new selection is made. This means that as you click to make selections, the previously selected items stay...
2
by: Simon Verona | last post by:
If I have a combobox set enabled=false then by default it will have dark grey text on a grey background. I want it to show as blue on white. I'm trying code such as : combobox.enabled=false...
3
by: Yehia A.Salam | last post by:
Hello, I'm trying to fill a rectangle with a tiled image, the problem is that Grpahics.FillRectangle (TextBrush,..,..,..,..) doesn't draw the tiled image from the origin, so the result was this:...
1
by: eBob.com | last post by:
I have some code which is trying to determine where text will wrap in a custom text box (which Inherits from Control). It determines the number of characters which will fit in the first line, but...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.