Jump to content

Macrostop

Members
  • Posts

    6
  • Joined

  • Last visited

Macrostop's Achievements

  1. Hello @orbs thank you very much for your UDF. Works also well with Autoit v3.3.14.2 Best regards M.
  2. Thank you Melba23 (Once again) Your example saved my day. Very rare info about 'Tabs over background picture'. M.
  3. Hello members just found that UEZ's script in this thread solved my problem so far: Convert PNG and JPG to CUR in autoit Thank you all Edit: AutoXenon modified the script to make ".ico" file output available.
  4. Hello KaFu Thank you for this hint. 👍 Unfortunately the script you pointed to is using exactly those "new style Tabs" (_GUICtrlTab_InsertItem), which I do not want to use. It may be that this is an easy way to create a tab with color, but it makes all further steps more difficult (for me). I am looking for a way to create an icon file in a hex color which I can assign to the tab (for example). It doesn't matter if a colored bitmap has to be created first. (see post #1) I would be grateful for any advice in this direction.
  5. Thank you KaFu for the quick reply Your suggestion simplifies the creation of color symbols excellently. Even for MenuItems. This has brought me a big step forward - thank you. However, it is not yet clear (for me) how to attach such color symbols to a tab control. Here again a script with applied code: (I apologize for my simple-minded attempt at implementation.) ; icon_test_3 #include-once #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <GuiMenu.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <GuiTab.au3> _GDIPlus_Startup() ; Color Icons + Menu Icons ; _GDIPlus_Shutdown() Local $hWnd = GUICreate("Icon Test", 300, 200) Local $FileMenu = GUICtrlCreateMenu(" File ") Local $FileMenuItem = GUICtrlCreateMenuItem("Exit", $FileMenu) ;~; ------------------------------------------------------------------------------- Local $hBMP_2 = _WinAPI_CreateSolidBitmap($hWnd, 0xC0C0C0, 16, 16) _GUICtrlMenu_SetItemBitmaps(GUICtrlGetHandle($FileMenu), $FileMenuItem, $hBMP_2, $hBMP_2, False) ; works on Win7 ;~; ------------------------------------------------------------------------------- Local $hTab = GUICtrlCreateTab(10, 50, 280, 140) _GUICtrlTab_SetMinTabWidth($hTab, 70) ; Local $nTab1 = GUICtrlCreateTabItem("Tab 1") ;~ GUICtrlSetImage(-1, "shell32.dll", -28, 0) ; works on Win7 ;~; -------------works NOT on Win7------------------------------------------------------------------ Local $hBMP_2 = _WinAPI_CreateSolidBitmap($hWnd, 0xC0C0C0, 16, 16) _GUICtrlMenu_SetItemBitmaps(GUICtrlGetHandle($hTab), $nTab1, $hBMP_2, $hBMP_2, False) ; ;~; -------------works NOT on Win7------------------------------------------------------------------ GUICtrlCreateTabItem("Tab 2") GUICtrlSetImage(-1, "shell32.dll", -35, 0) ; works on Win7 GUICtrlCreateTabItem("") ; end tabitem definition ; GUISetState() While GUIGetMsg() <> -3 WEnd _GDIPlus_Shutdown() I must admit I am using old style of Tab creation what I do not want to change.
  6. Dear Ladies and Sirs I want to apply a colored icon to my Tab-Control. This works well if I have the file present as ".ico" file. Now I want to apply an Icon which is defined by HEX-color: e.g. "0xC0C0C0", but can not get it to work. I have a similiar code to create Bitmap-files (temporary): ;~ ;------------------------------------------------------------------------------- #include-once #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <GuiMenu.au3> #include <File.au3> ;~ ;------------------------------------------------------------------------------- _GDIPlus_Startup() ; Color Icons + Menu Icons ; _GDIPlus_Shutdown() ;~; ------------------------------------------------------------------------------- Local $hWnd = GUICreate("Icon Test", 200, 200) GUISetState() Local $idContextmenu = GUICtrlCreateContextMenu() GUICtrlCreateMenuItem("Item 1", $idContextmenu) Local $Item2 = GUICtrlCreateMenuItem("Item 2", $idContextmenu) Local $Menu = GUICtrlCreateMenu("Menu", $idContextmenu) Local $Item3 = GUICtrlCreateMenuItem("Item 3", $Menu) Local $hTMP = _Return_colored_BitMapFile("0xC0C0C0", @TempDir) ; ($vColor, $pTargetFolder = Default(TEMP), $vWidth = Default(16), $vHeight = Default(16), $iBitMapFileOut = Default(_TempFile)) ;~ Local $hTMP = _Return_colored_BitMapFile("0x345345", @TempDir,Default ,Default,"C:\sdfgdfhg.bmp") ; ($vColor, $pTargetFolder = Default(TEMP), $vWidth = Default(16), $vHeight = Default(16), $iBitMapFileOut = Default(_TempFile)) Local $hBitM = _WinAPI_LoadImage(0, $hTMP, $IMAGE_BITMAP, 16, 16, BitOR($LR_LOADTRANSPARENT, $LR_LOADFROMFILE, $LR_SHARED)) _GUICtrlMenu_SetItemBitmaps(GUICtrlGetHandle($idContextmenu), $Item2, $hBitM, $hBitM, False) _GUICtrlMenu_SetItemBitmaps(GUICtrlGetHandle($Menu), $Item3, $hBitM, $hBitM, False) While GUIGetMsg() <> -3 WEnd _GDIPlus_Shutdown() ; #FUNCTION# ==================================================================================================================== ; Name...........: _Return_colored_BitMapFile ; Description ...: Creates a Bitmap file based on a HEX Color ; Syntax.........: _Return_colored_BitMapFile($HexColor, $pTargetFolder = Default, $Width = Default, $Height = Default, $iBitMapFileOut = Default) ; Parameters ....: $HexColor ; Format: 0xDADADA ; Parameters ....: $pTargetFolder ; where to store the file ; Parameters ....: $Width ; width of the file to create ; Parameters ....: $Height ; Height of the file to create ; Parameters ....: $iBitMapFileOut ; Path and extension of the file to create ; Return values .: Success: ; returns path of created bitmap-file ; Return values .: @Error = 1 ; if file was not created ; Remarks .......: ; Related .......: _GDIPlus_BitmapCreateFromScan0, _GDIPlus_ImageSaveToFile ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== ;~; ------------------------------------------------------------------------------------------------------ Func _Return_colored_BitMapFile($HexColor, $pTargetFolder = Default, $Width = Default, $Height = Default, $iBitMapFileOut = Default) ; ($Color, $pTargetFolder = Default(TEMP), $Width = Default(16), $Height = Default(16), $iBitMapFileOut = Default(_TempFile)) ;~; ------------------------------------------------------------------------------ If $Width = Default Then $Width = 16 If $Height = Default Then $Height = 16 If $pTargetFolder = Default Then $pTargetFolder = @TempDir ElseIf StringIsSpace($pTargetFolder) Then $pTargetFolder = @TempDir ElseIf DirCreate($pTargetFolder) = 0 Then $pTargetFolder = @TempDir EndIf If $iBitMapFileOut = Default Then $iBitMapFileOut = _TempFile($pTargetFolder, "~", ".bmp", 7) ; NUR bmp !!! If StringLen($HexColor) <> 8 Then Return SetError(1) Local $0xAARRGGBB = "0xFF" & StringRight($HexColor, 6) ; weiß(00) ist hier der AlphaKanal Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($Width, $Height) ; create an empty bitmap Local $hBmpCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) ; get the graphics context of the bitmap _GDIPlus_GraphicsSetSmoothingMode($hBmpCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ; muss angegeben werden _GDIPlus_GraphicsClear($hBmpCtxt, $0xAARRGGBB) ; fill bitmap with color ; Alpha, Red, Green and Blue components. _GDIPlus_ImageSaveToFile($hBitmap, $iBitMapFileOut) ; save bitmap to disk If @error Then Return SetError(1) ; file was not created If Not @Compiled Then ConsoleWrite('> ' & @TAB & @ScriptLineNumber & @TAB & '$hBmpCtxt ' & @TAB & $hBmpCtxt & @CRLF) ; > = blue text color BLAU If Not @Compiled Then ConsoleWrite('+ ' & @TAB & @ScriptLineNumber & @TAB & '$hBitmap ' & @TAB & $hBitmap & @CRLF) ; > = blue text color BLAU If FileExists($iBitMapFileOut) Then Return $iBitMapFileOut ; kein ERROR ; --> Datei-Pfad als ReturnValue Else Return SetError(1) EndIf EndFunc ;==>_Return_colored_BitMapFile ;~; ------------------------------------------------------------------------------------------------------ Is there a chance to turn the colored bitmap to icon? Have mercy, I am new to the GDIPlus thing! Thank you in advance. M.
×
×
  • Create New...