Change size of GUI checkbox and radio button

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
JoeWinograd
Posts: 2198
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Change size of GUI checkbox and radio button

07 Apr 2021, 08:56

Hi Folks,

I'm writing a program that I want to work well for visually impaired users. The program offers different size fonts for use in its GUI dialogs, with my hope that the largest one is helpful to the visually impaired. However, I don't know how (or even if it's possible) to change the size of the checkboxes (created via Gui,Add,Checkbox) and the size of the radio buttons (created via Gui,Add,Radio). I'd like to adjust their sizes based on the font size that the user selects for the text. As it stands now, the checkboxes and radio buttons look very small sitting next to the text, especially when the user selects the largest font size.

Anyone know how to set the checkbox and radio button size? Thanks much, Joe
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Change size of GUI checkbox and radio button

07 Apr 2021, 12:36

AFAIK, the size of controls is related to a user's (whatever) display settings. Besides that, you might be able to use whatever Zoom option. HTH.
User avatar
JoeWinograd
Posts: 2198
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Change size of GUI checkbox and radio button

07 Apr 2021, 13:21

BoBo wrote:the size of controls is related to a user's (whatever) display settings
Not all controls. I haven't tested all of them, but based on those that I did test, all of these are easily sizable: Button, Edit, ListView, Text. Here are screenshots that show the issue:

gui checkbox.png
gui checkbox.png (1.03 KiB) Viewed 1224 times
gui radio.png
gui radio.png (1.09 KiB) Viewed 1224 times

In both cases, the text is sized nicely...large and small. But the checkboxes and the radio buttons are the same size in both cases.
you might be able to use whatever Zoom option
What Zoom option do you mean? Thanks, Joe
User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: Change size of GUI checkbox and radio button

07 Apr 2021, 13:39

This may be more involved than you are looking for, but @Hellbent posted a nice custom button tool. It appears to allow for custom on/off buttons, which I would think could be used for both checkboxes and radio buttons. See the on/off buttons in his second post in that thread.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Change size of GUI checkbox and radio button

07 Apr 2021, 14:11

@JoeWinograd - "But the checkboxes and the radio buttons are the same size in both cases."
Yep, sorry for the confusion "... the size of these controls is related to a user's (whatever) display settings".
Gedacht habe ich's, jedoch nicht geschrieben. :roll: :silent:

Zoom ...
https://support.microsoft.com/en-us/windows/use-magnifier-to-make-things-on-the-screen-easier-to-see-414948ba-8b1c-d3bd-8615-0e5e32204198
https://www.autohotkey.com/boards/viewtopic.php?t=67467
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=24538
User avatar
JoeWinograd
Posts: 2198
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Change size of GUI checkbox and radio button

07 Apr 2021, 15:12

boiler wrote:@Hellbent posted a nice custom button tool
Thanks for the tip! I just spent an hour playing with it...very interesting stuff! But you may be right that it is more involved than I'm looking for...I surely would like a new Option on Gui,Add,Checkbox and Gui,Add,Radio that provides a very simple way to change the size of the box and the circle, perhaps S: Size (in points), same as in the Font sub-command (currently, S is an invalid option on Gui,Add,Checkbox and Gui,Add,Radio, so it's a good choice). Wish List, I suppose. Regards, Joe
User avatar
JoeWinograd
Posts: 2198
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Change size of GUI checkbox and radio button

07 Apr 2021, 15:19

BoBo wrote:Zoom ...
Ah, got it! Not what I'm looking for in this particular program, but I appreciate the idea. Cheers, Joe
User avatar
JoeWinograd
Posts: 2198
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Change size of GUI checkbox and radio button

07 Apr 2021, 17:46

mikeyww wrote:Interesting approach with font here
Yes, very interesting, although it has the issue of requiring the Wingdings font on the system. Also, it uses the SS_ETCHEDFRAME text control style (0x12) to draw a square (for the simulated checkbox), but I'm not aware of one that is a circle (for the simulated radio button). I suppose I could switch all the radio buttons to checkboxes and then write some code that allows only one to be checked at a time (which I would have to do anyway even if there is a circle, since it won't be a "real" radio button).

I did a test with large font and one of my colors...it looks good:

big checkbox VxE.png
big checkbox VxE.png (1020 Bytes) Viewed 1165 times

However, moving to it for all 20+ colors in my program is a whole other story. That said, I appreciate the idea! Regards, Joe
User avatar
JoeWinograd
Posts: 2198
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Change size of GUI checkbox and radio button

