Click here to Skip to main content
15,909,741 members
Home / Discussions / C#
   

C#

 
GeneralRe: Query on Scrolling Pin
Daniel Turini24-Nov-04 1:09
Daniel Turini24-Nov-04 1:09 
GeneralProgramatically place characters in an input stream Pin
SebbaP24-Nov-04 0:42
SebbaP24-Nov-04 0:42 
GeneralRe: Programatically place characters in an input stream Pin
Daniel Turini24-Nov-04 1:02
Daniel Turini24-Nov-04 1:02 
GeneralComparing Strings with Wildcards Pin
pjholliday23-Nov-04 23:48
pjholliday23-Nov-04 23:48 
GeneralRe: Comparing Strings with Wildcards Pin
Stefan Troschuetz24-Nov-04 0:23
Stefan Troschuetz24-Nov-04 0:23 
QuestionSystem-wide CBT in .NET? Pin
Hadi Fakhreddine23-Nov-04 22:58
Hadi Fakhreddine23-Nov-04 22:58 
AnswerRe: System-wide CBT in .NET? Pin
Heath Stewart24-Nov-04 6:19
protectorHeath Stewart24-Nov-04 6:19 
GeneralRe: System-wide CBT in .NET? Pin
Hadi Fakhreddine24-Nov-04 6:36
Hadi Fakhreddine24-Nov-04 6:36 
GeneralRe: System-wide CBT in .NET? Pin
Heath Stewart24-Nov-04 8:23
protectorHeath Stewart24-Nov-04 8:23 
GeneralRe: System-wide CBT in .NET? Pin
Hadi Fakhreddine24-Nov-04 20:50
Hadi Fakhreddine24-Nov-04 20:50 
QuestionHow to Update Primary keys? Pin
Old Gun23-Nov-04 21:22
Old Gun23-Nov-04 21:22 
AnswerRe: How to Update Primary keys? Pin
sreejith ss nair24-Nov-04 3:59
sreejith ss nair24-Nov-04 3:59 
AnswerRe: How to Update Primary keys? Pin
Heath Stewart24-Nov-04 6:14
protectorHeath Stewart24-Nov-04 6:14 
GeneralHave no node selected or Hide Tree view first Node Pin
tejas_kan23-Nov-04 20:45
tejas_kan23-Nov-04 20:45 
GeneralRe: Have no node selected or Hide Tree view first Node Pin
Daniel Turini24-Nov-04 1:04
Daniel Turini24-Nov-04 1:04 
GeneralRe: Have no node selected or Hide Tree view first Node Pin
Anonymous24-Nov-04 1:11
Anonymous24-Nov-04 1:11 
QuestionDoes Font.Height or Font.GetHeight() return correct font height? Pin
sachinkalse23-Nov-04 19:08
sachinkalse23-Nov-04 19:08 
AnswerRe: Does Font.Height or Font.GetHeight() return correct font height? Pin
Heath Stewart24-Nov-04 6:11
protectorHeath Stewart24-Nov-04 6:11 
Measuring a font without regard to a device context (HDC in native code; encapsulated by the Graphics class in managed code or an IntPtr if you P/Invoke native Windows APIs) can yield invalid results.

Instead, either use a Graphics object passed to you (if provided; for example, from PaintEventArgs.Graphics in your Paint event handler or your OnPaint override) and call MeasureString to measure the font height for a line of text (with plenty of hanging glyphs).

You can also P/Invoke native functions like GetDeviceCaps (which hopefully you're doing already to make sure you're calculating twips correctly and not assuming 96 DPI; if you are, search for GetDeviceCaps in this forum and you'll find a handy little class I posted for correctly converting without taking a dependency on Microsoft.VisualBasic.Compatibility.dll) and use GetFontData. You can also get an HDC (as an IntPtr from the Graphics class for a control. If you need the HWND (window handle) for a control use its Handle property.

You can also create a Graphics class for a control at anytime using Control.CreateGraphics. Just be sure in that case to call Dispose on the Graphics object when you're done, otherwise it'll handle around in memory until the GC decides to clean it up.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralQuick question on hotkeys Pin
Flack23-Nov-04 16:27
Flack23-Nov-04 16:27 
GeneralRe: Quick question on hotkeys Pin
benjymous23-Nov-04 22:32
benjymous23-Nov-04 22:32 
GeneralNeed help accessing an Excel range of cells Pin
Flack23-Nov-04 16:25
Flack23-Nov-04 16:25 
GeneralRe: Need help accessing an Excel range of cells Pin
Heath Stewart24-Nov-04 6:04
protectorHeath Stewart24-Nov-04 6:04 
GeneralVB to C# Pin
npqk23-Nov-04 16:17
npqk23-Nov-04 16:17 
GeneralRe: VB to C# Pin
Nick Parker23-Nov-04 16:34
protectorNick Parker23-Nov-04 16:34 
GeneralRe: VB to C# Pin
Dave Wengier23-Nov-04 17:09
Dave Wengier23-Nov-04 17:09 

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.