Click here to Skip to main content
15,902,189 members
Home / Discussions / C#
   

C#

 
QuestionNeed assistance with automatic install application Pin
Robert Madsen21-Apr-09 17:13
professionalRobert Madsen21-Apr-09 17:13 
AnswerRe: Need assistance with automatic install application Pin
Perry Holman21-Apr-09 19:38
Perry Holman21-Apr-09 19:38 
GeneralRe: Need assistance with automatic install application Pin
Robert Madsen24-Apr-09 16:34
professionalRobert Madsen24-Apr-09 16:34 
AnswerRe: Need assistance with automatic install application Pin
Giorgi Dalakishvili21-Apr-09 19:40
mentorGiorgi Dalakishvili21-Apr-09 19:40 
GeneralRe: Need assistance with automatic install application Pin
Robert Madsen24-Apr-09 16:30
professionalRobert Madsen24-Apr-09 16:30 
QuestionHow to click on a website when it's minimized Pin
jeanbern21-Apr-09 17:08
jeanbern21-Apr-09 17:08 
QuestionRotate printing Pin
damichab21-Apr-09 16:31
damichab21-Apr-09 16:31 
AnswerRe: Rotate printing Pin
Luc Pattyn21-Apr-09 16:54
sitebuilderLuc Pattyn21-Apr-09 16:54 
GeneralRe: Rotate printing Pin
damichab21-Apr-09 17:12
damichab21-Apr-09 17:12 
GeneralRe: Rotate printing Pin
Luc Pattyn21-Apr-09 17:42
sitebuilderLuc Pattyn21-Apr-09 17:42 
GeneralRe: Rotate printing Pin
damichab21-Apr-09 17:50
damichab21-Apr-09 17:50 
GeneralRe: Rotate printing Pin
Luc Pattyn21-Apr-09 18:02
sitebuilderLuc Pattyn21-Apr-09 18:02 
GeneralRe: Rotate printing Pin
damichab21-Apr-09 19:15
damichab21-Apr-09 19:15 
Hi Luc,

I am appreciating your help here. I feel that I am getting closer but am missing (mis-understanding) something truly fundamental.

Below is the code I am actually using...

protected void OnPrintPage(object sender, PrintPageEventArgs e)
{
    int res = 3;
    float mmToInches = 1.0f / 25.4f;
    int width = (int)(LabelSettings.Width * mmToInches);
    int height = (int)(LabelSettings.Height * mmToInches); 
    
    Bitmap bitmap = new Bitmap(1,1);
    Artist = Graphics.FromImage(bitmap);
    int bitMapDpiX = (int) Artist.DpiX; // 96
    int bitMapDpiY = (int) Artist.DpiY; // 96
    Artist.Dispose();

    bitmap = new Bitmap(width * (int) e.Graphics.DpiX, height * (int) e.Graphics.DpiY);
    //bitmap.SetResolution((int)e.Graphics.DpiX, (int)e.Graphics.DpiY);

    Artist = Graphics.FromImage(bitmap);
    DrawLabel(); // Graphics.DrawXYZ()...
    Artist.Dispose();

    e.Graphics.DrawImage(bitmap, 0, 0);
    e.HasMorePages = false;
}


The LabelSettings.Width * LabelSettings.Height are set to small numbers in millimeters such as 60 and 120 of the previous example.

I am also now sending to the office printer which has a dpi of 600.

My logic is that setting the bitmap to match the area used by the printer and then setting the 'SetResolution' to match the printer dpi then everything should square up.

Leaving the bitmap.SetResolution() line rem'ed out the size is correct but fuzzy. Leaving it in and the output image is about the quarter the size it should be. Should I be setting the PageUnits and if so to what?

I know that you have tried to explain it to me twice now and I am just not getting it. If I can play on your indulgence, would you mind explaining it again using the code above as reference.

- David.
GeneralRe: Rotate printing Pin
damichab21-Apr-09 19:18
damichab21-Apr-09 19:18 
GeneralRe: Rotate printing Pin
Luc Pattyn22-Apr-09 0:31
sitebuilderLuc Pattyn22-Apr-09 0:31 
GeneralRe: Rotate printing Pin
damichab22-Apr-09 1:23
damichab22-Apr-09 1:23 
GeneralRe: Rotate printing Pin
Luc Pattyn22-Apr-09 2:08
sitebuilderLuc Pattyn22-Apr-09 2:08 
GeneralRe: Rotate printing Pin
damichab22-Apr-09 4:18
damichab22-Apr-09 4:18 
GeneralRe: Rotate printing Pin
Luc Pattyn22-Apr-09 5:36
sitebuilderLuc Pattyn22-Apr-09 5:36 
GeneralRe: Rotate printing Pin
damichab22-Apr-09 21:01
damichab22-Apr-09 21:01 
GeneralRe: Rotate printing Pin
Luc Pattyn23-Apr-09 1:19
sitebuilderLuc Pattyn23-Apr-09 1:19 
GeneralRe: Rotate printing Pin
damichab23-Apr-09 2:06
damichab23-Apr-09 2:06 
GeneralRe: Rotate printing Pin
Luc Pattyn23-Apr-09 2:44
sitebuilderLuc Pattyn23-Apr-09 2:44 
GeneralRe: Rotate printing Pin
damichab23-Apr-09 3:31
damichab23-Apr-09 3:31 
GeneralRe: Rotate printing Pin
Luc Pattyn23-Apr-09 3:36
sitebuilderLuc Pattyn23-Apr-09 3:36 

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.