Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Win11 DarkMod and Form/RadioGroup/GroupBox/CheckBox

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 80

PostPosted: Wed Mar 27, 2024 10:33 am    Post subject: Win11 DarkMod and Form/RadioGroup/GroupBox/CheckBox Reply with quote

Hi.

I don't know how to describe my request exactly, so I have created a form that hopefully shows my questions. It is important that I use the dark mode in Windows 11.
- The RadioGroup font color of the items is always black and can't change.
- The CeckBox font color is always set by the windows dark mode and cannot be changed.
- The border colors of RadioGroup and GroupBox are different.
- The background color of the form header bar always remains the same.

How can I change all these colors?

Code:
iScale = getScreenDPI()/96

 F01 = createForm(false)
 F01.caption = "How do i change this border backgroundcolor"
 F01.color = 0xF0F0F0
 F01.Font.Color = 0x0
 F01.width = iScale * 450
 F01.height = iScale * 448
 F01.align = "alNone"
 F01.enabled = true
 F01.ShowInTaskBar = "stAlways"
 F01.Position = "poDesktopCenter"

 RG01 = createRadioGroup(F01)
 RG01.caption = "RG01"
 RG01.Font.Color = 0x0000FF --no effect
 RG01.left = iScale * 4
 RG01.top = iScale * 4
 RG01.width = iScale * 200
 RG01.height = iScale * 60
 RG01.align = "alNone"
 RG01.enabled = true
 RG01.visible = true
 RG01Items = radiogroup_getItems(RG01)
 strings_add(RG01Items,"Can't change font")
 strings_add(RG01Items,"and border color")

 GB01 = createGroupBox(F01)
 GB01.caption = "GB01"
 GB01.left = iScale * 4
 GB01.top = iScale * 234
 GB01.width = iScale * 386
 GB01.height = iScale * 92 + ((iScale - 1) * 12)
 GB01.align = "alNone"
 GB01.enabled = true
 GB01.visible = true

 CB01 = createCheckBox(GB01)
 CB01.caption = "Can't change font"
 CB01.Color = 0x00FF00 --no effect
 CB01.Font.Color = 0x00FF00 --no effect
 CB01.left = iScale * 4
 CB01.top = iScale * 0
 CB01.width = iScale * 192
 CB01.height = iScale * 19
 CB01.align = "alNone"
 CB01.enabled = true
 CB01.visible = true

 CB02 = createCheckBox(GB01)
 CB02.caption = "and border color"
 CB02.Color = 0xFF0000 --no effect
 CB02.Font.Color = 0xFF0000 --no effect
 CB02.left = iScale * 4
 CB02.top = iScale * 26
 CB02.width = iScale * 192
 CB02.height = iScale * 19
 CB02.align = "alNone"
 CB02.enabled = true
 CB02.visible = true

 L01 = createLabel(GB01)
 L01.caption = "The bordercolor of GroupBox\nand CheckBox not the same"
 L01.left = iScale * 200
 L01.top = iScale * 4
 L01.width = iScale * 137
 L01.height = iScale * 15
 L01.align = "alNone"
 L01.enabled = true
 L01.visible = true

 F01.visible = true


Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1260

PostPosted: Wed Mar 27, 2024 6:36 pm    Post subject: This post has 1 review(s) Reply with quote

I don't know if results will be obtained for radio boxes, checkboxes and borders.

You can edit the code below in a more practical way.

Code:

