XBox * box2 = new XBox( graphMemory, &p1, &p2, TRUE);
p1.Set(320, 80);
p2.Set(380, 20);
XBox * box3 = new XBox( graphMemory, &p1, &p2, TRUE);
box3->SetColor( &colWhite);
XLine * line2 = new XLine( graphMemory, &p1, &p2);
XColor colBlack(COL_BLACK);
line2->SetColor( &colBlack);
line2->SetLineWidth( 2 );
p1.SetY(20);
p2.SetY(80);
XLine * line3 = new XLine( graphMemory, &p1, &p2);
line3->SetColor( &colBlack);
line3->SetLineWidth( 2 );
XFont * font = new XFont( graphMemory, "Brush Script Normal Italic", 12 );
if(font->GetPixelSize() < 4)
{
//the font seems not to be installed, choose a default font
delete font;
font = new XFont( graphMemory, "Helvetica", 10 );
}
XRect rect2( 200, 250, 400, 450);
XText * text = new XText( graphMemory, font, &rect2, "Text with the font \"Brush Script\". If you have not installed the font, youl∩ll see this with a default font.", DT_WORDBREAK);
//the font seems not to be installed, choose a default font
delete font2;
font2 = new XFont( graphMemory, "Helvetica", 12 );
}
XText * text2 = new XText( graphMemory, font2, &rect3, "Text with the font \"Cooper Heavy\". If you have not installed the font, youl∩ll see this with a default font.", DT_WORDBREAK);
text2->SetShear( 2, 3);
//create a bitmap
XPoint rp(50, 300);
XBitmap * bmp = new XBitmap( graphMemory, &rp);
//load the bitmap from a file
bmp->Load( "sample.bmp" );
//draw the object only one time
graphMemory->Draw();
XRect rect( 150, 150, 500, 500);
SetSize(&rect);
Activate();
}
void MyAppWindow :: Draw( void )
{
//the content of the window has to be drawn
if(graphWindow && graphMemory)
{
XRect rect;
//query the size of the rect to copy
GetUpdateRect( &rect);
//copy the content of the memory-device to the window-device
//without any modifications
XRect rect2 = rect;
//make sure the update-rect will not be stretched
rect2.SetWidth(0);
graphWindow->Copy( graphMemory, &rect, &rect2);
}
}
BOOL MyAppWindow :: DoCommand(LONG command)
{
//the toolbar button has been pressed, get ready to print