DECLARE SUB QNewCanvas_OnPaintEvent
Private:
MainComponent AS QCANVAS
Public:
OnPaint AS EVENT(QNewCanvas_OnPaintEvent)
Top AS LONG PROPERTY SET SetTop
PROPERTY SET SetTop(Top AS LONG)
.Top=Top
.MainComponent.Top=.Top
END PROPERTY
Left AS LONG PROPERTY SET SetLeft
PROPERTY SET SetLeft(Left AS LONG)
.Left=Left
.MainComponent.Left=.Left
END PROPERTY
Width AS LONG PROPERTY SET SetWidth
PROPERTY SET SetWidth(Width AS LONG)
.Width=Width
.MainComponent.Width=.Width
END PROPERTY
Height AS LONG PROPERTY SET SetHeight
PROPERTY SET SetHeight(Height AS LONG)
.Height=Height
.MainComponent.Height=.Height
END PROPERTY
COLOR AS LONG
PARENT AS QFORM PROPERTY SET SetParent
PROPERTY SET SetParent(ParentForm AS QFORM)
.MainComponent.PARENT=ParentForm
END PROPERTY
SUB TextOut(X%, Y%, S$, FC%, BC%)
.MainComponent.TextOut(X%, Y%, S$, FC%, BC%)
END SUB
EVENT MainComponent.OnPaint
.MainComponent.FillRect(0, 0, .Width, .Height, .COLOR)
CALLFUNC .OnPaint
END EVENT
CONSTRUCTOR
SetWidth(100)
SetHeight(100)
COLOR=&H0000FF
END CONSTRUCTOR
END WITH: END TYPE
DECLARE SUB OnNewCanvasPaint
CREATE Form AS QFORM
CAPTION="QNewCanvas"
Center
CREATE NewCanvas AS QNewCanvas
Top=10
Left=10
OnPaint=OnNewCanvasPaint
END CREATE
END CREATE
SUB OnNewCanvasPaint
NewCanvas.TextOut(3, 3, "Hello!", 0, NewCanvas.COLOR)
END SUB
Form.SHOWMODAL
|