iScale = getScreenDPI()/96

 F01 = createForm(false)
 F01.caption = "How do i change this border backgroundcolor"
 F01.color = 0xF0F0F0
 F01.Font.Color = 0x0
 F01.width = iScale * 450
 F01.height = iScale * 448
 F01.align = "alNone"
 F01.enabled = true
 F01.ShowInTaskBar = "stAlways"
 F01.Position = "poDesktopCenter"

 RG01 = createRadioGroup(F01)
 RG01.Name = "RG01"
 RG01.left = iScale * 4
 RG01.top = iScale * 4
 RG01.width = iScale * 200
 RG01.height = iScale * 60
 RG01.align = "alNone"
 RG01.enabled = true
 RG01.visible = true
 RG01Items = radiogroup_getItems(RG01)
 strings_add(RG01Items,"Can't change font")
 strings_add(RG01Items,"and border color")

 GB01 = createGroupBox(F01)
 GB01.Name = "GB01"
 GB01.left = iScale * 4
 GB01.top = iScale * 234
 GB01.width = iScale * 386
 GB01.height = iScale * 92 + ((iScale - 1) * 12)
 GB01.align = "alNone"
 GB01.enabled = true
 GB01.visible = true

 CB01 = createCheckBox(GB01)
 CB01.Name = "CB01"
 CB01.caption = "Can't change font"
 CB01.left = iScale * 4
 CB01.top = iScale * 0
 CB01.width = iScale * 192
 CB01.height = iScale * 19
 CB01.align = "alNone"
 CB01.enabled = true
 CB01.visible = true

 CB02 = createCheckBox(GB01)
 CB02.Name="CB02"
 CB02.caption = "and border color"
 CB02.left = iScale * 4
 CB02.top = iScale * 26
 CB02.width = iScale * 192
 CB02.height = iScale * 19
 CB02.align = "alNone"
 CB02.enabled = true
 CB02.visible = true

 L01 = createLabel(GB01)
 L01.Name = "L01"
 L01.caption = "The bordercolor of GroupBox\nand CheckBox not the same"
 L01.left = iScale * 200
 L01.top = iScale * 4
 L01.width = iScale * 137
 L01.height = iScale * 15
 L01.align = "alNone"
 L01.enabled = true
 L01.visible = true

 F01.Show()

control_setFontColor1=(function(s,c)
executeCodeLocalEx('uxtheme.SetWindowTheme', s.handle, "", "")
s.Font.Color = c
end)

for i = 0, F01.ComponentCount - 1 do
   if F01.Component[i].ComponentCount>0 then
     control_setFontColor1(F01.Component[i],0)
     print(F01.Component[i].Name)
     obj = F01.Component[i]
     for i = 0, obj.ComponentCount - 1 do
       control_setFontColor1(obj.Component[i],0)
       print(">> "..obj.Component[i].Name)
     end
   else
     control_setFontColor1(F01.Component[i],0)
     print(F01.Component[i].Name)
   end
end

--CB01.Color = 0x00FF00
--CB02.Color = 0xFF0000
RG01.Color = 0xffff00
GB01.Color = 0xFFFF00

CB01.Font.Color = 0x101FA0
CB02.Font.Color = 0x885090
RG01.Font.Color = 0x0000FF
GB01.Font.Color = 0xff0000
RG01.RadioButton0.Font.Color = 0x885090



ek1.PNG
 Description:
 Filesize:  18.52 KB
 Viewed:  724 Time(s)

ek1.PNG



_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 80

PostPosted: Fri Mar 29, 2024 6:28 am    Post subject: Reply with quote

It seems that the Windows dark mode is the problem. When I switch to light mode I get the same result as you. But when I run the dark mode I get the following result:



The colors of CB01 and CB02 remain white and the border of GB01 also remains black. Is it possible that this is a cheatengine default at dark mode?
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Fri Mar 29, 2024 9:20 am    Post subject: Reply with quote

sir-gunny wrote:
It seems that the Windows dark mode is the problem. When I switch to light mode I get the same result as you. But when I run the dark mode I get the following result:



The colors of CB01 and CB02 remain white and the border of GB01 also remains black. Is it possible that this is a cheatengine default at dark mode?


Essentially what the above does is remove Windows' theme from the controls. From there you can assign your own colours to match the desired result.
Back to top
View user's profile Send private message
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 80

PostPosted: Fri Mar 29, 2024 12:45 pm    Post subject: Reply with quote

Thanks for the help Smile

Code:
iScale = getScreenDPI()/96

 F01 = createForm(false)
 F01.caption = "How do i change this border backgroundcolor"
 F01.color = 0xF0F0F0
 F01.Font.Color = 0x0
 F01.width = iScale * 450
 F01.height = iScale * 448
 F01.align = "alNone"
 F01.enabled = true
 F01.ShowInTaskBar = "stAlways"
 F01.Position = "poDesktopCenter"

 CB01 = createCheckBox(F01)
 executeCodeLocalEx('uxtheme.SetWindowTheme', CB01.handle, "", "")
 CB01.Name = "CB01"
 CB01.caption = "Can't change font"
 CB01.left = iScale * 4
 CB01.top = iScale * 0
 CB01.width = iScale * 192
 CB01.height = iScale * 19
 CB01.align = "alNone"
 CB01.enabled = true
 CB01.visible = true
 CB01.Font.Color = 0xFF0000

 F01.Show()


