(-: Fun With StringGrids :-)

Anything Really. Just keep it clean!

Moderators: Dorian (MJT support), JRL

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

(-: Fun With StringGrids :-)

Post by JRL » Fri Nov 17, 2017 10:11 pm

Code: Select all

 //Alpha Blend Value step per loop cycle
//Bigger is faster
Let>vStep=5

//Loop execution dwell slows Loop cycle
//Smaller is faster
Let>dwell=0.05

//Length of time to run (in Milliseconds)
//0 (zero) runs until stopped manually by pressing the Esc key
Let>vHowLongToRun=0

OnEvent>key_down,VK27,0,Quit

GetCursorPos>CurX,CurY
MouseMove>-32000,-32000
GetCursorPos>ulX,ulY
MouseMove>-32000,32000
GetCursorPos>llX,llY
MouseMove>32000,32000
GetCursorPos>lrX,lrY
MouseMove>32000,-32000
GetCursorPos>urX,urY
Let>vWide={%lrX%-%ulX%+15}
Let>vHigh={%lrY%-%ulY%+15}
MouseMove>CurX,CurY
Random>16777215,vColor1S
Random>16777215,vColor1E

Dialog>Dialog1
object Dialog1: TForm
  object MSStringGrid1: tMSStringGrid
    Left = 0
    Top = 0
    ColCount = 2
    DrawingStyle = gdsGradient
    RowCount = 1
    FixedRows = 0
  end
end
EndDialog>Dialog1

SetDialogProperty>Dialog1,,ClientWidth,vWide
SetDialogProperty>Dialog1,,ClientHeight,vHigh
SetDialogProperty>Dialog1,,Position,poScreenCenter
SetDialogProperty>Dialog1,,AlphaBlend,True
SetDialogProperty>Dialog1,,AlphaBlendValue,255
SetDialogProperty>Dialog1,,BorderStyle,bsNone
SetDialogProperty>Dialog1,,Caption,GridGrad
SetDialogProperty>Dialog1,MSStringGrid1,Width,vWide
SetDialogProperty>Dialog1,MSStringGrid1,Height,vHigh
SetDialogProperty>Dialog1,MSStringGrid1,DefaultColWidth,vWide
SetDialogProperty>Dialog1,MSStringGrid1,DefaultRowHeight,vHigh
SetDialogProperty>Dialog1,MSStringGrid1,GradientStartColor,vColor1S
SetDialogProperty>Dialog1,MSStringGrid1,GradientEndColor,vColor1E
Let>ABV1=255
Let>ABV1Flag=1

Show>Dialog1

Dialog>Dialog2
object Dialog2: TForm
  object MSStringGrid1: tMSStringGrid
    Left = 0
    Top = 0
    ColCount = 2
    DrawingStyle = gdsGradient
    RowCount = 1
    FixedRows = 0
  end
end
EndDialog>Dialog2

SetDialogProperty>Dialog2,,ClientWidth,vWide
SetDialogProperty>Dialog2,,ClientHeight,vHigh
SetDialogProperty>Dialog2,,Position,poScreenCenter
SetDialogProperty>Dialog2,,AlphaBlend,True
SetDialogProperty>Dialog2,,AlphaBlendValue,127
SetDialogProperty>Dialog2,,BorderStyle,bsNone
SetDialogProperty>Dialog2,,Caption,GridGrad
SetDialogProperty>Dialog2,MSStringGrid1,Width,vWide
SetDialogProperty>Dialog2,MSStringGrid1,Height,vHigh
SetDialogProperty>Dialog2,MSStringGrid1,DefaultColWidth,vWide
SetDialogProperty>Dialog2,MSStringGrid1,DefaultRowHeight,vHigh
SetDialogProperty>Dialog2,MSStringGrid1,GradientStartColor,vColor1S
SetDialogProperty>Dialog2,MSStringGrid1,GradientEndColor,vColor1E
Let>ABV2=0
Let>ABV2Flag=0

Show>Dialog2

Label>Loop
  Wait>dwell
  If>ABV1Flag=1
    Add>ABV1,vStep
    If>ABV1>254
      Let>ABV1Flag=0
    EndIf
  Else
    Sub>ABV1,vStep
    If>ABV1<1
      Random>16777215,vColor1S
      Random>16777215,vColor1E
      SetDialogProperty>Dialog1,MSStringGrid1,GradientStartColor,vColor1S
      SetDialogProperty>Dialog1,MSStringGrid1,GradientEndColor,vColor1E
      Let>ABV1Flag=1
    EndIf
  EndIf
  
  If>ABV2Flag=1
    Add>ABV2,vStep
    If>ABV2>254
      Let>ABV2Flag=0
    EndIf
  Else
    Sub>ABV2,vStep
    If>ABV2<1
      Random>16777215,vColor2S
      Random>16777215,vColor2E
      SetDialogProperty>Dialog2,MSStringGrid1,GradientStartColor,vColor2S
      SetDialogProperty>Dialog2,MSStringGrid1,GradientEndColor,vColor2E
      Let>ABV2Flag=1
    EndIf
  EndIf
  SetDialogProperty>Dialog2,,AlphaBlendValue,ABV2
  
  If>vHowLongToRun=0,Loop
  Timer>vTime
  If>vTime>vHowLongToRun
    Exit>0
  EndIf
Goto>Loop

SRT>Quit
  GetActiveWindow>vTitle,vWinX,vWinY

  If>vTitle={"GridGrad"}
    Exit>0
  EndIf
END>Quit

User avatar
Djek
Pro Scripter
Posts: 134
Joined: Sat Feb 05, 2005 11:35 pm
Location: Holland
Contact:

Re: (-: Fun With StringGrids :-)

Post by Djek » Sun Nov 19, 2017 12:48 pm

wow !

i like your ingenious way to detect the space above the traybar with the use of your cursor.

Im getting high now
:shock:

kind regards,
Djek

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

Re: (-: Fun With StringGrids :-)

Post by JRL » Mon Nov 20, 2017 7:50 pm

Moving the cursor from corner to corner does not leave out the task bar. You could however run the following and deduct the "high" variable (no pun intended) from the overall height of the detected screen size.

I suspect the borderless dialog size might appear to exclude the taskbar when it displays full screen since it doesn't present over the top of the task bar and also has no border to display just above the task bar.

Code: Select all

LibFunc>User32,FindWindowA,FWres,Shell_TrayWnd,0

Let>WIN_USEHANDLE=1
  GetWindowPos>FWres,WinX,WinY
  GetWindowSize>FWres,Wide,High
Let>WIN_USEHANDLE=0

Post Reply