By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,795 Members | 1,660 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,795 IT Pros & Developers. It's quick & easy.

c# System.Drawing.Font, color?

P: 77
The project im working on requires the user to be able to print reports based on information the program gathers. (ie.To, From, Cost, Username etc.etc.).

Now to make this report thing more usable im going to add lots of customizable options. For instance, row color, font size, font type, font color, header color etc.

So i added the fontDialog control to my page and for time being just called ShowDialog on a button click.

Theres an option to enable the fontDialog to allow font color to be set (ShowColor) but when i go to use this as my font it ignores the color value. i cant find where to add the color.

I would of hoped doing:
Expand|Select|Wrap|Line Numbers
  1. System.Drawing.Font rowFont = fontDialog1.Font;
  2.  
would set all the font attributes... style, face, color, size... However, it doesnt. Instead it gets everything other than color. The Color value is stored in fontDialog1.Color but i cant find anywhere to set the value for Sys'.Draw'.Font.

Anyone know how i can set this?

Just to mention, whatever the solution is it needs to be compatible with printing(ie. DrawString etc...)

Thanks in advance,
Piercy
Jan 4 '08 #1
Share this Question
Share on Google+
2 Replies


Plater
Expert 5K+
P: 7,872
Color isn't associated with font, it's seperate.
If you're drawing on a graphics object, you would change the color of your pen/brush to match the colors selected.
If you're using a RichTextBox, you would set the Foreground and Background colors to their corrosponding selections from the font dialog.
Jan 4 '08 #2

P: 77
Color isn't associated with font, it's seperate.
If you're drawing on a graphics object, you would change the color of your pen/brush to match the colors selected.
If you're using a RichTextBox, you would set the Foreground and Background colors to their corrosponding selections from the font dialog.

your very right.. considering ive already written the code and put Brushes.Black etc. i should have noticed that...

Stupid mistake...



Thanks very much,
Piercy
Jan 4 '08 #3

Post your reply

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