If the dark mode is used in Windows 11, "executeCodeLocalEx('uxtheme.SetWindowTheme', CB01.handle, "", "")" does not work with a CheckBox at my system.

I have found a workaround. Check "Disable Dark Mode support". Then the command works fine.

Does anyone know how to change the background color of the "window(form)header"?

Edit: change uncheck to check.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1260

PostPosted: Fri Mar 29, 2024 3:36 pm    Post subject: Reply with quote

sir-gunny wrote:
...
Does anyone know how to change the background color of the "window(form)header"?


I'd rather design it myself.
You can draw a Trainer on a panel or image.

It doesn't have to be square.
Just the image you put in the background can determine the entire template.
It could also be a ball or a star.

Ek1:
Code:
iScale = getScreenDPI()/96

if F01 then F01.Destroy() F01=nil end

 F01 = createForm(false)
 F01.caption = "How do i change this border backgroundcolor"
 F01.color = 0xF0F0F0
 F01.Font.Color = 0x0
 F01.width = iScale * 450
 F01.height = iScale * 450
 F01.align = "alNone"
 F01.enabled = true
 F01.BorderStyle="bsNone"
 F01.ShowInTaskBar = "stAlways"
 F01.Position = "poDesktopCenter"

 F01.PopupMode=0 -- 1 or 2 ?

 -- Transparent form ...
F01.setLayeredAttributes(0x000100, 255, LWA_COLORKEY | LWA_ALPHA )
F01.Color=0x000100
----------------------- DragTT1 -----
DragTT1=createPanel(F01)
DragTT1.AutoSize=false
DragTT1.height=34*iScale DragTT1.width=F01.width DragTT1.left=0*iScale DragTT1.top=0*iScale
DragTT1.caption="-:-  Your  Trainer  Title  -:-"
DragTT1.Cursor = -22 DragTT1.Color=15321797
DragTT1.Font.Style="fsBold" DragTT1.Font.Size=14*iScale
DragTT1.OnMouseDown = function() F01.DragNow() end
-----------------------
----------------------- MN01 -----
MN01=createPanel(DragTT1) -- Panel .. Button .. Image?
MN01.AutoSize=false
MN01.height=24*iScale MN01.width=30*iScale MN01.left=5*iScale MN01.top=5*iScale
-----------------------
----------------------- MN02 -----
MN02=createPanel(DragTT1)
MN02.AutoSize=false
MN02.height=24*iScale MN02.width=30*iScale MN02.left=415*iScale MN02.top=5*iScale
-----------------------
----------------------- BACK01 -----
BACK01=createPanel(F01)
BACK01.AutoSize=false
BACK01.height=410*iScale BACK01.width=F01.width BACK01.left=0*iScale
BACK01.top=36*iScale -- DragTT1.Top + DragTT1.height + 1 = BACK01.top ( - F01.height - 5 = BACK01.height )
BACK01.caption=""
--BACK01.Cursor = -22
BACK01.Color=clDefault --15321797
BACK01.Font.Style="fsBold" BACK01.Font.Size=14*iScale
BACK01.OnMouseDown = function() F01.DragNow() end
-----------------------
----------------------------------------------------------
-------------------- Panels Mouse Effect ----------------

function setBtnEffect(item,text,clr,fntsz)
item.caption=text
item.Color=clr
item.Font.Size=fntsz
item.Font.Style="fsBold"
item.BevelWidth=2
item.Cursor = -21
item.OnMouseMove=function() item.BevelColor="0x5D3B35" end
item.OnMouseLeave=function() item.BevelColor=clDefault end
end
----------------------------------------------------------
----------------------------------------------------------
setBtnEffect(MN01,"-",8882055,18*iScale)
setBtnEffect(MN02,"X",8882055,14*iScale)

----------------------------------------------------------
----------------------------------------------------------

