Click here to Skip to main content
15,851,701 members
Home / Discussions / C#
   

C#

 
GeneralRe: Collection Editor Pin
leppie24-Sep-02 14:57
leppie24-Sep-02 14:57 
GeneralRe: Collection Editor Pin
Tomas Petricek25-Sep-02 3:43
Tomas Petricek25-Sep-02 3:43 
GeneralRe: Collection Editor Pin
Tomas Petricek25-Sep-02 4:46
Tomas Petricek25-Sep-02 4:46 
GeneralRe: Collection Editor Pin
leppie25-Sep-02 6:02
leppie25-Sep-02 6:02 
GeneralRe: Collection Editor Pin
Tomas Petricek25-Sep-02 7:43
Tomas Petricek25-Sep-02 7:43 
GeneralRe: Collection Editor Pin
leppie25-Sep-02 8:30
leppie25-Sep-02 8:30 
GeneralRe: Collection Editor Pin
Tomas Petricek25-Sep-02 10:25
Tomas Petricek25-Sep-02 10:25 
GeneralProblem with DrawString in OnPrintPage handler Pin
Rado24-Sep-02 12:17
Rado24-Sep-02 12:17 
Hello everybody,

I have a strange problem with DrawString in my OnPrintPage event handler Frown | :( I need to print a few lines of text (field names) that is right-aligned. I'm using StringFormat to set the text alignemt and a RectangleF instance to set the coordinates. This is the code snippet:


StringFormat formatRight=new StringFormat();<br />
formatRight.Alignment=StringAlignment.Far;<br />
....<br />
RectangleF rectRight=new RectangleF(m_nMarginLeft+80,m_nMarginFields, 50, 30);<br />
e.Graphics.DrawString("Field name 1:", m_fontField, Brushes.Black, rectRight, formatRight);<br />
e.Graphics.DrawString("Field 1 value ...", m_fontGeneric, Brushes.Black, rectRight.Right, (float)(rectRight.Top-0.5));<br />
<br />
rectRight.Offset(0,m_fontGeneric.GetHeight(e.Graphics));<br />
e.Graphics.DrawString("Looong field name 2:", m_fontField, Brushes.Black, rectRight, formatRight);<br />
e.Graphics.DrawString("Field 2 value ...", m_fontGeneric, Brushes.Black, rectRight.Right, (float)(rectRight.Top-0.5));<br />
...



(Page units are milimeters) The problem is, that the fields are actually not exactly right aligned. The longer the text is, the more it is offset to the left (i.e. when printing it makes some 2 milimeters difference for field names which are twice/half the size of each other). The same thing happens when I use one multi-line string in a rectangle of larger height. I have absolutely no clue of what can be wrong? Confused | :confused: Therefore any clues are highly appreciated Smile | :) Am I doing something stupid or what? Thanks for any help.

Have a nice day,
Rado
GeneralGetting info on drives Pin
Wjousts24-Sep-02 10:34
Wjousts24-Sep-02 10:34 
GeneralRe: Getting info on drives Pin
leppie24-Sep-02 11:15
leppie24-Sep-02 11:15 
GeneralRe: Getting info on drives Pin
Wjousts24-Sep-02 11:29
Wjousts24-Sep-02 11:29 
GeneralRe: Getting info on drives Pin
leppie24-Sep-02 11:58
leppie24-Sep-02 11:58 
GeneralRe: Getting info on drives Pin
Wjousts24-Sep-02 17:45
Wjousts24-Sep-02 17:45 
GeneralRe: Getting info on drives Pin
Paul Riley25-Sep-02 1:56
Paul Riley25-Sep-02 1:56 
GeneralRe: Getting info on drives Pin
Mazdak25-Sep-02 0:39
Mazdak25-Sep-02 0:39 
QuestionHow to port tree control from window form 2 web from in C#? Pin
zanhsieh24-Sep-02 9:53
zanhsieh24-Sep-02 9:53 
AnswerRe: How to port tree control from window form 2 web from in C#? Pin
leppie24-Sep-02 11:09
leppie24-Sep-02 11:09 
GeneralDecimal floating point to binary conversion Pin
Humayun24-Sep-02 7:48
Humayun24-Sep-02 7:48 
GeneralRe: Decimal floating point to binary conversion Pin
Nick Parker24-Sep-02 9:48
protectorNick Parker24-Sep-02 9:48 
QuestionHow to use initialization of dialog Pin
24-Sep-02 7:49
suss24-Sep-02 7:49 
AnswerRe: How to use initialization of dialog Pin
leppie24-Sep-02 8:15
leppie24-Sep-02 8:15 
GeneralRe: How to use initialization of dialog Pin
Marcin24-Sep-02 8:31
Marcin24-Sep-02 8:31 
GeneralHOWTO: Web-like table w/ links (similar to solution list in VS.NET start page) Pin
Andrew Connell24-Sep-02 7:37
Andrew Connell24-Sep-02 7:37 
GeneralRe: HOWTO: Web-like table w/ links (similar to solution list in VS.NET start page) Pin
Stephane Rodriguez.24-Sep-02 8:34
Stephane Rodriguez.24-Sep-02 8:34 
GeneralRe: HOWTO: Web-like table w/ links (similar to solution list in VS.NET start page) Pin
Andrew Connell24-Sep-02 9:00
Andrew Connell24-Sep-02 9:00 

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.