08 Apr 2021, 13:38

Update: To solve the issue of needing the Wingdings font, I'm fine with an upper case X in Arial. For example:

big checkbox with Arial X VxE.png
big checkbox with Arial X VxE.png (1.02 KiB) Viewed 1136 times

Regards, Joe
User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Change size of GUI checkbox and radio button

08 Apr 2021, 13:56

Looks good. Thank you, Joe!
teadrinker
Posts: 4326
Joined: 29 Mar 2015, 09:41
Contact:

Re: Change size of GUI checkbox and radio button

08 Apr 2021, 17:47

My exercise with custom checkboxes :)

Code: Select all

Gui, New,, Custom checkbox
Gui, Margin, 20, 20

Gui, Font, s24, Calibri
Gui, Add, Pic, hwndhPic1 w30         ; <——— checkbox will be here, specify at least the width
Gui, Add, Text, hwndhText1 x+0 yp-4 hp, I'm checkbox, click me!
Check1 := new CustomCheckbox(0, hPic1, hText1)

Gui, Add, Pic, hwndhPic2 xm y+10 w48 ; <——— checkbox will be here, specify at least the width
Gui, Add, Text, hwndhText2 x+0 yp+5 hp, I'm another one
Check2 := new CustomCheckbox(1, hPic2, hText2)
Gui, Show
Return

$F1:: MsgBox, % Check1.status        ; 1 or 0
$F2:: Check2.status := !Check2.status

GuiClose() {
   ExitApp
}

class CustomCheckbox
{
   __New(status, hPic, hText) {
      this.hPic := hPic
      WinGetPos,,, W, H, ahk_id %hPic%
      (!W && W := H), (!H && H := W), (!(W && H) && (W := 16, H := 16))
      hBmChecked   := HBitmapFromBase64Image(  GetImage("checked") , W, H )
      hBmUnchecked := HBitmapFromBase64Image( GetImage("unchecked"), W, H )
      this.OnClick := OnClick := ObjBindMethod(this, "_OnClickCheckbox", hBmChecked, hBmUnchecked)
      this._status := !status
      this.OnClick.Call()
      GuiControl, +g, %hPic%, % OnClick
      GuiControl, +g, %hText%, % OnClick
   }
   status[] {
      get {
         Return this._status
      }
      set {
         if (this._status != !!value)
            this.OnClick.Call()
         Return !!value
      }
   }
   _OnClickCheckbox(hBitmap1, hBitmap0) {
      this._status := !this._status
      t := this._status
      GuiControl,, % this.hPic, % "HBITMAP:*" . hBitmap%t%
   }
}

HBitmapFromBase64Image(base64, width, height) {
   size := CryptStringToBinary(base64, data)
   Return GetBitmapFromData(&data, size, width, height)
}

GetBitmapFromData(pData, size, width, height) {
   pIStream := DllCall("Shlwapi\SHCreateMemStream", "Ptr", pData, "UInt", size, "Ptr")
   GDIp := new GDIplus
   pBitmap := GDIp.CreateBitmapFromStream(pIStream)
   GDIp.GetImageDimensions(pBitmap, W, H)
   ObjRelease(pIStream)
   if !(width = W && height = H) {
      pNewBitmap := Gdip.CreateBitmap(width, height)
      G := Gdip.GraphicsFromImage(pNewBitmap)
      Gdip.SetInterpolationMode(G, HighQualityBicubic := 7)
      Gdip.DrawImage(G, pBitmap, 0, 0, width, height, 0, 0, W, H)
      Gdip.DisposeImage(pBitmap), Gdip.DeleteGraphics(G)
      pBitmap := pNewBitmap
   }
   hBitmap := GDIp.CreateHBITMAPFromBitmap(pBitmap)
   GDIp.DisposeImage(pBitmap)
   Return hBitmap
}

CryptStringToBinary(string, ByRef outData, formatName := "CRYPT_STRING_BASE64")
{
   static formats := { CRYPT_STRING_BASE64: 0x1
                     , CRYPT_STRING_HEX:    0x4
                     , CRYPT_STRING_HEXRAW: 0xC }
   fmt := formats[formatName]
   chars := StrLen(string)
   if !DllCall("Crypt32\CryptStringToBinary", "Str", string, "UInt", chars, "UInt", fmt
                                            , "Ptr", 0, "UIntP", bytes, "UIntP", 0, "UIntP", 0)
      throw "CryptStringToBinary failed. LastError: " . A_LastError
   VarSetCapacity(outData, bytes)
   DllCall("Crypt32\CryptStringToBinary", "Str", string, "UInt", chars, "UInt", fmt
                                        , "Str", outData, "UIntP", bytes, "UIntP", 0, "UIntP", 0)
   Return bytes
}

