Newi

GUICtrlCreateCombo & GDIPlus Startup()

7 posts in this topic

#1 ·  Posted

hi ...

this is my first post here ... maybe someone can give me a tip

 

when i use 

_GDIPlus_Startup()
$Co1 = GUICtrlCreateCombo("--- Bitte Wählen ---",10,120,220,33)

i get a extra smal frame under the combobox

if i use 

;_GDIPlus_Startup()
$Co1 = GUICtrlCreateCombo("--- Bitte Wählen ---",10,120,220,33)

there is no frame!

see the attached file ~~~

can someone eplain why ?

thx 4 help ;-)

Screenshot_1.png

Share this post


Link to post
Share on other sites



#2 ·  Posted

Post the full code that we can reproduce the "issue".


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#3 ·  Posted

#include <Date.au3>
#include <string.au3>
#include <file.au3>
#include <array.au3>
#include <MsgBoxConstants.au3>

#include <ColorConstantS.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <FontConstants.au3>

#include <GDIPlus.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>

#include <GUIComboBox.au3>
#include <GUIComboBoxEx.au3>
#include <ButtonConstants.au3>
#include <GuiStatusBar.au3>

#include <Word.au3>

;--- -------------------------------------------------------------------------------

Opt("GUIOnEventMode", 1)
HotKeySet("{ESC}", "_EXIT")

Global $line_old,$send,$xmsg,$AntTime,$CBox, $WaitTime ,$Co1
Global $I1,$I2,$CHECKBOX1,$I3,$CHECKBOX2,$B1,$B2


