Results 1 to 15 of 15

Thread: Is there a property to make the checkboxes on a checked listbox larger?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    Is there a property to make the checkboxes on a checked listbox larger?

    Hi there folks! I am new to checked listboxes, and recently I made the text font larger on the listbox, but is there a property to make the checkboxes larger to go with it?

    Thanks a lot!

  2. #2
    New Member
    Join Date
    Mar 2017
    Location
    Malaysia
    Posts
    10

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    Quote Originally Posted by Justin M View Post
    Hi there folks! I am new to checked listboxes, and recently I made the text font larger on the listbox, but is there a property to make the checkboxes larger to go with it?

    Thanks a lot!
    hi there,

    http://database.ittoolbox.com/groups...-bigger-399496

    try from this link. It works for me on vb6

  3. #3
    Fanatic Member
    Join Date
    Apr 2017
    Posts
    554

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    No, there is no such property. You will probably have to make your own custom listbox user control

  4. #4
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    This may be of interest to you -
    http://www.planet-source-code.com/vb...62733&lngWId=1
    Not sure if checkboxes get bigger with the font increase, but it may still be better than the intrinsic Listbox

    HTH,
    Rob

  5. #5
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    Quote Originally Posted by Justin M View Post
    Hi there folks! I am new to checked listboxes, and recently I made the text font larger on the listbox, but is there a property to make the checkboxes larger to go with it?
    The answer to "making it bigger" (stop giggling) is not larger fonts, etc. but instead raising the DPI setting on the system (or monitor on current Windows versions supporting per-monitor DPI). High DPI poses its own challenges of course but rejecting that as an answer is just trying to buck the tide.

    What you have is a situation where the monitor DPI has increased, but to make legacy coding techniques continue working (sort of) you are telling Windows to keep pretending the monitor has 96 pixels per inch. The result is that everything keeps on "getting smaller" every time you move to a denser monitor.

  6. #6
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    If you substitute a ListView for the ListBox (will look the same), you can make them bigger


    See this project.

    All I did for the proof of concept here, Module1 contains the function 'InitCheckHIML', I simply changed all the 16s to 32s for the ListView (the TreeView I think you'd have to make the font bigger first because they got squished when I tried).

    Code:
    Public Sub InitCheckHIML()
    Dim hIco As Long
    Dim lPos As Long
    
    himlCheck = ImageList_Create(32, 32, ILC_COLOR32 Or ILC_ORIGINALSIZE, 1, 1)
    ImageList_SetIconSize himlCheck, 32, 32
    hIco = ResIconTohIcon("CHK_STD_UNCHKD", 32, 32)
    Call ImageList_AddIcon(himlCheck, hIco)
    Call DestroyIcon(hIco)
    hIco = ResIconTohIcon("CHK_STD_CHKD", 32, 32)
    Call ImageList_AddIcon(himlCheck, hIco)
    Call DestroyIcon(hIco)
    hIco = ResIconTohIcon("CHK_STD_DIS", 32, 32)
    Call ImageList_AddIcon(himlCheck, hIco)
    Call DestroyIcon(hIco)
    hIco = ResIconTohIcon("CHK_EXT_PAR", 32, 32)
    Call ImageList_AddIcon(himlCheck, hIco)
    Call DestroyIcon(hIco)
    hIco = ResIconTohIcon("CHK_EXT_EXP", 32, 32)
    Call ImageList_AddIcon(himlCheck, hIco)
    Call DestroyIcon(hIco)
    hIco = ResIconTohIcon("CHK_EXT_DEF", 32, 32)
    Call ImageList_AddIcon(himlCheck, hIco)
    Call DestroyIcon(hIco)
    hIco = ResIconTohIcon("CHK_EXT_X", 32, 32)
    Call ImageList_AddIcon(himlCheck, hIco)
    Call DestroyIcon(hIco)
    hIco = ResIconTohIcon("CHK_CST_UNCHKD", 32, 32)
    Call ImageList_AddIcon(himlCheck, hIco)
    Call DestroyIcon(hIco)
    hIco = ResIconTohIcon("CHK_CST_CHKD", 32, 32)
    Call ImageList_AddIcon(himlCheck, hIco)
    Call DestroyIcon(hIco)
    
    '---snip---
    Last edited by fafalone; Jul 13th, 2017 at 01:48 AM.

  7. #7
    Frenzied Member
    Join Date
    Jan 2010
    Posts
    1,103

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    Quote Originally Posted by Justin M View Post
    Hi there folks! I am new to checked listboxes, and recently I made the text font larger on the listbox, but is there a property to make the checkboxes larger to go with it?

    Thanks a lot!
    The owner-drawn ListBox can do a custom appearance.

  8. #8
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    Ok so I tested it with the font size changed too, it worked out even better. For the finishing touch I also assigned 32x32 imagelist to the regular icons. To compare, the default sizes can be seen on the TreeView on the right, which wasn't touched.

    This is with 18-point Tahoma:


    Do note though if what you're doing is adjusting for a higher DPI, listen to dilettante, you shouldn't be doing that by changing the font points.

  9. #9
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,130

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    Hi

    you could use a Flexgrid..

    place on a Form.. 1xFlexgrid, 1xListbox, 1xCommandbutton
    Code:
    'set check or remove Check  Cell
    Public Property Let FlexCellChecked(Flex As MSFlexGrid, Row As Long, _
                                        Col As Long, vData As Boolean)
       Dim SaveRow As Long, SaveCol As Long
          With Flex
             .Redraw = False
             'save Position
             SaveRow = .Row
             SaveCol = .Col
             .Row = Row
             .Col = .Col
             If vData Then
                'True
                .Text = "a"
             Else
                'False
                .Text = vbNullString
             End If
             'save again
             .Row = SaveRow
             .Col = SaveCol
             .Redraw = True
          End With
    End Property
    
    'True/False Cell Checked
    Public Property Get FlexCellChecked(Flex As MSFlexGrid, Row As Long, _
                                        Col As Long) As Boolean
       Dim SaveRow As Long, SaveCol As Long
          With Flex
             .Redraw = False
             SaveRow = .Row
             SaveCol = .Col
             .Row = Row
             .Col = .Col
             'Value checked ?
             FlexCellChecked = (.Text = "a")
             .Row = SaveRow
             .Col = SaveCol
             .Redraw = True
          End With
    End Property
    
    Private Sub Command1_Click()
       Dim i As Long
       List1.Clear
          With MSFlexGrid1
             For i = .FixedRows To .Rows - 1
                .Row = i
             List1.AddItem "Row " & i & " Checked: " & FlexCellChecked(MSFlexGrid1, i, 1)
             Next
          End With
    End Sub
    
    Private Sub Form_Load()
       Dim i As Long
          With MSFlexGrid1
             .Rows = 5
             .Cols = 5
             .Col = 1
             .ColAlignment(1) = flexAlignCenterCenter
             .ColWidth(1) = 450
             For i = 0 To .Rows - 1
                .Row = i
                .CellFontName = "Marlett"
                .CellFontSize = 20  '<-- to large ?
                If i = 0 Then
                   .Text = "a"
                End If
             Next
          End With
    End Sub
    
    Private Sub MSFlexGrid1_Click()
          With MSFlexGrid1
             If .Col = 1 Then
                FlexCellChecked(MSFlexGrid1, .Row, .Col) = _
                Not FlexCellChecked(MSFlexGrid1, .Row, .Col)
             End If
          End With
    End Sub
    regards
    Chris

  10. #10
    Addicted Member
    Join Date
    Aug 2017
    Location
    South Africa (in the middle)
    Posts
    160

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    I think the question was about this:

    Name:  Image 009.png
Views: 1966
Size:  10.5 KB

  11. #11
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,733

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    Never thought about such possibility.

    But I could implement such a 'StateImageSize' property to my ListBoxW control.

    So such a property would then apply to a ListBoxW control which 'Style' property is set to '1 - Checkbox' or '2 - Option'.

  12. #12
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,624

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    @Krool---are you referring to Chris, or Inside?

    @Inside---what control is that? Code? Properties?

  13. #13
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,733

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    Quote Originally Posted by SamOscarBrown View Post
    @Krool---are you referring to Chris, or Inside?

    @Inside---what control is that? Code? Properties?
    referring to this topic in general.

    I think Inside made this up (image) to illustrate what this topic is all about.

  14. #14
    Fanatic Member DrUnicode's Avatar
    Join Date
    Mar 2008
    Location
    Natal, Brazil
    Posts
    631

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    AFAIK, if you are rendering with Themes using UxTheme DrawThemeBackground then Check and Option images are locked to 13 pixels.
    Even if you were to grab the 13 pixel image and stretch it, the quality is not that good.

    To get around this you can put larger high quality PNG Check and Option image strips containing all states in a resource file and stretch/shrink them in OwnerDraw controls.

    Here are some high quality Check and Option image strips that you can use to implement this:

    Name:  CheckBoxStrip32.png
Views: 1800
Size:  2.5 KB

    Name:  OptionStrip32.png
Views: 1813
Size:  7.9 KB
    Attached Files Attached Files
    Last edited by DrUnicode; Aug 8th, 2017 at 01:44 PM. Reason: Added Zip

  15. #15
    Addicted Member
    Join Date
    Aug 2017
    Location
    South Africa (in the middle)
    Posts
    160

    Re: Is there a property to make the checkboxes on a checked listbox larger?

    Quote Originally Posted by Krool View Post
    referring to this topic in general.

    I think Inside made this up (image) to illustrate what this topic is all about.
    Yes. Just a quick drawn picture with a few labels.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width