Jump to content

Checkboxes, overlay icons and state images in ListViews


LarsJ
 Share

Recommended Posts

Many thanks LarsJ. I've often struggled often getting it to work and never managed to get overlay icons to work. Your concise expanations and demos will be a big help the next time I need to use these. The sccreen shots are a great help with a topic such as this so we can see what the output should look like.

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

  • 3 weeks later...
Link to comment
Share on other sites

  • 2 years later...

You cannot add 3 icons in a single listview cell with the techniques used here. But I'm pretty sure it's possible. One way is to use custom draw in the post paint stage and add the icons with GDI/GDI+ functions. Another way is to create an owner drawn listview and again add the icons with GDI/GDI+ functions. But none of the techniques are completely trivial. If you also want to click the icons one at a time, you'll need pretty much code.
 

A small advertisement: My next project will be published in this forum the first coming weekend (in four days). Don't miss the Examples forum this weekend.

Link to comment
Share on other sites

5 hours ago, LarsJ said:

You cannot add 3 icons in a single listview cell with the techniques used here. But I'm pretty sure it's possible. One way is to use custom draw in the post paint stage and add the icons with GDI/GDI+ functions. Another way is to create an owner drawn listview and again add the icons with GDI/GDI+ functions. But none of the techniques are completely trivial. If you also want to click the icons one at a time, you'll need pretty much code.
 

A small advertisement: My next project will be published in this forum the first coming weekend (in four days). Don't miss the Examples forum this weekend.

as I know, ICO is a square  Like 16*16

Is this possible,Put three ICOs into one ICO

Then put this ICO into a single listview cell

Like a rectangular ICO

Link to comment
Share on other sites

Creating an image from 3 icons and displaying the image in a listview cell is certainly possible, and it should not be too hard.

Link to comment
Share on other sites

But I can only make the icon 16*16 or 24*24

I cannot change the icon to 48*16

I tried to turn three icons into one icon

Then put this ICO into a single listview cell

It still displays an icon with a size of 16*16

Is there any sample of ListView with long icons?

Link to comment
Share on other sites

It's much easier than you think:

#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>

Example()

Func Example()
  Local $hImage, $idListview

  GUICreate("ListView Create Solid BitMap", 400, 300)
  $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
  GUISetState(@SW_SHOW)

  ; Load images
  $hImage = _GUIImageList_Create( 48, 16 )
  _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($idListview), 0xFF0000, 48, 16))
  _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($idListview), 0x00FF00, 48, 16))
  _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($idListview), 0x0000FF, 48, 16))
  _GUICtrlListView_SetImageList($idListview, $hImage, 1)

  ; Add columns
  _GUICtrlListView_AddColumn($idListview, "Items", 100)

  ; Add items
  _GUICtrlListView_AddItem($idListview, "Item 1", 0)
  _GUICtrlListView_AddItem($idListview, "Item 2", 1)
  _GUICtrlListView_AddItem($idListview, "Item 3", 2)

  ; Loop until the user exits.
  Do
  Until GUIGetMsg() = $GUI_EVENT_CLOSE
  GUIDelete()
EndFunc   ;==>Example

 

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