473,383 Members | 1,853 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.

c# System.Drawing.Font, color?

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
2 7679
Plater
7,872 Expert 4TB
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
piercy
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

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

Similar topics

3
by: Barry Anderberg | last post by:
I'm using the .NET Memory Profiler by Sci Tech and I wrote a little test application to verify something odd I observed and it appears that System.Drawing.Font fails to dispose of its FontFamily. ...
1
by: | last post by:
Hello, I am learning how to use the XmlSerializer. I have a class that has a member of type System.Drawing.Font such as: public class MyClass { Font font;
1
by: Paul Hoad | last post by:
I'm trying to use MeasureString() to determine the length in pixels of a string However to do I need a System.Drawing.Graphics object to do this I need to create a System.Drawing.Graphics...
2
by: Kyjan | last post by:
Greetings to all! I was wondering if anyone had ever seen this error before: Exception message: Invalid parameter used. (source='System.Drawing', method='GetHeight') Portion of the stack...
4
by: Liverpool fan | last post by:
I have a windows application written using VB .NET that encompasses a countdown timer modal dialog. The timer is a System.Timers.Timer with an interval of 1 second. AutoReset is not set so accepts...
1
by: Martijn Mulder | last post by:
At startup my application loads an image from a file from disk. If the file is not there, I still need a valid System.Drawing.Image object but I don't know how to get one. //class MyImage...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
2
by: =?Utf-8?B?TmF0aGFuIFdpZWdtYW4=?= | last post by:
Hi, I am wondering why the .NET Framework is quite different from Win32 API when it comes to displaying system modal message boxes. Consider the four following types of system modal message...
2
by: ThatsIT.net.au | last post by:
I have this code that writes a pie chart in a asp.net page, but I want to use it in a server control. When I try I get a error on the last line "Response.OutputStream" Obviously there is no...
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
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.