Click here to Skip to main content
15,896,111 members
Home / Discussions / C#
   

C#

 
GeneralRe: WIN32 DrawText() .NET equivalent?? Pin
ShaneStump28-Dec-03 11:11
ShaneStump28-Dec-03 11:11 
GeneralRe: WIN32 DrawText() .NET equivalent?? Pin
Nick Parker28-Dec-03 11:34
protectorNick Parker28-Dec-03 11:34 
ShaneStump wrote:
I want it to return the # height of the string if wrapping occurs (if the string requres 5 lines, I want the returned height to be for the 5 lines). I am probably NOT using the right method.

Hmm, the MeasureString method is overloaded, and if you know the maximum width in pixels that your control will represent (I don't know if you will know this?) then you can make a call as such which will take into account wrapping.

private SizeF MyMeasureMethod(PaintEventArgs e)
{
  string s = "Nick";
  Font f = new Font("Arial", 12);
  int width = 300;
  SizeF strSize = new SizeF();
  strSize = e.Graphics.MeasureString(s, f, width);
  return strSize;
}


- Nick Parker
  My Blog

GeneralRe: WIN32 DrawText() .NET equivalent?? Pin
ShaneStump28-Dec-03 11:46
ShaneStump28-Dec-03 11:46 
GeneralTreeView Pin
Luther Baker28-Dec-03 7:48
Luther Baker28-Dec-03 7:48 
GeneralRe: TreeView Pin
Tristan Rhodes28-Dec-03 8:37
Tristan Rhodes28-Dec-03 8:37 
GeneralRe: TreeView Pin
Heath Stewart28-Dec-03 8:58
protectorHeath Stewart28-Dec-03 8:58 
GeneralYe - That one Pin
Tristan Rhodes28-Dec-03 14:22
Tristan Rhodes28-Dec-03 14:22 
GeneralThanks Pin
Luther Baker30-Dec-03 5:09
Luther Baker30-Dec-03 5:09 
GeneralRe: TreeView Pin
Luther Baker30-Dec-03 9:51
Luther Baker30-Dec-03 9:51 
GeneralRe: TreeView Pin
Heath Stewart30-Dec-03 10:59
protectorHeath Stewart30-Dec-03 10:59 
GeneralRe: TreeView Pin
Luther Baker31-Dec-03 4:47
Luther Baker31-Dec-03 4:47 
GeneralRe: TreeView Pin
Luther Baker31-Dec-03 4:56
Luther Baker31-Dec-03 4:56 
GeneralC Pre Processor executable Pin
Tristan Rhodes28-Dec-03 5:38
Tristan Rhodes28-Dec-03 5:38 
GeneralRe: C Pre Processor executable Pin
Tristan Rhodes28-Dec-03 5:44
Tristan Rhodes28-Dec-03 5:44 
GeneralRe: C Pre Processor executable Pin
Nick Parker28-Dec-03 5:56
protectorNick Parker28-Dec-03 5:56 
GeneralRe: C Pre Processor executable Pin
Tristan Rhodes28-Dec-03 6:08
Tristan Rhodes28-Dec-03 6:08 
GeneralRe: C Pre Processor executable Pin
leppie28-Dec-03 5:57
leppie28-Dec-03 5:57 
GeneralRe: C Pre Processor executable Pin
Heath Stewart28-Dec-03 6:58
protectorHeath Stewart28-Dec-03 6:58 
GeneralRe: C Pre Processor executable Pin
S. Senthil Kumar29-Dec-03 1:47
S. Senthil Kumar29-Dec-03 1:47 
Generalobjidl Type Libraries Query Pin
28-Dec-03 4:07
suss28-Dec-03 4:07 
GeneralMore information here Pin
28-Dec-03 4:15
suss28-Dec-03 4:15 
GeneralRe: More information here Pin
Heath Stewart28-Dec-03 4:26
protectorHeath Stewart28-Dec-03 4:26 
GeneralRe: More information here Pin
Nick Parker28-Dec-03 4:38
protectorNick Parker28-Dec-03 4:38 
GeneralRe: More information here Pin
Tristan Rhodes28-Dec-03 4:40
Tristan Rhodes28-Dec-03 4:40 
GeneralRe: More information here Pin
Heath Stewart28-Dec-03 4:46
protectorHeath Stewart28-Dec-03 4:46 

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.