Click here to Skip to main content
16,007,472 members
Home / Discussions / C#
   

C#

 
QuestionNeed help in File handling with directory Pin
Ashraj198223-May-06 18:32
Ashraj198223-May-06 18:32 
AnswerRe: Need help in File handling with directory Pin
stancrm23-May-06 20:04
stancrm23-May-06 20:04 
GeneralRe: Need help in File handling with directory Pin
J4amieC23-May-06 21:54
J4amieC23-May-06 21:54 
QuestionVB to c# help Pin
davser__23-May-06 16:52
davser__23-May-06 16:52 
AnswerRe: VB to c# help Pin
NaNg1524123-May-06 19:39
NaNg1524123-May-06 19:39 
GeneralRe: VB to c# help Pin
lmoelleb23-May-06 22:03
lmoelleb23-May-06 22:03 
QuestionJavascript Scripting Engine for application framework? [modified] Pin
copper000223-May-06 15:54
copper000223-May-06 15:54 
QuestionGetting printer data is slow Pin
ABools23-May-06 15:36
ABools23-May-06 15:36 
I am trying to calculate how many lines I can fit on a printed page using the following code. However, as you can see from the times i put against the trace statements, it is very slow indeed.

private void SetLinesPerPage()
{ this.pd = new PrintDocument();

Trace.WriteLine("SetLinesPerPage: Point 0"); // **TEST 21-May-2006 10:11:18.703
PageSettings ps = this.pd.DefaultPageSettings;

Trace.WriteLine(string.Format("{0}:{1}:{2}", ps.HardMarginX, ps.HardMarginY, ps.Bounds.Height));
// **TEST 21-May-2006 10:11:24.109
Graphics g = ps.PrinterSettings.CreateMeasurementGraphics();

Trace.WriteLine("SetLinesPerPage: Point 2"); // **TEST 21-May-2006 10:11:26.906
float pHeight = ps.PrintableArea.Height;

Trace.WriteLine("SetLinesPerPage: Point 3"); // **TEST 21-May-2006 10:11:28.578

this.pFont = new Font(pfName, pfSize);
float lHeight = this.pFont.GetHeight(g) * 1.5F;
this.pFont.Dispose();
this.linesPerPage = (int)(pHeight / lHeight) - 5;
Trace.WriteLine(string.Format("SetLinesPerPage: Set {0} lines per page", this.linesPerPage));
}

My printer is a USB connected device on another PC in my workgroup. It is online but I have not accessed it since I booted my machine. If I do access it before running this code, then it still takes the same elapsed time.

My systems are both Windows XP SP2 (fully up to date), both machines are running .NET V2 framework.

Please does anyone have any idea how I can descrese the elapsed time to perform this operation? (currently almost 10 seconds)

Thanks in advance.
QuestionSerial Port Control Pin
jackalfb23-May-06 15:07
jackalfb23-May-06 15:07 
AnswerRe: Serial Port Control Pin
Judah Gabriel Himango23-May-06 15:35
sponsorJudah Gabriel Himango23-May-06 15:35 
AnswerRe: Serial Port Control [modified] Pin
stancrm23-May-06 20:11
stancrm23-May-06 20:11 
AnswerRe: Serial Port Control ,thank you Pin
jackalfb24-May-06 10:44
jackalfb24-May-06 10:44 
Questionado Pin
maryamf23-May-06 12:59
maryamf23-May-06 12:59 
AnswerRe: ado Pin
BoneSoft23-May-06 15:14
BoneSoft23-May-06 15:14 
AnswerRe: ado Pin
MoustafaS23-May-06 15:15
MoustafaS23-May-06 15:15 
AnswerRe: ado [modified] Pin
albCode23-May-06 20:56
albCode23-May-06 20:56 
QuestionActivating child form via right mouse click Pin
marzk23-May-06 12:47
marzk23-May-06 12:47 
QuestionMulti-threading & Listening Sockets Pin
Guinness4Strength23-May-06 12:04
Guinness4Strength23-May-06 12:04 
AnswerRe: Multi-threading & Listening Sockets Pin
David Stone23-May-06 13:15
sitebuilderDavid Stone23-May-06 13:15 
Questionhow to write >, <, &to XML file Pin
donkaiser23-May-06 9:26
donkaiser23-May-06 9:26 
AnswerRe: how to write >, <, &to XML file Pin
donkaiser23-May-06 9:33
donkaiser23-May-06 9:33 
GeneralRe: how to write >, <, &to XML file Pin
Robin Panther23-May-06 10:44
Robin Panther23-May-06 10:44 
AnswerRe: how to write >, <, &to XML file Pin
donkaiser23-May-06 10:54
donkaiser23-May-06 10:54 
QuestionException of type 'System.Security.SecurityException' occured Pin
Patricker23-May-06 8:27
Patricker23-May-06 8:27 
AnswerRe: Exception of type 'System.Security.SecurityException' occured Pin
James Gupta23-May-06 9:21
professionalJames Gupta23-May-06 9: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.