Click here to Skip to main content
15,890,825 members
Home / Discussions / C#
   

C#

 
AnswerRe: Multiple Graphics.DrawString calls Pin
Luc Pattyn28-Nov-11 0:50
sitebuilderLuc Pattyn28-Nov-11 0:50 
GeneralRe: Multiple Graphics.DrawString calls Pin
Danzy8328-Nov-11 1:03
Danzy8328-Nov-11 1:03 
AnswerRe: Multiple Graphics.DrawString calls Pin
Wayne Gaylard28-Nov-11 0:55
professionalWayne Gaylard28-Nov-11 0:55 
GeneralRe: Multiple Graphics.DrawString calls Pin
Luc Pattyn28-Nov-11 1:04
sitebuilderLuc Pattyn28-Nov-11 1:04 
GeneralRe: Multiple Graphics.DrawString calls Pin
Wayne Gaylard28-Nov-11 1:19
professionalWayne Gaylard28-Nov-11 1:19 
GeneralRe: Multiple Graphics.DrawString calls Pin
Danzy8328-Nov-11 1:11
Danzy8328-Nov-11 1:11 
GeneralRe: Multiple Graphics.DrawString calls Pin
Wayne Gaylard28-Nov-11 1:26
professionalWayne Gaylard28-Nov-11 1:26 
AnswerRe: Multiple Graphics.DrawString calls Pin
BillWoodruff30-Nov-11 5:19
professionalBillWoodruff30-Nov-11 5:19 
A question that needs to be answered, imho, is whether you are drawing every character on the page in the same font, at the same font-size, and in the same font-style.

If you are varying font, font-size, font-style per page, I think you are going to "go nuts" using MeasureString, and there are other, better ways you could approach what you are trying to do.

You should also consider possible quality-of-rendering issues that could affect readability, if you are using DrawString to render fonts less than 12 points in size.

A suggestion: WinForms: put a RichTextBox on a Form, set 'MultiLine' to 'false (make it fairly short in width); define a ContentsResized Event handler for the ContextResized Event. Put a regular TextBox on the page into which you write out the width of the .NewRectangle property exposed by the parameter 'e in the ContextResized EventHandler.

Put a button on the Form which when clicked changes the Font of the RichTextBox. Run this project, type away, and then, at some point, click on the button that changes the RichTextBox's font. Observe what happens as your typed content exceeds the width of the RichTextBox.

Kind of like this:
C#
private void richTextBox1_ContentsResized(object sender, ContentsResizedEventArgs e)
 {
     textBox1.Text = e.NewRectangle.Width.ToString();
 }

 private void button1_Click(object sender, EventArgs e)
 {
     richTextBox1.Font = new System.Drawing.Font("Arial", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
 }
And observe what happens to the reported measurement.

Now, also, consider that at any moment you can render a bit-map from the contents of any Control.

A little more information about your scenario, please.

best, Bill
"Anyone who shows me my 'blind spots' gives me the gift of sight." ... a thought from the shallows of the deeply shallow mind of ... Bill


modified 30-Nov-11 12:35pm.

QuestionMaximum number of columns that can be added in a dataset table Pin
kgaurav.kumbhawat27-Nov-11 23:07
kgaurav.kumbhawat27-Nov-11 23:07 
AnswerRe: Maximum number of columns that can be added in a dataset table Pin
thatraja27-Nov-11 23:35
professionalthatraja27-Nov-11 23:35 
AnswerRe: Maximum number of columns that can be added in a dataset table Pin
Mycroft Holmes27-Nov-11 23:39
professionalMycroft Holmes27-Nov-11 23:39 
GeneralRe: Maximum number of columns that can be added in a dataset table Pin
thatraja28-Nov-11 0:10
professionalthatraja28-Nov-11 0:10 
AnswerRe: Maximum number of columns that can be added in a dataset table Pin
Kabwla.Phone28-Nov-11 3:04
Kabwla.Phone28-Nov-11 3:04 
QuestionHow to update the Form 's progress bar from different calss Pin
ptr_Electron27-Nov-11 21:45
ptr_Electron27-Nov-11 21:45 
AnswerRe: How to update the Form 's progress bar from different calss Pin
Wayne Gaylard27-Nov-11 22:02
professionalWayne Gaylard27-Nov-11 22:02 
GeneralRe: How to update the Form 's progress bar from different calss Pin
ptr_Electron28-Nov-11 0:54
ptr_Electron28-Nov-11 0:54 
AnswerRe: How to update the Form 's progress bar from different calss Pin
Luc Pattyn27-Nov-11 22:18
sitebuilderLuc Pattyn27-Nov-11 22:18 
GeneralRe: How to update the Form 's progress bar from different calss Pin
ptr_Electron28-Nov-11 0:53
ptr_Electron28-Nov-11 0:53 
AnswerRe: How to update the Form 's progress bar from different calss Pin
Luc Pattyn28-Nov-11 1:02
sitebuilderLuc Pattyn28-Nov-11 1:02 
QuestionMulti-lingual possessive case Pin
Tyrone Watt27-Nov-11 21:39
Tyrone Watt27-Nov-11 21:39 
AnswerRe: Multi-lingual possessive case Pin
Łukasz Nowakowski27-Nov-11 23:04
Łukasz Nowakowski27-Nov-11 23:04 
GeneralRe: Multi-lingual possessive case Pin
Tyrone Watt27-Nov-11 23:20
Tyrone Watt27-Nov-11 23:20 
GeneralRe: Multi-lingual possessive case Pin
Łukasz Nowakowski27-Nov-11 23:25
Łukasz Nowakowski27-Nov-11 23:25 
QuestionAnimation for an Agent in C# Pin
macantony27-Nov-11 7:16
macantony27-Nov-11 7:16 
AnswerRe: Animation for an Agent in C# Pin
Eddy Vluggen27-Nov-11 11:39
professionalEddy Vluggen27-Nov-11 11:39 

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.