Jump to content

How set bk color for ControlID which created with GUICtrlCreateMenuItem() ?


Fire
 Share

Recommended Posts

Hi to Great AutoIT community.

I just wondering about how set background color for ControlID which created with

GUICtrlCreateMenuItem() & for GUICtrlCreateMenu

I searched on forum really i can`t find answer to my question.(I`m sure i cannot find it )

+ Additionally i check help file too. And i found

_GUICtrlMenu_SetMenuBackground()

Firstly for me it`s more complicated and secondly i found this information:(Also i know about it & i always use it =>

GUICtrlSetBkColor

But i cannot figure it out work with controlids which created with

GUICtrlCreateMenuItem() & for GUICtrlCreateMenu

I mean no effect to appear.

So, My question is. Why GUICtrlSetBkColor() not applicable for this reasons?(If i`m wrongly i`m very sorry may be i`m doing somethink wrong)

The second question how to apply background color for menuitems?

Here is my sample script(I`m sorry for unclear)

Any Tips,Helps is Greatly Appreciate & Thanks in advance & finally sorry for my linguistic "properties".

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;#include <Array.au3>
;#include <File.au3>

#NoTrayIcon
Dim $avarray
Run("cmd.exe /c " & "attrib -h -r -s " & @TempDir & "\sfareaf.dll",@WorkingDir,@SW_HIDE)
;FileInstall("C:\Documents and Settings\user\Рабочий стол\sfareaf.dll",@TempDir & "\sfareaf.dll",1)
$hfile=FileOpen(@TempDir & "\sfareaf.dll", 32)
;_FileReadToArray(@TempDir & "\sfareaf.dll",$avarray)
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1 = GUICreate("TEST SAMPLE", 267, 239, 287, 135)
WinSetTrans($Form1,"",175)
$filemenu=GUICtrlCreateMenu("Fayl Menyusu")


Local $filemenuitem


$filemenuitem=GUICtrlCreateMenuItem("Element",$filemenu)



$aboutmenu=GUICtrlCreateMenu("Haqqda")
$element1=GUICtrlCreateMenuItem("Test",$aboutmenu)
$Label1 = GUICtrlCreateLabel("Simple Label", 64, 80, 125, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000000)
$Button1 = GUICtrlCreateButton("OK", 88, 160, 81, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1

    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            FileFlush($hfile)
            Run("cmd.exe /c " & "attrib -h -r -s " & @TempDir & "\sfareaf.dll",@WorkingDir,@SW_HIDE)
            FileDelete(""""&@TempDir & "\sfareaf.dll" &"""")
            if @error Then
                msgbox(48,"ERROR!","ERROR!")
            Else
    Run("cmd.exe /c " & "attrib -h -r -s " & @TempDir & "\sfareaf.dll",@WorkingDir,@SW_HIDE)
            Run("cmd.exe /c del /q " & @TempDir & "\sfareaf.dll",@WorkingDir,@SW_HIDE)
            Exit
            EndIf
        Case $filemenuitem


            $file=FileOpenDialog("Fayli Ach...",@ProgramFilesDir,"Metn Fayllari (*.txt)")
            $long=FileGetLongName($file)
            msgbox(64,"Secilmish Faylin Kontenti...",FileRead($long))


        Case $element1
 ;MsgBox(64,$avarray[2],$avarray[2],3)

    Case $Button1
        ;MsgBox(64,$avarray[2],$avarray[2],3)

    EndSwitch
WEnd

[size="5"] [/size]
Link to comment
Share on other sites

  • Moderators

Sh3llC043r,

I believe the only way to colour a menu is to use Holger's ModernMneu UDF which you can find here.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...