Click here to Skip to main content
15,886,664 members
Home / Discussions / C#
   

C#

 
GeneralRe: Collection Editor Pin
leppie24-Sep-02 13:57
leppie24-Sep-02 13:57 
GeneralRe: Collection Editor Pin
Tomas Petricek25-Sep-02 2:43
Tomas Petricek25-Sep-02 2:43 
GeneralRe: Collection Editor Pin
Tomas Petricek25-Sep-02 3:46
Tomas Petricek25-Sep-02 3:46 
GeneralRe: Collection Editor Pin
leppie25-Sep-02 5:02
leppie25-Sep-02 5:02 
GeneralRe: Collection Editor Pin
Tomas Petricek25-Sep-02 6:43
Tomas Petricek25-Sep-02 6:43 
GeneralRe: Collection Editor Pin
leppie25-Sep-02 7:30
leppie25-Sep-02 7:30 
GeneralRe: Collection Editor Pin
Tomas Petricek25-Sep-02 9:25
Tomas Petricek25-Sep-02 9:25 
GeneralProblem with DrawString in OnPrintPage handler Pin
Rado24-Sep-02 11:17
Rado24-Sep-02 11: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 9:34
Wjousts24-Sep-02 9:34 
GeneralRe: Getting info on drives Pin
leppie24-Sep-02 10:15
leppie24-Sep-02 10:15 
GeneralRe: Getting info on drives Pin
Wjousts24-Sep-02 10:29
Wjousts24-Sep-02 10:29 
GeneralRe: Getting info on drives Pin
leppie24-Sep-02 10:58
leppie24-Sep-02 10:58 
GeneralRe: Getting info on drives Pin
Wjousts24-Sep-02 16:45
Wjousts24-Sep-02 16:45 
GeneralRe: Getting info on drives Pin
Paul Riley25-Sep-02 0:56
Paul Riley25-Sep-02 0:56 
GeneralRe: Getting info on drives Pin
Mazdak24-Sep-02 23:39
Mazdak24-Sep-02 23:39 
QuestionHow to port tree control from window form 2 web from in C#? Pin
zanhsieh24-Sep-02 8:53
zanhsieh24-Sep-02 8:53 
AnswerRe: How to port tree control from window form 2 web from in C#? Pin
leppie24-Sep-02 10:09
leppie24-Sep-02 10:09 
GeneralDecimal floating point to binary conversion Pin
Humayun24-Sep-02 6:48
Humayun24-Sep-02 6:48 
GeneralRe: Decimal floating point to binary conversion Pin
Nick Parker24-Sep-02 8:48
protectorNick Parker24-Sep-02 8:48 
QuestionHow to use initialization of dialog Pin
24-Sep-02 6:49
suss24-Sep-02 6:49 
AnswerRe: How to use initialization of dialog Pin
leppie24-Sep-02 7:15
leppie24-Sep-02 7:15 
GeneralRe: How to use initialization of dialog Pin
Marcin24-Sep-02 7:31
Marcin24-Sep-02 7:31 
GeneralHOWTO: Web-like table w/ links (similar to solution list in VS.NET start page) Pin
Andrew Connell24-Sep-02 6:37
Andrew Connell24-Sep-02 6:37 
GeneralRe: HOWTO: Web-like table w/ links (similar to solution list in VS.NET start page) Pin
Stephane Rodriguez.24-Sep-02 7:34
Stephane Rodriguez.24-Sep-02 7:34 
GeneralRe: HOWTO: Web-like table w/ links (similar to solution list in VS.NET start page) Pin
Andrew Connell24-Sep-02 8:00
Andrew Connell24-Sep-02 8: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.