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

C#

 
GeneralPrinting Pin
exhaulted5-Jul-04 0:06
exhaulted5-Jul-04 0:06 
GeneralRe: Printing Pin
exhaulted5-Jul-04 0:21
exhaulted5-Jul-04 0:21 
GeneralConverting Pixels to 100/Inch Pin
exhaulted5-Jul-04 0:59
exhaulted5-Jul-04 0:59 
GeneralRe: Converting Pixels to 100/Inch Pin
Pain_Elemental5-Jul-04 2:19
Pain_Elemental5-Jul-04 2:19 
GeneralRe: Converting Pixels to 100/Inch Pin
Pain_Elemental5-Jul-04 3:53
Pain_Elemental5-Jul-04 3:53 
GeneralRe: Converting Pixels to 100/Inch Pin
exhaulted5-Jul-04 4:21
exhaulted5-Jul-04 4:21 
GeneralRe: Converting Pixels to 100/Inch Pin
Heath Stewart5-Jul-04 5:38
protectorHeath Stewart5-Jul-04 5:38 
GeneralRe: Converting Pixels to 100/Inch Pin
exhaulted5-Jul-04 6:06
exhaulted5-Jul-04 6:06 
I think it might be worth me re-stating my problem as i'm sure there will be a simpler way of solving it.

I have a string that i am trying to print on a printer, the problem is that the string needs to be aligned to the right hand margin of the page.
I can get the margin bounds, e.MarginBounds.Right, this value is in 100ths/inch i think.
I can also get the length of the string, stored in a SizeF variable
SizeF stringWidth = e.Graphics.MeasureString(myString, myFont); but the values are in pixels as opposed to physical units.

I was hoping to use the following code to print the string in the right place.
e.Graphics.DrawString(myString, MyFont, MyBrush, e.MarginBounds.right - stringWidth.x, Y);
However, this gives the wrong results as one unit is in pixels and the other is in 100ths/inch.
Is there a Method that i can use to convert the stringWidth into 100ths/Inch as this would solve the problem straight away. Or can i get the width of the string in 100ths/Inch straight away, using a different method to the one above.

Cheers

Kev Pearman MCP
GeneralRe: Converting Pixels to 100/Inch Pin
Heath Stewart5-Jul-04 6:27
protectorHeath Stewart5-Jul-04 6:27 
GeneralRe: Converting Pixels to 100/Inch Pin
exhaulted5-Jul-04 23:50
exhaulted5-Jul-04 23:50 
GeneralRe: Converting Pixels to 100/Inch Pin
Heath Stewart6-Jul-04 4:21
protectorHeath Stewart6-Jul-04 4:21 
GeneralRay Picking Pin
ghho5-Jul-04 0:04
ghho5-Jul-04 0:04 
Generalenum and inheritance Pin
Anonymous4-Jul-04 23:39
Anonymous4-Jul-04 23:39 
GeneralRe: enum and inheritance Pin
hatim_ali5-Jul-04 2:12
hatim_ali5-Jul-04 2:12 
GeneralRe: enum and inheritance Pin
Anonymous5-Jul-04 3:50
Anonymous5-Jul-04 3:50 
GeneralRe: enum and inheritance Pin
Heath Stewart5-Jul-04 5:40
protectorHeath Stewart5-Jul-04 5:40 
GeneralRe: enum and inheritance Pin
leppie5-Jul-04 7:16
leppie5-Jul-04 7:16 
GeneralRe: enum and inheritance Pin
Anonymous5-Jul-04 22:58
Anonymous5-Jul-04 22:58 
GeneralGet Url from IE Pin
olreit4-Jul-04 22:57
olreit4-Jul-04 22:57 
GeneralRe: Get Url from IE Pin
eggie56-Jul-04 13:24
eggie56-Jul-04 13:24 
GeneralCasting String to Long Pin
hatim_ali4-Jul-04 22:52
hatim_ali4-Jul-04 22:52 
GeneralRe: Casting String to Long Pin
Stefan Troschuetz4-Jul-04 23:05
Stefan Troschuetz4-Jul-04 23:05 
GeneralRe: Casting String to Long Pin
hatim_ali4-Jul-04 23:24
hatim_ali4-Jul-04 23:24 
GeneralTime Validation Pin
dabuskol4-Jul-04 22:36
dabuskol4-Jul-04 22:36 
GeneralRe: Time Validation Pin
Colin Angus Mackay5-Jul-04 1:22
Colin Angus Mackay5-Jul-04 1:22 

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.