;MsgBox(0,"info" & $ScriptVersion, @ScriptDir & "\" & @ScriptName,15)

$Workdir    = IniRead(@ScriptDir & "\LCP.ini", "General", "Workdir", "c:\") ;"M:\bwwin\DAT00001\AKTEN\VORLAGEN\"
$GuiSBott   = IniRead(@ScriptDir & "\LCP.ini", "General", "GuiSBott", "100") ;100
$GuiW       = IniRead(@ScriptDir & "\LCP.ini", "General", "GuiW", "400") ;400
$GuiH       = IniRead(@ScriptDir & "\LCP.ini", "General", "Guih", "170") ;170
$WaitTime   = IniRead(@ScriptDir & "\LCP.ini", "General", "WaitTime", "1000") ;3000
$DoIt       = IniRead(@ScriptDir & "\LCP.ini", "General", "DoIt", 0) ;3000


;--- PRÜFUNGEN ob alles da -------------------------------------------------
IF $Doit = 0 Then
    MsgBox(0,$ScriptName & " " & $ScriptVersion & " Info ...",$ScriptFullName & " " & $ScriptVersion & @CRLF& @CRLF & "kann wegen Sperrre nicht ausgeführt werden" & @CRLF & "Bitte versuchen Sie es in einigen Minuten erneut.",15)
    Exit
endIf


if not FileExists($Workdir ) then
     MsgBox(0, $ScriptName & " " & $ScriptVersion & " Info ...", "Verzeichniss " & $Workdir & " nicht verfügbar",30)
     Exit
EndIf
;--- -------------------------------------------------------------------------

$xmsg = ""
$Z = 0

_GDIPlus_Startup()

;GDI+ initialisieren, ESC als HotKey festlegen
HotKeySet("{ESC}", "_Exit")

$hGUI = GUICreate($ScriptName & " " & $ScriptVersion & " © by Gerhard Wagner" ,$GuiW, $GuiH, 50, 50 )
GUISetBkColor(0xFFFFFF, $hGUI)
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 255)

;Graphic-Objekt, Pinsel und Backbuffer erstellen und GUI anzeigen
$hPen = _GDIPlus_PenCreate(0x567BA1, 1) ; Roten Pinsel mit Breite von 4 px.
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
GUISetState()

;--- MENÜ -------------------------------------------
$MenuWidth = 240
$hFillBrush = _GDIPlus_BrushCreateSolid(0xFF567BA1)
_GDIPlus_GraphicsFillRect($hGraphics , 0, 0, $MenuWidth, $GuiH,$hFillBrush)

$logoPic = GUICtrlCreatePic(@ScriptDir & "\images\logo.jpg",10,10,222,65)

$sFont = "verdana"
$LabelM0 = GUICtrlCreateLabel("Bitte Steuerfile auswählen ...", 10, 100,$MenuWidth-20,20 )
GUICtrlSetBkColor($LabelM0,0x567BA1 )
GUICtrlSetColor($LabelM0,  $COLOR_white)
GUICtrlSetFont ( $LabelM0,10,  $FW_NORMAL, $GUI_FONTITALIC, $sFont   )

$Co1 = GUICtrlCreateCombo("--- Bitte Wählen ---",10,120,220,33)


GUISetState(@SW_SHOW)
;--- -------------------------------------------------

While Sleep(10)





WEnd



Func _Exit()
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_PenDispose($hPen)
    GUIDelete($hGUI)
    GUIDelete($hDummy)
    Exit
EndFunc   ;==>_Exit

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

This has nothing to do with GDI+ directly. What you did it to created a GDI+ graphic handle and fill it up with a color. This caused  the combo box to be visible as it is.

If you change the background color to 0xFFFFFFFF you will see that the bottom border is "hidden" again.

 

So nothing unsual here.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#5 ·  Posted

so this means a combobox is only normal to see on #FFFFFF

a BUG ? 

Share this post


Link to post
Share on other sites

#6 ·  Posted

It means you're drawing to a foreign object.

It doesn't show without gdiplus startup because you didn't initiate gdiplus therefore didn't draw anything.

Uez is pointing out that it is up to the coder to understand the background colors and draw their data accordingly.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

What you can do is to exclude the area of the controls to the GDI+ canvas:

#include <Date.au3>
#include <string.au3>
#include <file.au3>
#include <array.au3>
#include <MsgBoxConstants.au3>

#include <ColorConstantS.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <FontConstants.au3>

#include <GDIPlus.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>

#include <GUIComboBox.au3>
#include <GUIComboBoxEx.au3>
#include <ButtonConstants.au3>
#include <GuiStatusBar.au3>

#include <Word.au3>

;--- -------------------------------------------------------------------------------

Opt("GUIOnEventMode", 1)
HotKeySet("{ESC}", "_EXIT")

Global $line_old,$send,$xmsg,$AntTime,$CBox, $WaitTime ,$Co1
Global $I1,$I2,$CHECKBOX1,$I3,$CHECKBOX2,$B1,$B2

$ScriptName = "Test"
$ScriptFullName = "Test test"
$ScriptVersion = "1.0"

;MsgBox(0,"info" & $ScriptVersion, @ScriptDir & "\" & @ScriptName,15)

$Workdir    = IniRead(@ScriptDir & "\LCP.ini", "General", "Workdir", "c:\") ;"M:\bwwin\DAT00001\AKTEN\VORLAGEN\"
$GuiSBott   = IniRead(@ScriptDir & "\LCP.ini", "General", "GuiSBott", "100") ;100
$GuiW       = IniRead(@ScriptDir & "\LCP.ini", "General", "GuiW", "400") ;400
$GuiH       = IniRead(@ScriptDir & "\LCP.ini", "General", "Guih", "170") ;170
$WaitTime   = IniRead(@ScriptDir & "\LCP.ini", "General", "WaitTime", "1000") ;3000
$DoIt       = IniRead(@ScriptDir & "\LCP.ini", "General", "DoIt", 1) ;3000


;--- PRÜFUNGEN ob alles da -------------------------------------------------
IF $Doit = 0 Then
    MsgBox(0,$ScriptName & " " & $ScriptVersion & " Info ...",$ScriptFullName & " " & $ScriptVersion & @CRLF& @CRLF & "kann wegen Sperrre nicht ausgeführt werden" & @CRLF & "Bitte versuchen Sie es in einigen Minuten erneut.",15)
    Exit
endIf


if not FileExists($Workdir ) then
     MsgBox(0, $ScriptName & " " & $ScriptVersion & " Info ...", "Verzeichniss " & $Workdir & " nicht verfügbar",30)
     Exit
EndIf
;--- -------------------------------------------------------------------------

$xmsg = ""
$Z = 0


;GDI+ initialisieren, ESC als HotKey festlegen
HotKeySet("{ESC}", "_Exit")

$hGUI = GUICreate($ScriptName & " " & $ScriptVersion & " © by Gerhard Wagner" ,$GuiW, $GuiH, 50, 50 )
;~ GUISetBkColor(0xFFFFFF, $hGUI)
;~ _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 255)
$logoPic = GUICtrlCreatePic(@ScriptDir & "\images\logo.jpg",10,10,222,65)

$MenuWidth = 240
$sFont = "verdana"
$LabelM0 = GUICtrlCreateLabel("Bitte Steuerfile auswählen ...", 10, 100,$MenuWidth-20,20 )
GUICtrlSetBkColor($LabelM0,0x567BA1 )
GUICtrlSetColor($LabelM0,  $COLOR_white)
GUICtrlSetFont ( $LabelM0,10,  $FW_NORMAL, $GUI_FONTITALIC, $sFont   )

$Co1 = GUICtrlCreateCombo("--- Bitte Wählen ---",10,120,220,33)


GUISetState(@SW_SHOW)

_GDIPlus_Startup()

;Graphic-Objekt, Pinsel und Backbuffer erstellen und GUI anzeigen
$hPen = _GDIPlus_PenCreate(0x567BA1, 1) ; Roten Pinsel mit Breite von 4 px.
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)

;exclude controls from GDI+ graphic region
Local $hRegion = _GDIPlus_RegionCreateFromRect(0, 0, $GuiW, $GuiH)
Local $hChild = _WinAPI_GetWindow($hGUI, $GW_CHILD)
Local $aRect
Do
    $aRect = ControlGetPos($hChild, "", 0)
    _GDIPlus_RegionCombineRect($hRegion, $aRect[0], $aRect[1], $aRect[2], $aRect[3], 3)
    $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT)
Until Not $hChild
_GDIPlus_GraphicsSetClipRegion($hGraphics, $hRegion)
_GDIPlus_RegionDispose($hRegion)

;--- MENÜ -------------------------------------------
$hFillBrush = _GDIPlus_BrushCreateSolid(0xFF567BA1)
_GDIPlus_GraphicsFillRect($hGraphics , 0, 0, $MenuWidth, $GuiH,$hFillBrush)

;--- -------------------------------------------------

ControlFocus($hGUI, "", $Co1)

While Sleep(10)





WEnd



Func _Exit()
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_PenDispose($hPen)
    GUIDelete($hGUI)
;~     GUIDelete($hDummy)
    Exit
EndFunc   ;==>_Exit

 

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
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