Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
InForm Paint by Fellippe Heitor
#1
   


An early and simple InForm program. 

The program uses the following InForm objects:
Form
PictureBox
Button

Unzip the file and extract the folder into your PEQB64 directory.  In the IDE make sure that you have the Run Option “Save EXE in source folder” checked.

.zip   InForm Paint.zip (Size: 114.18 KB / Downloads: 5)

Code: (Select All)
': This program was created by Fellippe Heitor
': This program uses
': InForm-PE for QB64-PE - v1.5.8 based upon InForm by Fellippe Heitor
': Copyright (c) 2025 QB64 Phoenix Edition Team
': https://github.com/QB64-Phoenix-Edition/InForm-PE
'-----------------------------------------------------------


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:'InForm\xp.uitheme'
'$INCLUDE:'InFormPaint.frm'

': 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

'$INCLUDE:'InForm\InForm.ui'
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Word Clock by Fellippe Heitor Magdha 0 87 02-09-2026, 11:38 AM
Last Post: Magdha
  Poll: who has tried a740g InForm setup for QB64pe bplus 18 642 02-08-2026, 06:06 PM
Last Post: ahenry3068
  Stopwatch by Fellippe Heitor Magdha 0 130 02-04-2026, 10:19 AM
Last Post: Magdha
  Fireworks by Fellippe Heitor Magdha 0 95 01-30-2026, 10:03 AM
Last Post: Magdha
  Trackword Puzzle Solver (InForm) Program - Referenced to Elsewhere Magdha 2 190 01-26-2026, 08:13 PM
Last Post: bplus

Forum Jump:


Users browsing this thread: 1 Guest(s)