1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2024-05-12 06:50:12 +00:00
InForm/examples/InFormPaint/InFormPaint.bas
2024-01-11 05:36:34 +05:30

239 lines
5.2 KiB
QBasic

': This program was generated by
': InForm - GUI system for QB64 - Beta version 6
': Fellippe Heitor, 2016/2018 - fellippe@qb64.org - @fellippeheitor
'-----------------------------------------------------------
OPTION _EXPLICIT
': Controls' IDs: ------------------------------------------------------------------
DIM SHARED InFormPaint AS LONG
DIM SHARED PictureBox1 AS LONG
DIM SHARED CircleBT AS LONG
DIM SHARED SquareBT AS LONG
DIM SHARED SquareFilledBT AS LONG
DIM SHARED CopyBT AS LONG
DIM SHARED Drawing AS _BYTE, Tool AS _UNSIGNED _BYTE
': External modules: ---------------------------------------------------------------
'$INCLUDE:'../../InForm/InForm.bi'
'$INCLUDE:'InFormPaint.frm'
'$INCLUDE:'../../InForm/InForm.ui'
': Event procedures: ---------------------------------------------------------------
SUB __UI_BeforeInit
END SUB
SUB __UI_OnLoad
DIM prevDest AS LONG
prevDest = _DEST
Control(CircleBT).HelperCanvas = _NEWIMAGE(30, 30, 32)
_DEST Control(CircleBT).HelperCanvas
CIRCLE (_WIDTH / 2, _HEIGHT / 2), 12, _RGB32(0, 0, 0)
Text(CircleBT) = "."
Control(SquareBT).HelperCanvas = _NEWIMAGE(30, 30, 32)
_DEST Control(SquareBT).HelperCanvas
LINE (3, 3)-STEP(24, 24), _RGB32(0, 0, 0), B
Text(SquareBT) = "."
Control(SquareFilledBT).HelperCanvas = _NEWIMAGE(30, 30, 32)
_DEST Control(SquareFilledBT).HelperCanvas
LINE (3, 3)-STEP(24, 24), _RGB32(0, 0, 0), BF
Text(SquareFilledBT) = "."
Control(CopyBT).HelperCanvas = _NEWIMAGE(30, 30, 32)
_DEST Control(CopyBT).HelperCanvas
LINE (3, 3)-STEP(15, 15), _RGB32(0, 0, 0), B
LINE (7, 7)-STEP(15, 15), _RGB32(0, 0, 0), B
Text(CopyBT) = "."
_DEST prevDest
BeginDraw PictureBox1
CLS , _RGB32(255, 255, 255)
EndDraw PictureBox1
END SUB
SUB __UI_BeforeUpdateDisplay
STATIC TempImage AS LONG
DIM prevDest AS LONG
IF TempImage = 0 THEN
TempImage = _COPYIMAGE(Control(PictureBox1).HelperCanvas)
END IF
prevDest = _DEST
IF Drawing THEN
_DEST TempImage
SELECT CASE Tool
CASE 1
CIRCLE (__UI_MouseLeft - Control(PictureBox1).Left, __UI_MouseTop - Control(PictureBox1).Top), 30, _RGB32(0, 0, 0)
CASE 2
LINE (__UI_MouseLeft - Control(PictureBox1).Left - 10, __UI_MouseTop - Control(PictureBox1).Top - 10)-STEP(20, 20), _RGB32(0, 0, 0), B
CASE 3
LINE (__UI_MouseLeft - Control(PictureBox1).Left - 10, __UI_MouseTop - Control(PictureBox1).Top - 10)-STEP(20, 20), _RGB32(0, 0, 0), BF
END SELECT
_DEST prevDest
END IF
BeginDraw PictureBox1
_PUTIMAGE (0, 0), TempImage
IF NOT Drawing THEN
SELECT CASE Tool
CASE 1
CIRCLE (__UI_MouseLeft - Control(PictureBox1).Left, __UI_MouseTop - Control(PictureBox1).Top), 30, _RGB32(0, 0, 0)
CASE 2
LINE (__UI_MouseLeft - Control(PictureBox1).Left - 10, __UI_MouseTop - Control(PictureBox1).Top - 10)-STEP(20, 20), _RGB32(0, 0, 0), B
CASE 3
LINE (__UI_MouseLeft - Control(PictureBox1).Left - 10, __UI_MouseTop - Control(PictureBox1).Top - 10)-STEP(20, 20), _RGB32(0, 0, 0), BF
END SELECT
END IF
EndDraw PictureBox1
END SUB
SUB __UI_BeforeUnload
END SUB
SUB __UI_Click (id AS LONG)
SELECT CASE id
CASE InFormPaint
CASE PictureBox1
CASE CircleBT
Tool = 1
CASE SquareBT
Tool = 2
CASE SquareFilledBT
Tool = 3
CASE CopyBT
_CLIPBOARDIMAGE = Control(PictureBox1).HelperCanvas
END SELECT
END SUB
SUB __UI_MouseEnter (id AS LONG)
SELECT CASE id
CASE InFormPaint
CASE PictureBox1
CASE CircleBT
CASE SquareBT
CASE SquareFilledBT
CASE CopyBT
END SELECT
END SUB
SUB __UI_MouseLeave (id AS LONG)
SELECT CASE id
CASE InFormPaint
CASE PictureBox1
CASE CircleBT
CASE SquareBT
CASE SquareFilledBT
CASE CopyBT
END SELECT
END SUB
SUB __UI_FocusIn (id AS LONG)
SELECT CASE id
CASE CircleBT
CASE SquareBT
CASE SquareFilledBT
CASE CopyBT
END SELECT
END SUB
SUB __UI_FocusOut (id AS LONG)
SELECT CASE id
CASE CircleBT
CASE SquareBT
CASE SquareFilledBT
CASE CopyBT
END SELECT
END SUB
SUB __UI_MouseDown (id AS LONG)
SELECT CASE id
CASE InFormPaint
CASE PictureBox1
Drawing = TRUE
CASE CircleBT
CASE SquareBT
CASE SquareFilledBT
CASE CopyBT
END SELECT
END SUB
SUB __UI_MouseUp (id AS LONG)
Drawing = FALSE
SELECT CASE id
CASE InFormPaint
CASE PictureBox1
CASE CircleBT
CASE SquareBT
CASE SquareFilledBT
CASE CopyBT
END SELECT
END SUB
SUB __UI_KeyPress (id AS LONG)
SELECT CASE id
CASE CircleBT
CASE SquareBT
CASE SquareFilledBT
CASE CopyBT
END SELECT
END SUB
SUB __UI_TextChanged (id AS LONG)
SELECT CASE id
END SELECT
END SUB
SUB __UI_ValueChanged (id AS LONG)
SELECT CASE id
END SELECT
END SUB
SUB __UI_FormResized
END SUB