Click here to Skip to main content
15,892,746 members
Home / Discussions / C#
   

C#

 
AnswerRe: Result of division not appear in the textbox Pin
Frank Kerrigan30-Nov-07 0:42
Frank Kerrigan30-Nov-07 0:42 
GeneralRe: Result of division not appear in the textbox Pin
moon_stick30-Nov-07 1:10
moon_stick30-Nov-07 1:10 
GeneralRe: Result of division not appear in the textbox Pin
Luc Pattyn30-Nov-07 1:49
sitebuilderLuc Pattyn30-Nov-07 1:49 
GeneralRe: Result of division not appear in the textbox Pin
moon_stick30-Nov-07 3:24
moon_stick30-Nov-07 3:24 
GeneralRe: Result of division not appear in the textbox Pin
PeterRoman30-Nov-07 3:08
PeterRoman30-Nov-07 3:08 
QuestionLinq on Visual 2005 Pin
Berlus29-Nov-07 23:39
Berlus29-Nov-07 23:39 
AnswerRe: Linq on Visual 2005 Pin
Colin Angus Mackay30-Nov-07 0:22
Colin Angus Mackay30-Nov-07 0:22 
AnswerRe: Linq on Visual 2005 Pin
Pete O'Hanlon30-Nov-07 0:26
mvePete O'Hanlon30-Nov-07 0:26 
AnswerRe: Linq on Visual 2005 Pin
Frank Kerrigan30-Nov-07 0:36
Frank Kerrigan30-Nov-07 0:36 
QuestionCreating Website in SharePoint using C#/ASP.NET Pin
md Nazeem29-Nov-07 23:37
md Nazeem29-Nov-07 23:37 
Questionopen an Excel file using c# Pin
ramyanaidu29-Nov-07 23:37
ramyanaidu29-Nov-07 23:37 
AnswerRe: open an Excel file using c# Pin
NewToAspDotNet30-Nov-07 0:35
NewToAspDotNet30-Nov-07 0:35 
Question"out of memory" exception and resource management Pin
metalion29-Nov-07 23:14
metalion29-Nov-07 23:14 
AnswerRe: "out of memory" exception and resource management Pin
Christian Graus29-Nov-07 23:17
protectorChristian Graus29-Nov-07 23:17 
GeneralRe: "out of memory" exception and resource management Pin
metalion29-Nov-07 23:23
metalion29-Nov-07 23:23 
AnswerRe: "out of memory" exception and resource management Pin
Luc Pattyn30-Nov-07 0:45
sitebuilderLuc Pattyn30-Nov-07 0:45 
GeneralRe: "out of memory" exception and resource management Pin
metalion30-Nov-07 1:25
metalion30-Nov-07 1:25 
QuestionIDeviceContext OR How to MeasureText out of the Paint Event Pin
C-Scharbe29-Nov-07 23:04
C-Scharbe29-Nov-07 23:04 
Hello,

I'd like to Resize a control that contains any text.
If I use TextRenderer.MeasureText there is always a Padding, also if I use the Flag NoPadding:
Size size = TextRenderer.MeasureText("dddd", this.Font, new Size(Int32.MaxValue, Int32.MaxValue), (TextFormatFlags.NoPadding));

I found out that i need to set a IDeviceContext like that:
private void MyControl_Paint(object sender, PaintEventArgs e)<br />
{<br />
      Size size = TextRenderer.MeasureText(e.Graphics, "dddd", this.Font, new Size(Int32.MaxValue, Int32.MaxValue), (TextFormatFlags.NoPadding));<br />
}


My Problem is:
I dont want to Resize the Control in the Paint-Event, so I guess I need to get somehow the current IDeviceContext, but how?
Or do I use the TextRenderer.MeasureText method in a wrong way?


Thank You for Your Answers!
AnswerRe: IDeviceContext OR How to MeasureText out of the Paint Event Pin
C-Scharbe30-Nov-07 1:04
C-Scharbe30-Nov-07 1:04 
GeneralRe: IDeviceContext OR How to MeasureText out of the Paint Event Pin
mav.northwind30-Nov-07 21:05
mav.northwind30-Nov-07 21:05 
QuestionImpersonation in C# Pin
dhanashree_129-Nov-07 23:02
dhanashree_129-Nov-07 23:02 
QuestionReplacing ReportViewer with Internet Explorer Pin
Ramith Sivanarain29-Nov-07 23:02
Ramith Sivanarain29-Nov-07 23:02 
QuestionExternal device Pin
Lol2129-Nov-07 23:01
Lol2129-Nov-07 23:01 
AnswerRe: External device Pin
MickCurley29-Nov-07 23:10
MickCurley29-Nov-07 23:10 
AnswerRe: External device Pin
ChandraRam30-Nov-07 1:59
ChandraRam30-Nov-07 1:59 

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.