Jump to content

GDI+ Problem ...


Greenhorn
 Share

Recommended Posts

Hi,

I want to draw an arrow on my GUI - it works - and after drawing I want to delete it - it doesn't work -.

It should show the steps of installation my applications ...

My question is, how to delete the arrow ???

I'm not familiar in GDI+.

Please help me. :)

#include-once
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>

Opt('OnExitFunc', 'OnAutoItExit')

Global $hGraphic
Global $hPen
Global $hEndCap
Global $yPos = 65
Global $hWnd = GUICreate('Installiere Anwendungen ...', 320, 380, -1, -1, $WS_OVERLAPPEDWINDOW)

Dim $sSchalterDB = @ScriptDir & '\SchalterDB.ini'
Dim $sApplicationPath = @HomeDrive & '\PostInstall\Appz\'
Dim $arApplications[13]
$arApplications[0] = 12
$arApplications[1] = 'AdobeReader'
$arApplications[2] = 'Irfanview'
$arApplications[3] = 'IrfanviewPlugins'
$arApplications[4] = 'Firefox'
$arApplications[5] = 'Thunderbird'
$arApplications[6] = 'VLCMediaPlayer'
$arApplications[7] = 'Notepad++'
$arApplications[8] = 'MicrosoftMessenger8Live'
$arApplications[9] = 'MicrosoftMessenger8LivePlus!'
$arApplications[10] = 'OpenOffice'
$arApplications[11] = 'Paint.NET'
$arApplications[12] = 'xp-AntiSpy'

$arSectionNames = IniReadSectionNames(@ScriptDir & '\SchalterDB.ini')


$lblAdobeRdr = GUICtrlCreateLabel('Adobe Reader 8.1', 60, 60, 220)
$lblIrfanview = GUICtrlCreateLabel('Irfanview 4.1', 60, 80)
$lblIrfanviewPlugins = GUICtrlCreateLabel('Irfanview 4.1 Plugins', 60, 100)
$lblFirefox = GUICtrlCreateLabel('Mozilla Firefox 2.0.0.11', 60, 120)
$lblThunderbird = GUICtrlCreateLabel('Mozilla Thunderbird 2.0.0.9', 60, 140)
$lblVLC = GUICtrlCreateLabel('VLC Media Player 0.8.6', 60, 160)
$lblNotepadpp = GUICtrlCreateLabel('Notepad++', 60, 180)
$lblMessenger = GUICtrlCreateLabel('Windows Live Messenger 8.5', 60, 200)
$lblMessengerPlus = GUICtrlCreateLabel('Messenger Plus! Live 4.23', 60, 220)
$lblOpenOffice = GUICtrlCreateLabel('Open Office 2.3', 60, 240)
$lblPaintNET = GUICtrlCreateLabel('Paint .NET 3.22', 60, 260)
$lblXPAntispy = GUICtrlCreateLabel('xp-Antispy 3.96-7', 60, 280)
$lblCleanUp = GUICtrlCreateLabel('Aufräumen und neustart ...', 60, 300)

GUISetState()
_GDIPlus_Startup ()
#cs
While 1
    Sleep(1000)
WEnd
#ce
For $i = 1 To $arApplications[0]
    $arData = IniReadSection($sSchalterDB, $arApplications[$i])
    DeleteArrow()
    DrawArrow($yPos)
    GUICtrlSetFont($arData[2][0], 9, 800)
    ;ShellExecuteWait($sApplicationPath & $arData[1][0], $arData[1][1])
    Sleep(500)
    $yPos += 20
    GUICtrlSetFont($arData[2][0], 8.5, 400)
Next
Exit

Func DrawArrow($cyPos)
    
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
    $hPen = _GDIPlus_PenCreate (0xFF000000, 2)
    $hEndCap = _GDIPlus_ArrowCapCreate (3, 6)
    _GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
    _GDIPlus_GraphicsDrawLine ($hGraphic, 50, $cyPos, 56, $cyPos, $hPen)
    _GDIPlus_ArrowCapDispose ($hEndCap)
    _GDIPlus_PenDispose ($hPen)
    _GDIPlus_GraphicsDispose ($hGraphic)
    
EndFunc

Func DeleteArrow()
    
    _WinAPI_DeleteObject ($hPen)
    
EndFunc

Func OnAutoItExit()
    
    _GDIPlus_Shutdown ()
    
EndFunc

Greetz

Greenhorn

Link to comment
Share on other sites

Thank you very much, smashly !!!

It works fine, I'm very delighted. :)

#include-once
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>

Opt('OnExitFunc', 'OnAutoItExit')

Global $hGraphic
Global $hPen
Global $hEndCap
Global $yPos = 65
Global $hWnd = GUICreate('Installiere Anwendungen ...', 320, 380, -1, -1, $WS_OVERLAPPEDWINDOW)
$lblAdobeRdr = GUICtrlCreateLabel('Adobe Reader 8.1', 60, 60, 220)
$lblIrfanview = GUICtrlCreateLabel('Irfanview 4.1', 60, 80)
$lblIrfanviewPlugins = GUICtrlCreateLabel('Irfanview 4.1 Plugins', 60, 100)
$lblFirefox = GUICtrlCreateLabel('Mozilla Firefox 2.0.0.11', 60, 120)
$lblThunderbird = GUICtrlCreateLabel('Mozilla Thunderbird 2.0.0.9', 60, 140)
$lblVLC = GUICtrlCreateLabel('VLC Media Player 0.8.6', 60, 160)
$lblNotepadpp = GUICtrlCreateLabel('Notepad++', 60, 180)
$lblMessenger = GUICtrlCreateLabel('Windows Live Messenger 8.5', 60, 200)
$lblMessengerPlus = GUICtrlCreateLabel('Messenger Plus! Live 4.23', 60, 220)
$lblOpenOffice = GUICtrlCreateLabel('Open Office 2.3', 60, 240)
$lblPaintNET = GUICtrlCreateLabel('Paint .NET 3.22', 60, 260)
$lblXPAntispy = GUICtrlCreateLabel('xp-Antispy 3.96-7', 60, 280)
$lblCleanUp = GUICtrlCreateLabel('Aufräumen und neustart ...', 60, 300)

GUISetState()
_GDIPlus_Startup ()


For $i = 1 To 12
    DrawArrow($yPos)
    Sleep(500)
    $yPos += 20
    DeleteArrow()
Next
Exit

Func DrawArrow($cyPos)
    
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
    $hPen = _GDIPlus_PenCreate (0xFF000000, 2)
    $hEndCap = _GDIPlus_ArrowCapCreate (3, 6)
    _GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
    _GDIPlus_GraphicsDrawLine ($hGraphic, 50, $cyPos, 56, $cyPos, $hPen)
    _GDIPlus_ArrowCapDispose ($hEndCap)
    _GDIPlus_PenDispose ($hPen)
    _GDIPlus_GraphicsDispose ($hGraphic)
    
EndFunc

Func DeleteArrow()
    
    _WinAPI_InvalidateRect($hWnd)
    
EndFunc

Func OnAutoItExit()
    
    _GDIPlus_Shutdown ()
    
EndFunc

Greetz

Greenhorn

Edited by Greenhorn
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...