Click here to Skip to main content
15,891,704 members
Home / Discussions / C#
   

C#

 
QuestionQuick generics q Pin
thepersonof13-Sep-06 8:26
thepersonof13-Sep-06 8:26 
AnswerRe: Quick generics q Pin
Rob Graham13-Sep-06 8:50
Rob Graham13-Sep-06 8:50 
GeneralRe: Quick generics q Pin
thepersonof13-Sep-06 9:47
thepersonof13-Sep-06 9:47 
GeneralRe: Quick generics q Pin
Nader Elshehabi13-Sep-06 10:35
Nader Elshehabi13-Sep-06 10:35 
Questionimplementing drag drop ability with figures Pin
ssoffline13-Sep-06 8:16
ssoffline13-Sep-06 8:16 
AnswerRe: implementing drag drop ability with figures Pin
Nader Elshehabi13-Sep-06 9:27
Nader Elshehabi13-Sep-06 9:27 
Questionreport viewer Pin
TAREQ F ABUZUHRI13-Sep-06 7:54
TAREQ F ABUZUHRI13-Sep-06 7:54 
QuestionGet the width of a string in C# without Graphics Pin
Goebel13-Sep-06 7:48
Goebel13-Sep-06 7:48 
I'm developing a chart library with C# that outputs a SVG (Scalable Vector Graphic) file. SVG is pure XML output so there are no WinForms involved whatsoever.

In order to avoid overlapping text I'd like to use the MeasureString(...) and then set text properties (font size) accordingly, if overlap occurred. The Graphics object seems to be a prerequisite as it provides MeasureString(...). Is there a way of using MeasureString(...) functionality without using Graphics.

I've seen a possible solution which creates a random Graphics object out of a Bitmap which can then be "abused" to provide MeasureString(...) functionality:

<br />
Bitmap bmp = new Bitmap(1,1); <br />
Graphics g = Graphics.FromImage(bmp); <br />
g.MeasureString(...)<br />


Would you call this an elegant solution or is it just a workaround?
Once again: Is there another possibility of calculating the width of a string without Graphics?

Cheers.
AnswerRe: Get the width of a string in C# without Graphics Pin
Nader Elshehabi13-Sep-06 10:28
Nader Elshehabi13-Sep-06 10:28 
GeneralRe: Get the width of a string in C# without Graphics Pin
Goebel13-Sep-06 11:07
Goebel13-Sep-06 11:07 
GeneralRe: Get the width of a string in C# without Graphics Pin
Nader Elshehabi13-Sep-06 11:26
Nader Elshehabi13-Sep-06 11:26 
GeneralRe: Get the width of a string in C# without Graphics Pin
Goebel13-Sep-06 12:16
Goebel13-Sep-06 12:16 
GeneralRe: Get the width of a string in C# without Graphics Pin
Nader Elshehabi13-Sep-06 12:41
Nader Elshehabi13-Sep-06 12:41 
GeneralRe: Get the width of a string in C# without Graphics Pin
Goebel13-Sep-06 21:59
Goebel13-Sep-06 21:59 
QuestionHelp with AppBar using C# code Pin
Muller213-Sep-06 6:56
Muller213-Sep-06 6:56 
QuestionInstalling windows services Problem Pin
leylag13-Sep-06 6:24
leylag13-Sep-06 6:24 
QuestionR/W in Notepad Pin
CodeItWell13-Sep-06 6:24
CodeItWell13-Sep-06 6:24 
AnswerRe: R/W in Notepad Pin
Ed.Poore13-Sep-06 6:48
Ed.Poore13-Sep-06 6:48 
GeneralRe: R/W in Notepad Pin
Nadia Monalisa13-Sep-06 6:55
Nadia Monalisa13-Sep-06 6:55 
JokeRe: R/W in Notepad Pin
Not Active13-Sep-06 7:49
mentorNot Active13-Sep-06 7:49 
GeneralRe: R/W in Notepad Pin
Ed.Poore13-Sep-06 8:16
Ed.Poore13-Sep-06 8:16 
JokeRe: R/W in Notepad Pin
Guffa13-Sep-06 9:25
Guffa13-Sep-06 9:25 
AnswerRe: R/W in Notepad Pin
Nadia Monalisa13-Sep-06 6:55
Nadia Monalisa13-Sep-06 6:55 
QuestionCreate Instance of an Application Pin
EscKey200413-Sep-06 6:18
EscKey200413-Sep-06 6:18 
AnswerRe: Create Instance of an Application Pin
Ed.Poore13-Sep-06 6:49
Ed.Poore13-Sep-06 6:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.