1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. UEZ

Beiträge von UEZ

  • Gdi+ Grafik speichern

    • UEZ
    • 25. Juli 2012 um 18:52
    [autoit]


    $iW = _GDIPlus_ImageGetWidth($hImage)
    $iH = _GDIPlus_ImageGetHeight($hImage)

    [/autoit]

    Gruß,
    UEZ ;)

  • Gdi+ Grafik speichern

    • UEZ
    • 25. Juli 2012 um 16:56

    Klar, das liegt an der Zeile 28:

    [autoit]


    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)

    [/autoit]

    Hier wird eine leere Bitmap mit der Größe $iW bzw. $iH erstellt und per

    [autoit]


    _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)

    [/autoit]


    befüllt. Wenn die Größe des Bildes in $hImage ungleich der Größe der Bitmap ($hBitmap) ist, dann tritt genau dies ein.

    Du hast jetzt verschiedene Möglichkeiten dies zu lösen. Die einfachste Möglichkeit ist, die GUI und $hBitmap an die Größe des Bildes ($hImage) anzupassen.

    Probiere dies mal selbst hinzubekommen. :D

    Tipp: du musst "nur" zwei Zeilen modifizieren.

    Gruß,
    UEZ

  • Gdi+ Grafik speichern

    • UEZ
    • 25. Juli 2012 um 16:26

    Probiere es mal damit:

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <gdiplus.au3>
    #include <misc.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    $hImage = _GDIPlus_ImageLoadFromFile(FileOpenDialog("Bild auswählen", @ScriptDir, "Bilder (*.jpg)"))
    If Not $hImage Then Exit _GDIPlus_Shutdown()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $x = 140
    $y = 110
    $iW = 625
    $iH = 443

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Form1", $iW, $iH)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    $aFont = _ChooseFont()

    [/autoit] [autoit][/autoit] [autoit]

    $Text = "Das ist Text 1" & @LF & _
    "Das ist Text 2" & @LF & _
    "Das ist Text 3"

    [/autoit] [autoit][/autoit] [autoit]

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($form1)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
    $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2)
    DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hCtxt, "int", 4)
    _GDIPlus_GraphicsDrawImage($hCtxt, $hImage, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $aFont[7])
    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate($aFont[2])
    $hFont = _GDIPlus_FontCreate($hFamily, $aFont[3], $aFont[1])
    $tLayout = _GDIPlus_RectFCreate($x, $y, 1000, 1000)
    _GDIPlus_GraphicsDrawStringEx($hCtxt, $Text, $hFont, $tLayout, $hFormat, $hBrush)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Global $hDLL = DllOpen("user32.dll")

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Ilse.jpg")
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_Shutdown()
    DllClose($hDLL)
    GUIDelete()
    Exit
    EndSwitch
    If _IsPressed("25") Then
    $x -= 1
    DllStructSetData($tLayout, "X", $x)
    Update()
    ElseIf _IsPressed("27") Then
    $x += 1
    DllStructSetData($tLayout, "X", $x)
    Update()
    ElseIf _IsPressed("26") Then
    $y -= 1
    DllStructSetData($tLayout, "Y", $y)
    Update()
    ElseIf _IsPressed("28") Then
    $y += 1
    DllStructSetData($tLayout, "Y", $y)
    Update()
    EndIf
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func Update()
    _GDIPlus_GraphicsDrawImage($hCtxt, $hImage, 0, 0)
    _GDIPlus_GraphicsDrawStringEx($hCtxt, $Text, $hFont, $tLayout, $hFormat, $hBrush)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
    Return 1
    EndFunc

    [/autoit]

    Gruß,
    UEZ

  • Unstrukturieren Text parsen - wie ?

    • UEZ
    • 17. Juli 2012 um 23:18

    Probiere es mal damit:

    Spoiler anzeigen
    [autoit]


    $sPop3 = _
    'Received: by s1.vhs.local ' & @CRLF & _
    ' id <01CD6422.821DCACA@s1.vhs.local>; Tue, 17 Jul 2012 15:46:03 +0200' & @CRLF & _
    'Return-Receipt-To: "it" <[email='it@lala.de'][/email]>' & @CRLF & _
    'Content-class: urn:content-classes:message' & @CRLF & _
    'Subject: Test123' & @CRLF & _
    'MIME-Version: 1.0' & @CRLF & _
    'Content-Type: multipart/alternative;' & @CRLF & _
    ' boundary="----_=_NextPart_001_01CD6422.821DCACA"' & @CRLF & _
    'Date: Tue, 17 Jul 2012 15:46:01 +0200' & @CRLF & _
    'Message-ID: <114753C5767DF54A90285C5A1A10A3A3021A52@s1.vhs.local>' & @CRLF & _
    'Disposition-Notification-To: "it" <[email='it@lala.de'][/email]>' & @CRLF & _
    'X-MimeOLE: Produced By Microsoft Exchange V6.5' & @CRLF & _
    'X-MS-Has-Attach: ' & @CRLF & _
    'X-MS-TNEF-Correlator: ' & @CRLF & _
    'Thread-Topic: Test123' & @CRLF & _
    'thread-index: Ac1kInwC5AN8zIg8RJ6OA9xctXvurg==' & @CRLF & _
    'From: "it" <[email='it@lala.de'][/email]>' & @CRLF & _
    'To: "bubu" <[email='bubu@lala.de'][/email]>'
    $sParse = StringRegExpReplace($sPop3, "(?im)[\s\S]*?Subject:\s*(.*)(?s).*", "$1")
    MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$sParse' & @lf & @lf & 'Return:' & @lf & $sParse) ;### Debug MSGBOX

    [/autoit]

    Gruß,
    UEZ

  • Bilder Listview

    • UEZ
    • 17. Juli 2012 um 22:04

    Schaue hier mal rein: _GUIImageList_AddBitmapEx() v0.80 Build 2011-11-05 beta - fügt ein Bild in den _GUIImageList Control hinzu

    Gruß,
    UEZ

  • Bilder Listview

    • UEZ
    • 17. Juli 2012 um 18:03

    Probiere es mal damit:

    Spoiler anzeigen
    [autoit]


    ;Original code by Jayson -> http://www.autoitscript.com/forum/topic/12…ls/#entry888097
    ;Modified by UEZ 2012
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Include <File.au3>
    #Include <EditConstants.au3>
    #Include <Constants.au3>
    #include <GuiListView.au3>
    #include <GuiImageList.au3>
    #include <GDIPlus.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt('MustDeclareVars', 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $sExtFilter = "bmp|gif|jpeg|jpg|png|tif|tiff"
    Global $hGui, $hGui_Preview, $hGui_PreviewSize, $idPic, $idLabel_Info, $Path, $BRowse, $LV, $Pic, $hLV, $aCtrl, $show, $FSF, $timer, $file_prev, $off = False
    Global $hImageList, $sCur, $sLast, $iDX, $iPicState = 0, $DoubleClick = -1
    _GDIPlus_Startup()
    $hGui = GUICreate("Image Viewer", 490, 620)
    $Path = GUICtrlCreateInput("", 10, 10, 400, 20, $ES_READONLY)
    $BRowse = GUICtrlCreateButton("Browse", 420, 10, 60, 20)
    $LV = GUICtrlCreateListView("", 5, 40, 480, 575, -1, BitOr($WS_EX_CLIENTEDGE, $LVS_EX_DOUBLEBUFFER))
    _GUICtrlListView_SetView($LV, 1)
    _GUICtrlListView_SetIconSpacing($LV, 75, 60)
    $hLV = GUICtrlGetHandle($LV)
    $Pic = GUICtrlCreatePic("", 200, 80, 440, 440)
    GUISetState(@SW_SHOW, $hGui)
    $hGui_PreviewSize = 300
    $hGui_Preview = GUICreate("", $hGui_PreviewSize, $hGui_PreviewSize + 58, -1, -1, $WS_POPUP + $WS_BORDER, $WS_EX_TOPMOST, $hGui)
    $idPic = GUICtrlCreatePic("", 0, 0, $hGui_PreviewSize, $hGui_PreviewSize)
    $idLabel_Info = GUICtrlCreateLabel("" , 0, $hGui_PreviewSize + 8, $hGui_PreviewSize * 2, 50)
    GUICtrlSetFont(-1, 10, 400, 0, "Arial", 5)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x222222)
    GUISetState(@SW_HIDE, $hGui_Preview)

    [/autoit] [autoit][/autoit] [autoit]

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    [/autoit] [autoit][/autoit] [autoit]

    $show = False
    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    _GDIPlus_Shutdown()
    Exit
    Case $Browse
    If _Browse() Then $show = True
    EndSwitch
    If $show Then StartPreview()
    If Not WinActive($hGui) Then WinActivate($hGui)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func StartPreview()
    Local $hBmp_Tmp, $file, $iIndex
    $iIndex = _GUICtrlListView_GetSelectedIndices($hLV)
    $file = $FSF & _GUICtrlListView_GetItemText($hLV, $iIndex)
    Local $aPos = _GUICtrlListView_GetItemPosition($hLV, $iIndex)
    If TimerDiff($timer) < 5000 Then
    If $file_prev <> $file Then
    $hBmp_Tmp = _GetImage($file, $hGui_PreviewSize)
    _hBmpToPicControl($idPic, $hBmp_Tmp, 1)
    WinMove($hGui_Preview, "", $aPos[0] + $hGui_PreviewSize / 5, Min(@DesktopHeight - ($hGui_PreviewSize + 130), $aPos[1]), $hGui_PreviewSize, $hGui_PreviewSize + 58, 1)
    GUISetState(@SW_SHOW, $hGui_Preview)
    $file_prev = $file
    $off = False
    EndIf
    Else
    If Not $off Then
    GUISetState(@SW_HIDE, $hGui_Preview)
    $off = True
    EndIf
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Min($a, $b)
    If $a < $b Then Return $a
    Return $b
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Browse()
    Local $FL2A, $hBmp, $iCnt = 0
    $FSF = FileSelectFolder("Browse for folder containing pictures", "", "", $hGui)
    If Not @error And FileExists($FSF) Then
    If StringRight($FSF, 1) <> "\" Then $FSF &= "\"
    $FL2A = _FileListToArray($FSF, "*", 1)
    If Not @Error Then
    If IsPtr($hImageList) Then
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($LV))
    _GUiImageList_Destroy($hImageList)
    $hImageList = ""
    _hBmpToPicControl($Pic, $hBmp)
    GUICtrlSetImage($Pic, "")
    $iDX = -1
    $iPicState = 0
    $sCur = ""
    $sLast = ""
    EndIf
    $hImageList = _GUiImageList_Create(60, 60, 5, 3)
    _GUICtrlListView_SetImageList($LV, $hImageList, 0)
    For $i = 1 To $FL2A[0]
    If StringRegExp($FL2A[$i], "(?i)\.(" & $sExtFilter & ")", 0) Then
    $hBmp = _GetImage($FSF & $FL2A[$i], 60)
    _GUiImageList_Add($hImageList, $hBmp)
    _WinAPI_DeleteObject($hBmp)
    _GUICtrlListView_AddItem($LV, $FL2A[$i], $iCnt)
    _GUICtrlListView_SetItemImage($LV, $iCnt, $iCnt)
    $iCnt += 1
    EndIf
    Next
    GUICtrlSetData($Path, $FSF)
    EndIf
    WinSetTitle($hGui, "", "Images Found: " & $iCnt)
    Return True
    Else
    If $FSF = "" Then $show = False
    Return SetError(1, 0, False)
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetImage($sFile, $iWH, $iBkClr = 0xFFFFFF)
    Local $hBmp1, $hBitmap, $hGraphic, $hImage, $iW, $iH, $aGS, $hBmp2, $aFTS
    $aFTS = FileGetTime($sFile)
    If @error Then Return SetError(1, 0, 0)
    $hBmp1 = _WinAPI_CreateBitmap($iWH, $iWH, 1, 32)
    $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp1)
    $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _WinAPI_DeleteObject($hBmp1)
    _GDIPlus_GraphicsClear($hGraphic, BitOR(0xFF000000, $iBkClr))
    $hImage = _GDIPlus_ImageLoadFromFile($sFile)
    $iW = _GDIPlus_ImageGetWidth($hImage)
    $iH = _GDIPlus_ImageGetHeight($hImage)
    GUICtrlSetData($idLabel_Info, $sFile & @LF & Round(FileGetSize($sFile) / 1024, 0) & " kb (" & $iW & " x " & $iH & ")" & @LF & $aFTS[0] & "/" & $aFTS[1] & "/" & $aFTS[2] & " " & $aFTS[3] & ":" & $aFTS[4] & ":" &$aFTS[5])
    $aGS = _GetScale($iW, $iH, $iWH)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, $aGS[0], $aGS[1], $aGS[2], $aGS[3])
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphic)
    $hBmp2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _GDIPlus_BitmapDispose($hBitmap)
    Return $hBmp2
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetScale($iW, $iH, $iWH)
    Local $aRet[4]
    If $iW <= $iWH And $iH <= $iWH Then
    $aRet[2] = $iW
    $aRet[3] = $iH
    $aRet[0] = ($iWH - $aRet[2])/2
    $aRet[1] = ($iWH - $aRet[3])/2
    ElseIf $iW > $iH Then
    $aRet[2] = $iWH
    $aRet[3] = $iH/($iW/$iWH)
    $aRet[0] = 0
    $aRet[1] = ($iWH - $aRet[3])/2
    ElseIf $iW < $iH Then
    $aRet[2] = $iW/($iH/$iWH)
    $aRet[3] = $iWH
    $aRet[0] = ($iWH - $aRet[2])/2
    $aRet[1] = 0
    ElseIf $iW = $iH Then
    $aRet[2] = $iWH
    $aRet[3] = $iWH
    $aRet[0] = 0
    $aRet[1] = 0
    EndIf
    Return $aRet
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _hBmpToPicControl($iCID, ByRef $hBmp, $iFlag = 0)
    Local Const $STM_SETIMAGE = 0x0172
    Local Const $IMAGE_BITMAP = 0
    Local $hOldBmp
    $hOldBmp = GUICtrlSendMsg($iCID, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp)
    If $hOldBmp Then _WinAPI_DeleteObject($hOldBmp)
    If $iFlag Then _WinAPI_DeleteObject($hBmp)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo, $tInfo2, $aIDX
    $hWndListView = GUICtrlGetHandle($LV)
    $tNMHDR = DllStructCreate('hwnd hWndFrom;int_ptr IDFrom;int Code', $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    $tInfo = DllStructCreate('hwnd hWndFrom;int_ptr IDFrom;int Code;int_ptr VKey;int Flags', $ilParam)
    $tInfo2 = DllStructCreate($tagNMLISTVIEW, $ilParam)
    Switch $hWndFrom
    Case $hWndListView
    Switch $iCode
    Case $NM_CLICK
    $iDX = _GUICtrlListView_GetNextItem($hWndListView)
    $timer = TimerInit()
    Case $NM_DBLCLK
    $DoubleClick = _GUICtrlListView_GetNextItem($hWndListView)
    $timer = TimerInit()
    Case $LVN_KEYDOWN
    Switch BitAnd(DllStructGetData($tInfo, "VKey"), 0xFFFF)
    Case $VK_UP
    $iDX = _GUICtrlListView_GetNextItem($hWndListView) -1
    If $iDX < 0 Then $iDX = 0
    Case $VK_DOWN
    $iDX = _GUICtrlListView_GetNextItem($hWndListView) + 1
    If $iDX >= _GUICtrlListView_GetItemCount($hWndListView) Then $iDX -= 1
    EndSwitch
    $timer = TimerInit()
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc

    [/autoit]

    Gruß,
    UEZ

  • Gdiplus und Icons

    • UEZ
    • 14. Juli 2012 um 10:22

    Hi eukalyptus,

    bei deiner 2. Methode geht leider die Transparenz flöten (zumindest bei mir unter Win7 x64 + Aero). ;)

    Wenn du die 2 _GDIPlus_GraphicsClear() auskommentierst, kannst du sehen, dass die Icons nicht richtig transparent sind.

    In _GUICtrlMenu_CreateBitmap() v0.60 Build 2012-01-07 beta - Erstellt Icons für GUI Menüs ist auch noch eine Variante, aber dein Code aus IconDock fand ich hier passender.

    Gruß,
    UEZ

  • Gdiplus und Icons

    • UEZ
    • 13. Juli 2012 um 21:56

    Hier ein Beispiel:

    Spoiler anzeigen
    [autoit]


    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $sFile = "Shell32.dll"
    $iIndex = 4;Random(0, 200, 1)
    $iSizeW = 32
    $iSizeH = 32
    $aRet = DllCall('shell32.dll', 'int', 'SHExtractIconsW', 'wstr', $sFile, 'int', $iIndex, 'int', $iSizeW, 'int', $iSizeH, 'ptr*', 0, 'ptr*', 0, 'int', 1, 'int', 0)
    $hIcon = $aRet[5]
    $hBitmap = __IconDock_IconToGdiPlus($hIcon, $iSizeW, $iSizeH)
    _WinAPI_DestroyIcon($hIcon)

    [/autoit] [autoit][/autoit] [autoit]

    $iW = _GDIPlus_ImageGetWidth($hBitmap)
    $iH = _GDIPlus_ImageGetHeight($hBitmap)
    $hGUI = GUICreate("", $iW * 2, $iH * 2, -1, -1, $WS_POPUPWINDOW)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    $hGFX = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    _GDIPlus_GraphicsDrawImage($hGFX, $hBitmap, $iW / 2, $iH / 2)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Do
    Until GUIGetMsg()= -3

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGFX)
    _GDIPlus_Shutdown()
    GUIDelete()

    [/autoit] [autoit][/autoit] [autoit]

    Exit

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ======================================================================================
    ; Name ..........: __IconDock__IconDock_IconToGdiPlus()
    ; Description ...: Internal Function
    ; Author ........: Eukalyptus
    ; =================================================================================================
    Func __IconDock_IconToGdiPlus($hIcon, $iWidth, $iHeight)

    [/autoit] [autoit][/autoit] [autoit]

    Local $tBITMAPINFO = DllStructCreate("dword Size;long Width;long Height;word Planes;word BitCount;dword Compression;dword SizeImage;long XPelsPerMeter;long YPelsPerMeter;dword ClrUsed;dword ClrImportant;dword RGBQuad")
    DllStructSetData($tBITMAPINFO, 'Size', DllStructGetSize($tBITMAPINFO) - 4)
    DllStructSetData($tBITMAPINFO, 'Width', $iWidth)
    DllStructSetData($tBITMAPINFO, 'Height', -$iHeight)
    DllStructSetData($tBITMAPINFO, 'Planes', 1)
    DllStructSetData($tBITMAPINFO, 'BitCount', 32)
    DllStructSetData($tBITMAPINFO, 'Compression', 0)
    DllStructSetData($tBITMAPINFO, 'SizeImage', 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $hDC = _WinAPI_CreateCompatibleDC(0)
    Local $aRet = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBITMAPINFO), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0)
    Local $pBits = $aRet[4]
    Local $hBmp = $aRet[0]
    Local $hOrig = _WinAPI_SelectObject($hDC, $hBmp)
    _WinAPI_DrawIconEx($hDC, 0, 0, $hIcon, $iWidth, $iHeight)

    [/autoit] [autoit][/autoit] [autoit]

    Local $bAlpha = False
    Local $tData = DllStructCreate("dword[" & $iWidth * $iHeight & "]", $pBits)
    For $i = 1 To $iWidth * $iHeight
    If BitAND(DllStructGetData($tData, 1, $i), 0xFF000000) Then
    $bAlpha = True
    ExitLoop
    EndIf
    Next
    Switch $bAlpha
    Case True
    $aRet = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iWidth * 4, "int", 0x26200A, "ptr", $pBits, "int*", 0)
    Local $hBitmapTemp = $aRet[6]

    [/autoit] [autoit][/autoit] [autoit]

    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
    Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
    Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawImage($hContext, $hBitmapTemp, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_BitmapDispose($hBitmapTemp)
    _WinAPI_DeleteObject($hBmp)
    _GDIPlus_GraphicsDispose($hContext)
    _GDIPlus_GraphicsDispose($hGraphics)

    [/autoit] [autoit][/autoit] [autoit]

    _WinAPI_SelectObject($hDC, $hOrig)
    _WinAPI_DeleteDC($hDC)
    Case Else
    $aRet = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromHICON", "hwnd", $hIcon, "int*", 0)
    Local $hBitmap = $aRet[2]
    _WinAPI_SelectObject($hDC, $hOrig)
    _WinAPI_DeleteObject($hBmp)
    _WinAPI_DeleteDC($hDC)
    EndSwitch
    Return $hBitmap
    EndFunc ;==>__IconDock_IconToGdiPlus

    [/autoit]

    Gruß,
    UEZ

  • Happy Birthday TheShadowAE

    • UEZ
    • 13. Juli 2012 um 21:54

    Herzlichen Glückwunsch zum Geburtstag und alles Gute!


    Gruß,
    UEZ

  • Bestimmte Werte aus Textdatei auslesen

    • UEZ
    • 13. Juli 2012 um 15:46

    Hier noch ein RegEx Möglichkeit:

    [autoit][/autoit][autoit][/autoit][autoit]

    $sTxt = _
    "Titel:" & @CRLF & _
    "Titel des Buches" & @CRLF & _
    "Autor:" & @CRLF & _
    "Autor 1 des Buches" & @CRLF & _
    "Autor 2 des Buches" & @CRLF & _
    "Autor 3 des Buches" & @CRLF & _
    "Abstract:" & @CRLF & _
    "Abstract des Buches"

    [/autoit][autoit][/autoit][autoit]

    $sTitel = StringRegExpReplace($sTxt, "(?si)(.*)Titel:\s*(.*)Autor:(.*)", "$2")
    $sAutor = StringRegExpReplace($sTxt, "(?si)(.*)Autor:\s*(.*)\s+Abstract:(.*)", "$2")
    MsgBox(0, "Test", "Titel: " & $sTitel & @CRLF & _
    "Autor(en): " & @CRLF & $sAutor)

    [/autoit]

    Gruß,
    UEZ

  • 'Fliegende' Labels = Transparenter Hintergrund der GUI

    • UEZ
    • 12. Juli 2012 um 21:58

    Hier was von mir:

    Spoiler anzeigen
    [autoit]


    Opt("GUIOnEventMode", 1)
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    Global Const $iTranparentColor = 0xDDDDDD
    Global Const $iW = 120
    Global Const $iH = 30
    Global Const $iX = @DesktopWidth / 2 - $iW / 2
    Global Const $iY = @DesktopHeight / 2 - $iH / 2
    Global Const $hGUI = GUICreate("", $iW, $iH, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST)
    Global Const $idLabel = GUICtrlCreateLabel("Label Demo", 0, 0, 120, 30)
    GUICtrlSetBkColor(-1, $iTranparentColor)
    GUICtrlSetColor(-1, 0x0000FF)
    GUICtrlSetFont(-1, 16, 400, 0, "Arial", 5)
    GUISetState()
    _WinAPI_SetLayeredWindowAttributes($hGUI, $iTranparentColor)
    GUISetOnEvent(-3, "_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    Global $i = Random(-0xFFFFFF, 0, 1)
    Do
    WinMove($hGUI, "", $iX + Cos($i / 25) * 100, $iY + Sin($i / 20) * 80)
    $i += 1
    Until Not Sleep(20)

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    GUIDelete()
    Exit
    EndFunc

    [/autoit]

    Oder so was:

    Spoiler anzeigen
    [autoit]


    Opt("GUIOnEventMode", 1)
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    Global Const $iTranparentColor = 0xEEEEEE
    Global Const $iW = 310
    Global Const $iH = 100
    Global Const $iX = @DesktopWidth / 2 - $iW / 2
    Global Const $iY = @DesktopHeight / 2 - $iH / 2
    Global Const $sTxt = "Label Demo by UEZ"
    Global Const $iTxtLen = StringLen($sTxt)
    Global Const $iFontsize = 16

    [/autoit] [autoit][/autoit] [autoit]

    Global $i, $j
    Global $aTaskbar = WinGetPos("[CLASS:Shell_TrayWnd;INSTANCE:1]", "")
    Global Const $hGUI = GUICreate("", $iW, $iH, @DesktopWidth - $iW - $iTxtLen, @DesktopHeight - $iH - $aTaskbar[3], $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST + $WS_EX_COMPOSITED)
    GUISetBkColor($iTranparentColor, $hGUI)
    $aLetters = StringSplit($sTxt, "", 2)
    Global Const $ub = UBound($aLetters) - 1
    Global $aIDLabels[$ub + 1]
    Global $dx = 40, $dy = 40
    For $i = 0 To $ub
    $aIDLabels[$i] = GUICtrlCreateLabel($aLetters[$i], $dx, $dy, $iFontsize, 40)
    GUICtrlSetBkColor(-1, $iTranparentColor)
    GUICtrlSetColor(-1, 0x80)
    GUICtrlSetFont(-1, $iFontsize, 400, 0, "Arial", 5)
    $dx += $iFontsize
    Next
    GUISetState()
    _WinAPI_SetLayeredWindowAttributes($hGUI, $iTranparentColor)
    GUISetOnEvent(-3, "_Exit")
    $i = 0
    $dx = 40
    $s = 0
    $t = TimerInit()
    Do
    For $j = 0 To $ub
    GUICtrlSetPos($aIDLabels[$j], $dx, $dy + Sin($i / 50) * 36)
    $c = BitShift(0x80 + Sin($i / 50) * 80, -$s)
    GUICtrlSetColor($aIDLabels[$j], $c)
    $i += 18
    $dx += $iFontsize
    Next
    If TimerDiff($t) > 9999 Then
    $s += 8
    If $s > 16 Then $s = 0
    $t = TimerInit()
    EndIf
    $dx = 40
    Until Not Sleep(20)

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    GUIDelete()
    Exit
    EndFunc

    [/autoit]

    Gruß,
    UEZ

  • GDI+ zeichnet Kreise seltsam

    • UEZ
    • 12. Juli 2012 um 16:17

    Abgesehen davon, warum willst du diese Funktion verwenden?

    Wenn du _GDIPlus_GraphicsDrawRect($hBUF, 300, 100, 200, 200, $hPEN) ausführst, werden sogar waag. / senkr. Linien "gesmootht".

    Liegt vielleicht daran, dass die Pixel doch irgendwie anders angeordnet werden, sodass das smoothing andere Resultate liefert.

    Gruß,
    UEZ

  • abgerundetes rechteck GDI+

    • UEZ
    • 9. Juli 2012 um 18:29

    Schaue mal hier http://www.autoitscript.com/forum/topic/97…sdrawroundrect/ oder hier http://www.autoitscript.com/forum/topic/14…nd-border-label rein.

    Gruß,
    UEZ

  • String Split

    • UEZ
    • 9. Juli 2012 um 12:33

    Wenn du wirklich am Ende des Textes ein Punkt stehen hast, kannst du ihn einfach löschen:

    [autoit]


    #include<Array.au3>

    [/autoit][autoit][/autoit][autoit]

    $Text = ("Das ist Text 1. Das ist Text2. Das ist Text 3.")
    If StringRight($Text, 1) = "." Then $Text = StringMid($Text, 1, StringLen($Text) - 1)
    $arraytxt = StringSplit($Text, '.',2)
    _ArrayDisplay($arraytxt)
    Exit

    [/autoit]

    Ansonsten wird es ein bisschen komplizierter.

    Gruß,
    UEZ

  • String Split

    • UEZ
    • 9. Juli 2012 um 12:14

    Weil nach jedem Punkt getrennt wird, somit auch am letzten Punkt.

    Gruß,
    UEZ

  • OwnContext UDF (vorher MenuEx)

    • UEZ
    • 9. Juli 2012 um 09:34

    Sehr schöne UDF! :thumbup:

    Werde ich bestimmt öfters benutzen!

    Läuft sauber auf Win7 x64 inkl. Aero.

    Danke,
    UEZ

  • Klein zu Großbuchstaben umwandeln

    • UEZ
    • 7. Juli 2012 um 21:50
    Zitat von Raupi

    UEZ, deine Lösung wird aber jedes Wort am Anfang groß schreiben und kann nicht mi meheren Buchstaben in <> umgehen ;)

    Ich habe bewusst nur die Variante genommen, die zu seinem String passt. Ich wollte nicht zu jede Möglichkeit in betracht ziehen, da es den Rahmen sprengen würde.

    Wenn der Text String so aussieht, dann kommt eben so eine Lösung raus.

    Gruß,
    UEZ

  • Klein zu Großbuchstaben umwandeln

    • UEZ
    • 7. Juli 2012 um 17:11

    Du hast nicht gesagt, dass du die spitzen Klammen nicht haben willst.

    [autoit][/autoit][autoit][/autoit][autoit]

    #include <String.au3>

    [/autoit][autoit][/autoit][autoit]

    $sText = "<h>allo <b>asti2022"
    $sNew = _StringProper(StringRegExpReplace($sText, "<(.)>", "$1"))

    [/autoit][autoit][/autoit][autoit]

    MsgBox(0, "Test", $sNew)

    [/autoit]

    Gruß,
    UEZ

  • Klein zu Großbuchstaben umwandeln

    • UEZ
    • 7. Juli 2012 um 13:49

    Probiere es mal damit:

    [autoit]


    #include <Array.au3>
    $sText = "<h>allo <b>asti2022"

    [/autoit][autoit][/autoit][autoit]

    MsgBox(0, "Test", Convert($sText))

    [/autoit][autoit][/autoit][autoit]

    Func Convert($sText)
    Local $aText = StringSplit($sText, "", 2)
    Local $ub = UBound($aText) - 1
    Local $i
    For $i = 0 To $ub
    If $aText[$i] = "<" And $i < $ub Then $aText[$i + 1] = StringUpper($aText[$i + 1])
    Next
    Return _ArrayToString($aText, "")
    EndFunc

    [/autoit]

    Gruß,
    UEZ

  • Bilder auf Duplikat prüfen

    • UEZ
    • 7. Juli 2012 um 13:29

    Und wie sieht es aus, wenn zwei Bilder unterschiedliche Formate haben, wie z.B. PNG und BMP, aber der Inhalt gleich ist?

    Gruß,
    UEZ

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™