Click here to Skip to main content
16,004,901 members
Home / Discussions / C#
   

C#

 
GeneralRe: Advantages of implementing ajax on windows application Pin
Elesh25-May-08 21:27
Elesh25-May-08 21:27 
GeneralRe: ajax on windows application Pin
Elesh25-May-08 21:29
Elesh25-May-08 21:29 
AnswerRe: Advantages of implementing ajax on windows application Pin
Abhijit Jana25-May-08 20:27
professionalAbhijit Jana25-May-08 20:27 
AnswerRe: Advantages of implementing ajax on windows application Pin
Nouman Bhatti25-May-08 20:30
Nouman Bhatti25-May-08 20:30 
GeneralRe: Advantages of implementing ajax on windows application Pin
Elesh25-May-08 21:19
Elesh25-May-08 21:19 
Questionhow to remove unrecognized escape sequence Pin
kamalesh574325-May-08 19:42
kamalesh574325-May-08 19:42 
AnswerRe: how to remove unrecognized escape sequence Pin
stancrm25-May-08 20:02
stancrm25-May-08 20:02 
QuestionAAAHHH GDI+ is driving me nuts...help! Pin
Mike Marynowski25-May-08 19:34
professionalMike Marynowski25-May-08 19:34 
Hi,

I have a seemingly simple and common requirement, and I can't seem to find a solution anywhere. A number of people have posted this question in other forums, and they never get an answer.

I have a custom control, which is an editing panel for a document. It draws text using Graphics.DrawString().

Now, say the user creates a textbox, fills it with some text in my editing panel, and sizes the box so it exactly fits the text. When the document is printed/previewed (using PrintDocument), and the exact same DrawString methods are used, the text is off a little bit, causing it to wrap differently. I've confirmed that MeasureString returns a slightly different value, depending on which Graphics object is passed in (the editing control or the PrintDocument).

The only difference between the two Graphics objects is the DPI. The control has 96x96 DPI, where the PrintDocumenth has 600x600. I set all the text rendering hint and all that to be the same. For one sample string I tried, MeasureString for the control returned 169, and MeasureString for the PrintDocument returned 173. That means that if the textbox is 169 pixels wide, it shows up fine on the editor control, but it will wrap on the PrintDocument.

How can I consistently print text to both mediums, so that the editor is truly WYSIWYG?

P.S. I've tried every font measurement with the same results (i.e. px, pt, em, etc)
AnswerRe: AAAHHH GDI+ is driving me nuts...help! Pin
leppie25-May-08 22:32
leppie25-May-08 22:32 
GeneralRe: AAAHHH GDI+ is driving me nuts...help! Pin
Mike Marynowski25-May-08 22:35
professionalMike Marynowski25-May-08 22:35 
AnswerRe: AAAHHH GDI+ is driving me nuts...help! Pin
Mike Marynowski1-Jun-08 17:39
professionalMike Marynowski1-Jun-08 17:39 
AnswerAHA! A solution! Pin
Mike Marynowski4-Jun-08 8:17
professionalMike Marynowski4-Jun-08 8:17 
QuestionHow can the ListView display its last item? Pin
lemueladane25-May-08 19:27
lemueladane25-May-08 19:27 
AnswerRe: How can the ListView display its last item? Pin
lemueladane25-May-08 19:36
lemueladane25-May-08 19:36 
QuestionHow to convert Multiple Reports to PDF format at runtime without using CrystalViewer. Pin
Nitten25-May-08 17:59
Nitten25-May-08 17:59 
Question2d moveable, zoomable image, like windows photo gallery, OpenGL or any other? Pin
Xmen Real 25-May-08 17:52
professional Xmen Real 25-May-08 17:52 
Questionhow to trap name of control clicked by mouse Pin
moonmonkey825-May-08 12:03
moonmonkey825-May-08 12:03 
AnswerRe: how to trap name of control clicked by mouse Pin
Xmen Real 25-May-08 17:23
professional Xmen Real 25-May-08 17:23 
AnswerRe: how to trap name of control clicked by mouse Pin
topcatalpha25-May-08 20:54
topcatalpha25-May-08 20:54 
Questionneutral density on screen AKA changing gamma only on part of screen Pin
jackeill25-May-08 9:44
jackeill25-May-08 9:44 
Questionis there a way to browse bitween tabPages using a ListBox control? Pin
leeoze25-May-08 7:07
leeoze25-May-08 7:07 
AnswerRe: is there a way to browse bitween tabPages using a ListBox control? Pin
Brady Kelly25-May-08 7:25
Brady Kelly25-May-08 7:25 
AnswerRe: is there a way to browse bitween tabPages using a ListBox control? Pin
User 665825-May-08 7:26
User 665825-May-08 7:26 
QuestionDrow Paint Pin
mihalich125-May-08 5:05
mihalich125-May-08 5:05 
AnswerRe: Drow Paint Pin
Anthony Mushrow25-May-08 5:21
professionalAnthony Mushrow25-May-08 5:21 

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.