MN01.OnClick=function()
F01.WindowState = "wsMinimized"
end

MN02.OnClick=function()
--  closeCE()
--  return caFree
F01.Close()
end

 CB01 = createCheckBox(BACK01)
 executeCodeLocalEx('uxtheme.SetWindowTheme', CB01.handle, "", "")
 CB01.Name = "CB01"
 CB01.caption = "Can't change font"
 CB01.left = iScale * 4
 CB01.top = iScale * 0
 CB01.width = iScale * 192
 CB01.height = iScale * 19
 CB01.align = "alNone"
 CB01.enabled = true
 CB01.visible = true
 CB01.Font.Color = 0xFF0000

 F01.Show()


Ek2:
Code:
iScale = getScreenDPI()/96

if F01 then F01.Destroy() F01=nil end

 F01 = createForm(false)
 F01.caption = "How do i change this border backgroundcolor"
 F01.color = 0xF0F0F0
 F01.Font.Color = 0x0
 F01.width = iScale * 420
 F01.height = iScale * 420
 F01.align = "alNone"
 F01.enabled = true
 F01.BorderStyle="bsNone"
 F01.ShowInTaskBar = "stAlways"
 F01.Position = "poDesktopCenter"

 F01.PopupMode=0 -- 1 or 2 ?

 -- Transparent form ...
F01.setLayeredAttributes(0x000100, 255, LWA_COLORKEY | LWA_ALPHA )
F01.Color=0x000100

DragTT1.OnMouseDown = function() F01.DragNow() end
-----------------------

FrmImg1 = createImage(F01)
FrmImg1.Left=0*iScale FrmImg1.Height=400*iScale FrmImg1.Top=0*iScale FrmImg1.Width=400*iScale
FrmImg1.Stretch=true FrmImg1.Visible=true
FrmImg1.picture.loadFromStream(findTableFile("aaa1.png").stream) -- add file ..
FrmImg1.OnMouseDown=function() F01.DragNow() end
----------------------- MN01 -----
MN01=createPanel(F01) -- Panel .. Button .. Image?
MN01.AutoSize=false
MN01.height=24*iScale MN01.width=30*iScale MN01.left=100*iScale MN01.top=5*iScale
-----------------------
----------------------- MN02 -----
MN02=createPanel(F01)
MN02.AutoSize=false
MN02.height=24*iScale MN02.width=30*iScale MN02.left=270*iScale MN02.top=5*iScale
-----------------------
----------------------------------------------------------
-------------------- Panels Mouse Effect ----------------

function setBtnEffect(item,text,clr,fntsz)
item.caption=text
item.Color=clr
item.Font.Size=fntsz
item.Font.Style="fsBold"
item.BevelWidth=2
item.Cursor = -21
item.OnMouseMove=function() item.BevelColor="0x5D3B35" end
item.OnMouseLeave=function() item.BevelColor=clDefault end
end
----------------------------------------------------------
----------------------------------------------------------
setBtnEffect(MN01,"-",8882055,18*iScale)
setBtnEffect(MN02,"X",8882055,14*iScale)

----------------------------------------------------------
----------------------------------------------------------

MN01.OnClick=function()
F01.WindowState = "wsMinimized"
end

MN02.OnClick=function()
--  closeCE()
--  return caFree
F01.Close()
end

 CB01 = createCheckBox(F01)
 executeCodeLocalEx('uxtheme.SetWindowTheme', CB01.handle, "", "")
 CB01.Name = "CB01"
 CB01.caption = "Can't change font "
 CB01.left = iScale * 80
 CB01.top = iScale * 80
 CB01.width = iScale * 192
 CB01.height = iScale * 19
 CB01.align = "alNone"
 CB01.enabled = true
 CB01.visible = true
 CB01.Font.Color = 0xFF0000

 CB01.Color = clNone -- no transparent .. or color ..

 F01.Show()



ek2.PNG
 Description:
 Filesize:  116.3 KB
 Viewed:  589 Time(s)

ek2.PNG



ek1.PNG
 Description:
 Filesize:  18.4 KB
 Viewed:  591 Time(s)

ek1.PNG



_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 80

PostPosted: Mon Apr 01, 2024 2:49 am    Post subject: Reply with quote

Thanks. I try it. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites