Click here to Skip to main content
15,894,539 members
Home / Discussions / C#
   

C#

 
GeneralSetting application icon doesnt work Pin
Anonymous1-Jul-04 8:12
Anonymous1-Jul-04 8:12 
GeneralRe: Setting application icon doesnt work Pin
Karl 20001-Jul-04 10:20
Karl 20001-Jul-04 10:20 
GeneralRe: Setting application icon doesnt work Pin
leppie1-Jul-04 12:22
leppie1-Jul-04 12:22 
GeneralRe: Setting application icon doesnt work Pin
Anonymous2-Jul-04 1:16
Anonymous2-Jul-04 1:16 
General.Net Remoting return Object help Pin
bmasephol1-Jul-04 7:19
bmasephol1-Jul-04 7:19 
GeneralRe: .Net Remoting return Object help Pin
Judah Gabriel Himango1-Jul-04 7:57
sponsorJudah Gabriel Himango1-Jul-04 7:57 
GeneralRe: .Net Remoting return Object help Pin
Judah Gabriel Himango1-Jul-04 8:04
sponsorJudah Gabriel Himango1-Jul-04 8:04 
GeneralRe: .Net Remoting return Object help Pin
bmasephol1-Jul-04 8:46
bmasephol1-Jul-04 8:46 
GeneralRe: .Net Remoting return Object help Pin
WKIII1-Jul-04 8:08
WKIII1-Jul-04 8:08 
GeneralRe: .Net Remoting return Object help Pin
Tom Larsen1-Jul-04 19:19
Tom Larsen1-Jul-04 19:19 
GeneralRe: .Net Remoting return Object help Pin
bmasephol2-Jul-04 3:06
bmasephol2-Jul-04 3:06 
GeneralWhy Add and Remove button of propertyGrid disabled Pin
god4k1-Jul-04 6:48
god4k1-Jul-04 6:48 
GeneralRe: Why Add and Remove button of propertyGrid disabled Pin
Heath Stewart2-Jul-04 2:29
protectorHeath Stewart2-Jul-04 2:29 
General_42TabbedControl Validation Pin
RobertVG1-Jul-04 5:18
RobertVG1-Jul-04 5:18 
GeneralTabbedControl Validation Pin
RobertVG1-Jul-04 11:32
RobertVG1-Jul-04 11:32 
GeneralWindows Forms and Role Based Security Pin
OMalleyW1-Jul-04 5:14
OMalleyW1-Jul-04 5:14 
GeneralWord 2003 Pin
Giles1-Jul-04 4:34
Giles1-Jul-04 4:34 
QuestionHow to find out printable area? Pin
Pain_Elemental1-Jul-04 4:19
Pain_Elemental1-Jul-04 4:19 
I'm trying to find out the printable area of my printer.

The first try was this:
void OnPrintPageBoard(object obj, PrintPageEventArgs ppea)
{
    Graphics   grfx  = ppea.Graphics;
    grfx.PageUnit = GraphicsUnit.Millimeter;

    RectangleF rectf = new RectangleF(
        ppea.MarginBounds.Left -
        (ppea.PageBounds.Width - grfx.VisibleClipBounds.Width) / 2,
        ppea.MarginBounds.Top -
        (ppea.PageBounds.Height - grfx.VisibleClipBounds.Height) / 2,
        ppea.MarginBounds.Width,
        ppea.MarginBounds.Height);

    Pen myPen = new Pen(Color.Black,1);
    grfx.DrawRectangle(myPen,rectf.X, rectf.Y,rectf.Width,rectf.Height);
}


But this didn't work at all.
Second try was this:
void OnPrintPageBoard(object obj, PrintPageEventArgs ppea)
{
    Graphics   grfx  = ppea.Graphics;

    RectangleF rectf = new RectangleF(
        ppea.MarginBounds.Left -
        (ppea.PageBounds.Width - grfx.VisibleClipBounds.Width) / 2,
        ppea.MarginBounds.Top -
        (ppea.PageBounds.Height - grfx.VisibleClipBounds.Height) / 2,
        ppea.MarginBounds.Width,
        ppea.MarginBounds.Height);

    //get printable area in millimeters
    double dPrintableAreaX  = PrinterUnitConvert.Convert(rectf.X, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter)/10;
    double dPrintableAreaY  = PrinterUnitConvert.Convert(rectf.Y, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter)/10;
    double dPrintableAreaWidth  = PrinterUnitConvert.Convert(rectf.Width, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter)/10;
    double dPrintableAreaHeight  = PrinterUnitConvert.Convert(rectf.Height, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter)/10;

    //switch output to millimeters
    grfx.PageUnit = GraphicsUnit.Millimeter;

    Pen myPen = new Pen(Color.Black,1);
    grfx.DrawRectangle(myPen, (float)dPrintableAreaX, (float)dPrintableAreaY, (float)dPrintableAreaWidth, (float)dPrintableAreaHeight);
}


This worked, but the rectangle is way smaller than I expected! If I draw for example like grfx.DrawRectangle(myPen, 0, 0, 100, 100), the rectangle is more at the border of the page.


I also don't understand, why the values of the rectf of my first example don't have the same value as dPrintableAreaX,dPrintableAreaY,dPrintableAreaWidth,dPrintableAreaHeight of my second example. Should be millimeters either way, shouldn't it?

Best Regards
Bernd R.

The light at the end of the tunnel has been switched off temporarily due to budget problems...
AnswerRe: How to find out printable area? Pin
Pain_Elemental1-Jul-04 4:37
Pain_Elemental1-Jul-04 4:37 
AnswerRe: How to find out printable area? Pin
misterbear1-Jul-04 23:05
misterbear1-Jul-04 23:05 
GeneralDTS package Pin
Member 11509011-Jul-04 2:47
Member 11509011-Jul-04 2:47 
GeneralRe: DTS package Pin
Nick Parker1-Jul-04 4:07
protectorNick Parker1-Jul-04 4:07 
GeneralPocket PC\Telnet Pin
Schkin30-Jun-04 23:43
Schkin30-Jun-04 23:43 
GeneralRe: Pocket PC\Telnet Pin
Mike Dimmick1-Jul-04 0:04
Mike Dimmick1-Jul-04 0:04 
GeneralThe FlexGrid component Pin
saud_a_k30-Jun-04 23:34
saud_a_k30-Jun-04 23:34 

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.