home *** CD-ROM | disk | FTP | other *** search
- (* ------------------------------------------------------ *)
- (* LITTGDI2.PAS *)
- (* kleine GDI-Demonstration *)
- (* (c) 1991 Andreas Schallmeier & TOOLBOX *)
- (* ------------------------------------------------------ *)
- PROGRAM LittleGDI;
-
- {$X+}
-
- USES WinTypes, WinProcs, Strings, WObjects;
-
- TYPE
- pGDIFenster = ^tGDIFenster;
- tGDIFenster = OBJECT(tWindow)
- PROCEDURE WMLButtonDown(VAR Msg : tMessage);
- VIRTUAL wm_First+wm_LButtonDown;
- PROCEDURE WMRButtonDown(VAR Msg : tMessage);
- VIRTUAL wm_First+wm_RButtonDown;
- END;
-
- tMyApp = OBJECT(tApplication)
- PROCEDURE InitMainWindow; VIRTUAL;
- END;
-
- VAR
- MyApp : tMyApp;
-
- PROCEDURE tMyApp.InitMainWindow;
- BEGIN
- MainWindow := New(pGDIFenster, Init(NIL,'GDI Fenster'));
- END;
-
- (* ------------------------------------------------------ *)
- (* Listing 2 *)
- (* ------------------------------------------------------ *)
-
- PROCEDURE tGDIFenster.WMLButtonDown(VAR Msg : tMessage);
- VAR
- EinDC : hDC;
- R : tRect;
- x, y : INTEGER;
- i : WORD;
- OldBrush, NewBrush : hBrush;
- ALogBrush : tLogBrush;
- BEGIN
- FOR i := 0 TO 199 DO BEGIN
- EinDC := GetDC(hWindow);
- GetClientRect(hWindow, R);
- NewBrush := CreateSolidBrush
- (RGB(RANDOM(256),RANDOM(256), RANDOM(256)));
- OldBrush := SelectObject(EinDC, NewBrush);
- x := Random(R.Right);
- y := Random(R.Bottom);
- Ellipse(EinDC, x, y, x+30, y+Random(50));
- SelectObject(EinDC, OldBrush);
- ReleaseDC(hWindow, EinDC);
- DeleteObject(NewBrush);
- END;
- END;
-
- (* ------------------------------------------------------ *)
- (* Ende von Listing 2 *)
-
- PROCEDURE tGDIFenster.WMRButtonDown(VAR Msg : tMessage);
- BEGIN
- InvalidateRect(hWindow, NIL, TRUE);
- END;
-
- BEGIN
- MyApp.Init('MyApp');
- MyApp.Run;
- MyApp.Done;
- END.
- (* ------------------------------------------------------ *)
- (* Ende von LITTGDI2.PAS *)
-
-
-
-