class GDIplus  {
   __New() {
      if !DllCall("GetModuleHandle", "Str", "gdiplus", "Ptr")
         DllCall("LoadLibrary", "Str", "gdiplus")
      VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
      DllCall("gdiplus\GdiplusStartup", "UPtrP", pToken, "Ptr", &si, "Ptr", 0)
      this.token := pToken
   }
   __Delete()  {
      DllCall("gdiplus\GdiplusShutdown", "Ptr", this.token)
      if hModule := DllCall("GetModuleHandle", "Str", "gdiplus", "Ptr")
         DllCall("FreeLibrary", "Ptr", hModule)
   }
   GraphicsFromImage(pBitmap) {
      DllCall("gdiplus\GdipGetImageGraphicsContext", "Ptr", pBitmap, "PtrP", pGraphics)
      return pGraphics
   }
   CreateHBITMAPFromBitmap(pBitmap, Background=0xffffffff) {
      DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", "Ptr", pBitmap, "PtrP", hbm, "Int", Background)
      return hbm
   }
   CreateBitmapFromStream(pIStream) {
      DllCall("gdiplus\GdipCreateBitmapFromStream", "Ptr", pIStream, "PtrP", pBitmap)
      Return pBitmap
   }
   CreateBitmap(Width, Height, Format=0x26200A) {
       DllCall("gdiplus\GdipCreateBitmapFromScan0", "Int", Width, "Int", Height, "Int", 0, "Int", Format, "Ptr", 0, "PtrP", pBitmap)
       Return pBitmap
   }
   GetImageDimensions(pBitmap, ByRef Width, ByRef Height) {
      DllCall("gdiplus\GdipGetImageWidth", "Ptr", pBitmap, "UIntP", Width)
      DllCall("gdiplus\GdipGetImageHeight", "Ptr", pBitmap, "UIntP", Height)
   }
   SetInterpolationMode(pGraphics, InterpolationMode) {
      return DllCall("gdiplus\GdipSetInterpolationMode", "Ptr", pGraphics, "Int", InterpolationMode)
   }
   DrawImage(pGraphics, pBitmap, dx, dy, dw, dh, sx, sy, sw, sh)  {
      Return DllCall("gdiplus\GdipDrawImageRectRect", "Ptr", pGraphics, "Ptr", pBitmap
                                                    , "Float", dx, "Float", dy, "Float", dw, "Float", dh
                                                    , "Float", sx, "Float", sy, "Float", sw, "Float", sh
                                                    , "Int", 2, "Ptr", 0, "Ptr", 0, "Ptr", 0)
   }
   DeleteGraphics(pGraphics) {
      return DllCall("gdiplus\GdipDeleteGraphics", "Ptr", pGraphics)
   }
   DisposeImage(pBitmap)  {
      return DllCall("gdiplus\GdipDisposeImage", "Ptr", pBitmap)
   }
}

GetImage(name) {
   ImgChecked = 
   (LTrim Join
      iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJC
      i4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwr
      IsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgt
      ADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62
      Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUc
      z5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+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VX18f3dzcFPIAMCLC2dnZN2NjY4fpyAwMDKBYLAIAGGNgjCXzbAT1mJVSCkqplnkcx4jjOJkDgJQSjUajU3awXM9A2vnJyUnc
      3t7anHPmeR7jnDPXddvkOE6bbNtOZFlWojxGROzw8PC7tHPT09Pk+353gM3NzZ/1xvz8/NtKpcKGhoaU53nwPA+c82TknMN13TbZtg3LspJRS0cuGzVt2eOWZf10fn7+RB8/OTmB67pPuwJsbGy8
      1Bu7u7vJxbVaDdVqtaPTjuPAcRzYtp3IcZwWx7ulWzrl0ucxxmBZ1tvT09Nf9HlXV1c/dgNgzQcnd84BwMTERFtuK6VwcXHxr7wZhRBDnPPbPH59EsD/YYyxXH6ZL7EBMAAGwAAYgIdozETAABgA
      A2AADMBjBiATAQNgAAyAATAAnwTQ39+P3t5eXF5ePgoAR09KpRIA4O7uDuVyGVEUAXjXfJBSQgiBnp6e3Df2fb+lAg20ltN1Jdt1XQghsLW1hdnZWV31fqGv4Zx3ByiVSqjX66jX6wDAAURBECQA
      QogE4v7+HlLKpMsipYRSKtmXrlh3KrGnAbJ9AyJCuVzG9vY21tfXf9X7j4+PX3dNobW1te/1RqFQCAEgDEOEYQghBKIoghCipTWUbR11qvPrVe40zyrdkorj+NudnZ0vtE/j4+OvugLMzc0lhEEQ
      gDFGURQtRVGUQOgIaIj0amf/qtDJwQ85r1e+OX6llKqNjIzs6HstLi6eABDdf/a9d4IekoaHhyl3m5WIEAQBXNd9EM5PTU39nsd5Inr/Gm2mC1tZWXk+ODj4J4CWHli69/Vf2czMzN7e3l5BSvni
      o16jRIQwDDXIm+Xl5We+73+9urr6pZRSAVAAFBEpaje9GtS8F6Uqa+mRAbDYu1Vwmt8gm3Nu12o12t/f/2NhYeG3RqOR9I/z2F8DACea6T228rt1AAAAAElFTkSuQmCC
   )
   Return Img%name%
}
User avatar
JoeWinograd
Posts: 2198
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Change size of GUI checkbox and radio button

