Vector STOP

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: JRL, Dorian (MJT support), Phil Pendlebury

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Vector STOP

Post by JRL » Fri May 09, 2025 3:12 pm

Wanted a STOP sign today. Thought I'd share.

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  BorderStyle = bsNone
  ClientHeight = 101
  ClientWidth = 101
  Color = clRed
  TransparentColor = True
  TransparentColorValue = 222222
  object Label1: TLabel
    Left = 10
    Top = 35
    Width = 121
    Height = 46
    Caption = 'STOP'
    Color = clWhite
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWhite
    Font.Height = -30
    Font.Name = 'Arial Rounded MT'
    Font.Style = [fsBold]
    ParentColor = False
    ParentFont = False
  end
end
EndDialog>Dialog1

GetCursorPos>CurX,CurY
Sub>CurX,50
Sub>CurY,50

Let>WIN_USEHANDLE=1
MoveWindow>Dialog1.Handle,CurX,CurY
Let>WIN_USEHANDLE=0

Show>dialog1
//Octogon border
GoSub>DrawLine,Dialog1.Handle,3,16777215,3,70,3,30
GoSub>DrawLine,Dialog1.Handle,3,16777215,3,30,30,3
GoSub>DrawLine,Dialog1.Handle,3,16777215,30,3,70,3
GoSub>DrawLine,Dialog1.Handle,3,16777215,70,3,97,30
GoSub>DrawLine,Dialog1.Handle,3,16777215,97,30,97,70
GoSub>DrawLine,Dialog1.Handle,3,16777215,97,70,70,97
GoSub>DrawLine,Dialog1.Handle,3,16777215,70,97,30,97
GoSub>DrawLine,Dialog1.Handle,3,16777215,30,97,3,70

//Corner trim
GoSub>DrawLine,Dialog1.Handle,40,222222,-50,50,50,-50
GoSub>DrawLine,Dialog1.Handle,40,222222,50,-50,150,50
GoSub>DrawLine,Dialog1.Handle,40,222222,150,50,50,150
GoSub>DrawLine,Dialog1.Handle,40,222222,50,150,-50,50
Wait>5
Exit>0

//DrawLine Usage:
//GoSub>DrawLine,WindowHandle,PenSize,PenColor,XStart,YStart,XEnd,YEnd

SRT>DrawLine
  LibFunc>user32,GetDC,HDC,%DrawLine_var_1%
  LibFunc>gdi32,CreatePen,Penres,0,%DrawLine_var_2%,%DrawLine_var_3%
  LibFunc>gdi32,SelectObject,SOPres,hdc,Penres
  Libfunc>gdi32,MoveToEx,mtres,HDC,%DrawLine_var_4%,%DrawLine_var_5%,0
  LibFunc>gdi32,LineTo,ltres,hdc,%DrawLine_var_6%,%DrawLine_var_7%
  LibFunc>gdi32,DeleteObject,DOres,Penres
  LibFunc>user32,ReleaseDC,RDCres,HDC_1,HDC
END>DrawLine

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts