From: Tony Johansson on
Hello!

Here I have a piece of code where code marked with 1 and 2 give identical
text but code marked with 3
doesn't give the same size of the text. Even if I change code marked with 3
from 12pt to 33pt the same size of text is displayed.
Have I missed something here.

private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = this.CreateGraphics();
// 1 Font f = new Font("Arial", 12, FontStyle.Bold);

// 2 FontFamily ff = new FontFamily("Arial");
// 2 Font f = new Font(ff, 12, FontStyle.Bold);

// 3 FontConverter converter = new FontConverter();
// 3 Font f = (Font)converter.ConvertFromString("Arial, 12pt,
FontStyle.Bold");

g.DrawString("Hello, World!", f, Brushes.Blue, 10, 10);
}

//Tony


From: kndg on
On 6/16/2010 4:59 PM, Tony Johansson wrote:
> [...]
> // 3 FontConverter converter = new FontConverter();
> // 3 Font f = (Font)converter.ConvertFromString("Arial, 12pt,
> FontStyle.Bold");

You are using incorrect format for the converter to parse. It should be
formatted as:

Font f = (Font)converter.ConvertFromString("Arial, 12pt, style=Bold");
From: Tony Johansson on

"kndg" <reply(a)this.newsgroup> skrev i meddelandet
news:hva5h7$92s$1(a)news.eternal-september.org...
> On 6/16/2010 4:59 PM, Tony Johansson wrote:
>> [...]
>> // 3 FontConverter converter = new FontConverter();
>> // 3 Font f = (Font)converter.ConvertFromString("Arial, 12pt,
>> FontStyle.Bold");
>
> You are using incorrect format for the converter to parse. It should be
> formatted as:
>
> Font f = (Font)converter.ConvertFromString("Arial, 12pt, style=Bold");

No you example doesn't give correct font because it's very different from
code marked with 1 and 2

//Tony


From: Jeff Johnson on
"Tony Johansson" <johansson.andersson(a)telia.com> wrote in message
news:%23Qa328WDLHA.1368(a)TK2MSFTNGP06.phx.gbl...

>>> [...]
>>> // 3 FontConverter converter = new FontConverter();
>>> // 3 Font f = (Font)converter.ConvertFromString("Arial, 12pt,
>>> FontStyle.Bold");
>>
>> You are using incorrect format for the converter to parse. It should be
>> formatted as:
>>
>> Font f = (Font)converter.ConvertFromString("Arial, 12pt, style=Bold");
>
> No you example doesn't give correct font because it's very different from
> code marked with 1 and 2

Care to define "different"?


From: Tony Johansson on
"Jeff Johnson" <i.get(a)enough.spam> skrev i meddelandet
news:hvb80v$s2u$1(a)news.eternal-september.org...
> "Tony Johansson" <johansson.andersson(a)telia.com> wrote in message
> news:%23Qa328WDLHA.1368(a)TK2MSFTNGP06.phx.gbl...
>
>>>> [...]
>>>> // 3 FontConverter converter = new FontConverter();
>>>> // 3 Font f = (Font)converter.ConvertFromString("Arial, 12pt,
>>>> FontStyle.Bold");
>>>
>>> You are using incorrect format for the converter to parse. It should be
>>> formatted as:
>>>
>>> Font f = (Font)converter.ConvertFromString("Arial, 12pt, style=Bold");
>>
>> No you example doesn't give correct font because it's very different from
>> code marked with 1 and 2
>
> Care to define "different"?

At least different size of the text.

//Tony


 |  Next  |  Last
Pages: 1 2
Prev: IComparable
Next: Simple hack to get $1000 to your home