08 Apr 2021, 19:16

teadrinker wrote:My exercise with custom checkboxes
Hi teadrinker,
That is an awesome piece of code! The bitmap checkmark is very clever! Works perfectly here:

big checkbox Arial teadrinker.png
big checkbox Arial teadrinker.png (1.83 KiB) Viewed 1090 times

The issue will be integrating it into the large program that we've discussed in another thread. Btw, I've been using your code since my last post there and, as promised, I'll be back with an update for you, but I'm still experimenting with it...has proven to be a very sticky wicket. Regards, Joe
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Change size of GUI checkbox and radio button

12 Apr 2021, 14:45

@boiler

The switch seen here isn't part of the button class. It is an unrelated control that I used in that project. That image was just meant to show the buttons in a completed project and not just some random demo window with lots of buttons placed here and there.

Unfortunately I haven't had a reason to design any new switches or radios in quite some time and none of the ones that I do have were created with scalable dimensions like the buttons are. They were all designed for a specific project and the size is hard coded for that projects needs.

I do have the graphics available as gdip drawing functions (Image in code form) if interested.

Here is a small sample of some of my custom gui control graphics. (All created using gdip and my bitmap maker)
.
20210412152620.png
20210412152620.png (149.27 KiB) Viewed 1042 times
Here is an example of the code. (this is for one of the yellow switches)

Code: Select all

HB_BITMAP_MAKER(){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap := Gdip_CreateBitmap( 59 , 22 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 4 )
	Brush := Gdip_BrushCreateSolid( "0xFF2F2F2F" ) , Gdip_FillRectangle( G , Brush , -1 , -1 , 60 , 30 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF1F1F1F" ) , Gdip_FillRoundedRectangle( G , Brush , 2 , 4 , 54 , 15 , 5 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF262626" ) , Gdip_FillRoundedRectangle( G , Brush , 3 , 5 , 52 , 13 , 5 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 2 , 5 , 26 , 13 , "0xFFC9B880" , "0xFF3E3623" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 27 , 5 , 28 , 13 , 5 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 2 , 5 , 27 , 11 , "0xFFF3CC67" , "0xFFD7A832" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 28 , 6 , 26 , 11 , 5 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 11 , 9 , 2 , 5 , "0xFF7C6539" , "0xFFC4A048" , 1 , 1 ) , Gdip_FillRectangle( G , Brush , 36 , 10 , 2 , 2 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 11 , 9 , 2 , 5 , "0xFF7C6539" , "0xFFC4A048" , 1 , 1 ) , Gdip_FillRectangle( G , Brush , 40 , 10 , 2 , 2 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 11 , 9 , 2 , 5 , "0xFF393728" , "0xFF9C8849" , 1 , 1 ) , Gdip_FillRectangle( G , Brush , 44 , 10 , 2 , 2 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF959595" ) , Gdip_TextToGraphics( G , "ON" , "s8 Center vCenter Bold c" Brush " x-13 y1" , "Segoe UI" , 59 , 22 ) , Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}
User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: Change size of GUI checkbox and radio button

12 Apr 2021, 17:06

I see. Thanks, @Hellbent. In any case, that’s a nice array of control graphics.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Lamron750 and 249 guests