funkey Posted September 7, 2011 Share Posted September 7, 2011 I hope you like it. expandcollapse popup#Region _GuiCtrlSetFont.au3 ;Copyrights to funkey !! #include <WinAPI.au3> OnAutoItExitRegister("_FontCleanUp") Global $ahFontEx[1] = [0] Func _GuiCtrlSetFont($controlID, $size, $weight = 400, $attribute = 0, $rotation = 0, $fontname= "", $quality = 2) Local $fdwItalic = BitAND($attribute, 1) Local $fdwUnderline = BitAND($attribute, 2) Local $fdwStrikeOut = BitAND($attribute, 4) ReDim $ahFontEx[UBound($ahFontEx) + 1] $ahFontEx[0] += 1 $ahFontEx[$ahFontEx[0]] = _WinAPI_CreateFont($size, 0, $rotation * 10, $rotation, $weight, _ $fdwItalic, $fdwUnderline, $fdwStrikeOut, -1, 0, 0, $quality, 0, $fontname) GUICtrlSendMsg($controlID, 48, $ahFontEx[$ahFontEx[0]], 1) EndFunc Func _FontCleanUp() For $i = 1 To $ahFontEx[0] _WinAPI_DeleteObject($ahFontEx[$i]) Next EndFunc #EndRegion Global $hGui1 = GuiCreate("AutoIt Main-GUI", 300, 340, 100, 100, -1, 0); For $i = 0 To 350 Step 30 GUICtrlCreateLabel("This is rotating", 50, 0, 300, 220, 0x201) _GuiCtrlSetFont(-1, 15, 1000, 1, $i) GUICtrlSetBkColor(-1, -2) Next GUICtrlCreateLabel("This is a vertical label", 10, 30,200, 200, 0x001) _GuiCtrlSetFont(-1, 15, 400, 1, -90) GUICtrlSetBkColor(-1, -2) GUICtrlCreateLabel("This too!!", 130, 50, 200, 200, 0x202) _GuiCtrlSetFont(-1, 15, 400, 1, 90) GUICtrlSetBkColor(-1, -2) GuiCtrlCreateButton("This is a cool button text", 10, 220, 275, 60, 0x0800); _GuiCtrlSetFont(-1, 20, 1000, 1, 8) GuiCtrlCreateCombo("Hello", 10, 290, 275, 80, 0x3, -1); _GuiCtrlSetFont(-1, 15, 1000, 1, -3) GUICtrlSetData(-1, "Item2|Item3") GuiSetState(@SW_SHOW, $hGui1); Do Until GUIGetMsg() = -3 Zedna, mesale0077 and DiscGolferPro 3 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
Andreik Posted September 7, 2011 Share Posted September 7, 2011 It's nice but why don't you clean up the font object after this line? GUICtrlSendMsg($controlID, 48, $ahFontEx[$ahFontEx[0]], 1) When the words fail... music speaks. Link to comment Share on other sites More sharing options...
funkey Posted September 7, 2011 Author Share Posted September 7, 2011 Did you try it? Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
mesale0077 Posted June 16, 2013 Share Posted June 16, 2013 I hope you like it. expandcollapse popup#Region _GuiCtrlSetFont.au3 ;Copyrights to funkey !! #include <WinAPI.au3> OnAutoItExitRegister("_FontCleanUp") Global $ahFontEx[1] = [0] Func _GuiCtrlSetFont($controlID, $size, $weight = 400, $attribute = 0, $rotation = 0, $fontname= "", $quality = 2) Local $fdwItalic = BitAND($attribute, 1) Local $fdwUnderline = BitAND($attribute, 2) Local $fdwStrikeOut = BitAND($attribute, 4) ReDim $ahFontEx[UBound($ahFontEx) + 1] $ahFontEx[0] += 1 $ahFontEx[$ahFontEx[0]] = _WinAPI_CreateFont($size, 0, $rotation * 10, $rotation, $weight, _ $fdwItalic, $fdwUnderline, $fdwStrikeOut, -1, 0, 0, $quality, 0, $fontname) GUICtrlSendMsg($controlID, 48, $ahFontEx[$ahFontEx[0]], 1) EndFunc Func _FontCleanUp() For $i = 1 To $ahFontEx[0] _WinAPI_DeleteObject($ahFontEx[$i]) Next EndFunc #EndRegion Global $hGui1 = GuiCreate("AutoIt Main-GUI", 300, 340, 100, 100, -1, 0); For $i = 0 To 350 Step 30 GUICtrlCreateLabel("This is rotating", 50, 0, 300, 220, 0x201) _GuiCtrlSetFont(-1, 15, 1000, 1, $i) GUICtrlSetBkColor(-1, -2) Next GUICtrlCreateLabel("This is a vertical label", 10, 30,200, 200, 0x001) _GuiCtrlSetFont(-1, 15, 400, 1, -90) GUICtrlSetBkColor(-1, -2) GUICtrlCreateLabel("This too!!", 130, 50, 200, 200, 0x202) _GuiCtrlSetFont(-1, 15, 400, 1, 90) GUICtrlSetBkColor(-1, -2) GuiCtrlCreateButton("This is a cool button text", 10, 220, 275, 60, 0x0800); _GuiCtrlSetFont(-1, 20, 1000, 1, 8) GuiCtrlCreateCombo("Hello", 10, 290, 275, 80, 0x3, -1); _GuiCtrlSetFont(-1, 15, 1000, 1, -3) GUICtrlSetData(-1, "Item2|Item3") GuiSetState(@SW_SHOW, $hGui1); Do Until GUIGetMsg() = -3 nice but font color how? Link to comment Share on other sites More sharing options...
funkey Posted June 17, 2013 Author Share Posted June 17, 2013 Just use GUICtrlSetColor() to set the font color. Only using background color is a problem.expandcollapse popup#Region _GuiCtrlSetFont.au3 ;Copyrights to funkey !! #include <WinAPI.au3> OnAutoItExitRegister("_FontCleanUp") Global $ahFontEx[1] = [0] Func _GuiCtrlSetFont($controlID, $size, $weight = 400, $attribute = 0, $rotation = 0, $fontname= "", $quality = 2) Local $fdwItalic = BitAND($attribute, 1) Local $fdwUnderline = BitAND($attribute, 2) Local $fdwStrikeOut = BitAND($attribute, 4) ReDim $ahFontEx[UBound($ahFontEx) + 1] $ahFontEx[0] += 1 $ahFontEx[$ahFontEx[0]] = _WinAPI_CreateFont($size, 0, $rotation * 10, $rotation, $weight, _ $fdwItalic, $fdwUnderline, $fdwStrikeOut, -1, 0, 0, $quality, 0, $fontname) GUICtrlSendMsg($controlID, 48, $ahFontEx[$ahFontEx[0]], 1) EndFunc Func _FontCleanUp() For $i = 1 To $ahFontEx[0] _WinAPI_DeleteObject($ahFontEx[$i]) Next EndFunc #EndRegion Global $hGui1 = GuiCreate("_GuiCtrlSetFont example", 300, 340, 100, 100, -1, 0); For $i = 0 To 350 Step 30 GUICtrlCreateLabel("This is rotating", 50, 0, 300, 220, 0x201) GUICtrlSetColor(-1, Random(0, 0xffffff, 1)) _GuiCtrlSetFont(-1, 15, 1000, 1, $i) GUICtrlSetBkColor(-1, -2) Next GUICtrlCreateLabel("This is a vertical label", 10, 30,200, 200, 0x001) GUICtrlSetColor(-1, Random(0, 0xffffff, 1)) _GuiCtrlSetFont(-1, 15, 400, 1, -90) GUICtrlSetBkColor(-1, -2) GUICtrlCreateLabel("This too!!", 130, 50, 200, 200, 0x202) GUICtrlSetColor(-1, Random(0, 0xffffff, 1)) _GuiCtrlSetFont(-1, 15, 400, 1, 90) GUICtrlSetBkColor(-1, -2) GuiCtrlCreateButton("This is a cool button text", 10, 220, 275, 60, 0x0800); _GuiCtrlSetFont(-1, 20, 1000, 1, 8) GuiCtrlCreateCombo("Hello", 10, 290, 275, 80, 0x3, -1); GUICtrlSetColor(-1, Random(0, 0xffffff, 1)) _GuiCtrlSetFont(-1, 15, 1000, 1, -3) GUICtrlSetData(-1, "Item2|Item3") GuiSetState(@SW_SHOW, $hGui1); Do Until GUIGetMsg() = -3 mesale0077 1 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
mesale0077 Posted June 17, 2013 Share Posted June 17, 2013 (edited) very cool but text color and background color transparent how? this code expandcollapse popup#Region _GuiCtrlSetFont.au3 ;Copyrights to funkey !! #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPI.au3> OnAutoItExitRegister("_FontCleanUp") Global $ahFontEx[1] = [0] Func _GuiCtrlSetFont($controlID, $size, $weight = 400, $attribute = 0, $rotation = 0, $fontname= "", $quality = 2) Local $fdwItalic = BitAND($attribute, 1) Local $fdwUnderline = BitAND($attribute, 2) Local $fdwStrikeOut = BitAND($attribute, 4) ReDim $ahFontEx[UBound($ahFontEx) + 1] $ahFontEx[0] += 1 $ahFontEx[$ahFontEx[0]] = _WinAPI_CreateFont($size, 0, $rotation * 10, $rotation, $weight, _ $fdwItalic, $fdwUnderline, $fdwStrikeOut, -1, 0, 0, $quality, 0, $fontname) GUICtrlSendMsg($controlID, 48, $ahFontEx[$ahFontEx[0]], 1) EndFunc Func _FontCleanUp() For $i = 1 To $ahFontEx[0] _WinAPI_DeleteObject($ahFontEx[$i]) Next EndFunc #EndRegion Global $TemaShe = @ScriptDir & "\BLacK.she" Global $TemaDLL = @ScriptDir & "\BLacK.dll" $Dll = DllOpen ($TemaDLL) DllCall ( $Dll, "int", "SkinH_AttachEx", "str",$TemaShe, "str", "mhgd" ) DllCall ( $Dll, "int", "SkinH_SetAero", "int", 1 ) Global $hGui1 = GUICreate("GDI ", 400, 400) $Pic1 = GUICtrlCreatePic(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)) & "Examples\GUI\msoobe.jpg", 0, 0, 400, 400, 0) GUICtrlSetState( $Pic1 , $GUI_disable) For $i = 0 To 350 Step 30 GUICtrlCreateLabel("This is rotating", 50, 0, 300, 220, 0x201) GUICtrlSetColor(-1, Random(0, 0xffffff, 1)) _GuiCtrlSetFont(-1, 15, 1000, 1, $i) GUICtrlSetBkColor(-1, -2) Next GUICtrlCreateLabel("This is a vertical label", 10, 30,200, 200, 0x001) GUICtrlSetColor(-1, Random(0, 0xffffff, 1)) _GuiCtrlSetFont(-1, 15, 400, 1, -90) GUICtrlSetBkColor(-1, -2) GUICtrlCreateLabel("This too!!", 130, 50, 200, 200, 0x202) GUICtrlSetColor(-1, Random(0, 0xffffff, 1)) _GuiCtrlSetFont(-1, 15, 400, 1, 90) GUICtrlSetBkColor(-1, -2) GuiCtrlCreateButton("This is a cool button text", 10, 220, 275, 60, 0x0800); _GuiCtrlSetFont(-1, 20, 1000, 1, 8) GuiCtrlCreateCombo("Hello", 10, 290, 275, 80, 0x3, -1); GUICtrlSetColor(-1, Random(0, 0xffffff, 1)) _GuiCtrlSetFont(-1, 15, 1000, 1, -3) GUICtrlSetData(-1, "Item2|Item3") GuiSetState(@SW_SHOW, $hGui1); Do Until GUIGetMsg() = -3 and files http://www.mediafire.com/?b3fy46l481d1yzb Edited June 17, 2013 by mesale0077 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now