Here a modification (fast and dirty) from monoceres' GDI+ demo: #include <GUIConstantsEx.au3>
#include <GDIplus.au3>
Global Const $width = 600
Global Const $height = 400
Global Const $pi = 3.14159265358979323
Global $title = "GDI+"
Global $aPoints[4][2]
; Build your GUI here
Opt("GUIOnEventMode", 1)
$hwnd = GUICreate($title, $width, $height)
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
GUISetState()
; Load your GDI+ resources here:
_GDIPlus_Startup()
$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
$brush = _GDIPlus_BrushCreateSolid(0x1A000000) ;triangle fader
$hBrush = _GDIPlus_BrushCreateSolid (0x7FAFAFAF)
$font_size = 32
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, $font_size, 2)
$text = "GDI+ Demo" & @LF & @LF & _
"Triangle coded by monoceres" & @LF & @LF & _
"Vertical scroller by UEZ" & @LF & @LF & @LF & _
"Greetings to all forum " & @LF & _
"Members at " & @LF & @LF & _
"www.autoitscript.com"
$j = $height / 4
_AntiAlias($backbuffer, 4)
$inc = 0
Global $Polygon_Size = Random(80, 120, 1)
Global $Polygon_X = Random(0, $width - $Polygon_Size, 1)
Global $Polygon_Y = Random(0, $height - $Polygon_Size, 1)
Global $Polygon_Xdir = 1
Global $Polygon_ydir = 1
Global $x1, $x2, $x3, $y1, $y2, $y3
Global $Polygon_Speed = 1.2
_GDIPlus_GraphicsClear($backbuffer)
Do
$inc += 0.02
_GDIPlus_GraphicsFillRect($backbuffer, 0, 0, $width, $height, $brush)
$Polygon_X += $Polygon_Xdir
$Polygon_Y += $Polygon_ydir
$Polygon_Size = 2.5 * (Tan($inc / 1.5) / Cos($inc * $pi / 180) + 1) * 100 + 50 ;triangle size
$red = ((Sin(1 * $inc / 1) + 1) / 2) * 256
$green = ((Sin(2 * $inc / 1) + 1) / 2) * 256
$blue = ((Sin(3 * $inc / 1) + 1) / 2) * 256
$Pen = _GDIPlus_PenCreate("0x7F" & Hex($red, 2) & Hex($green, 2) & Hex($blue, 2), 6) ;pen format and size
$x1 = Cos($inc * $Polygon_Speed) * $Polygon_Size + $Polygon_X
$y1 = Sin($inc * $Polygon_Speed) * $Polygon_Size + $Polygon_Y
$x2 = Cos($inc * $Polygon_Speed + 2 * $pi / 3) * $Polygon_Size + $Polygon_X
$y2 = Sin($inc * $Polygon_Speed + 2 * $pi / 3) * $Polygon_Size + $Polygon_Y
$x3 = Cos($inc * $Polygon_Speed + 4 * $pi / 3) * $Polygon_Size + $Polygon_X
$y3 = Sin($inc * $Polygon_Speed + 4 * $pi / 3) * $Polygon_Size + $Polygon_Y
$aPoints[0][0] = 3
$aPoints[1][0] = $x1
$aPoints[1][1] = $y1
$aPoints[2][0] = $x2
$aPoints[2][1] = $y2
$aPoints[3][0] = $x3
$aPoints[3][1] = $y3
For $i = 1 To $aPoints[0][0]
If $aPoints[$i][1] >= $height Then
$Polygon_ydir = -1
ElseIf $aPoints[$i][1] <= 0 Then
;~ ConsoleWrite("meh!" & @CRLF)
$Polygon_ydir = 1
EndIf
If $aPoints[$i][0] >= $width Then
$Polygon_Xdir = -1
ElseIf $aPoints[$i][0] <= 0 Then
$Polygon_Xdir = 1
EndIf
Next
_GDIPlus_GraphicsDrawPolygon($backbuffer, $aPoints, $Pen)
$tLayout = _GDIPlus_RectFCreate (1 / $width, $height + $j, 0, 0)
_GDIPlus_GraphicsDrawStringEx ($backbuffer, $text, $hFont, $tLayout, $hFormat, $hBrush)
$j -= 0.75
If $height + $j < 0 - (StringLen($text) * 5) Then $j = $height / 4
_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
_GDIPlus_PenDispose($Pen)
Sleep(1)
Until False
Func close()
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose($brush)
_GDIPlus_GraphicsDispose($backbuffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>close
Func _AntiAlias($hGraphics, $mode)
Local $aResult
$aResult = DllCall($ghGDIPDll, "int", "GdipSetSmoothingMode", "hwnd", $hGraphics, "int", $mode)
If @error Then Return SetError(@error, @extended, False)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc ;==>_AntiAlias @monoceres: thanks for sharing knowledge UEZ