msflexgrid and icon

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

msflexgrid and icon

Post by sal21 »

Code: Select all

Private Sub MSFlexGrid1_Click()

    With Me.MSFlexGrid1
        COLONNA = .Col
        RIGA = .Row
        .TextMatrix(RIGA, COLONNA) = "1 "
        .CellAlignment = flexAlignCenterCenter
        Set .CellPicture = LoadPicture(App.Path & "\IMG\" & "OMBRELLONE_ROSSO.jpg")
        Me.LCOLONNA.Caption = COLONNA
        Me.LRIGA.Caption = RIGA
    End With

End Sub
i need to add an icon near the "1 "...

for example 1 icon

is this correct?

and instead to call the icon from dir i just have in imagelist with index =1, how tom use imagelist?

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: msflexgrid and icon

Post by HansV »

Perhaps

Code: Select all

        Set .CellPicture = Me.ImageList1.ListImages(1).Picture
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Re: msflexgrid and icon

Post by sal21 »

HansV wrote:
29 Aug 2021, 15:54
Perhaps

Code: Select all

        Set .CellPicture = Me.ImageList1.ListImages(1).Picture
NICE...

but for first part of question regard "1 "?

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: msflexgrid and icon

Post by HansV »

I don;t think you can specify the position of the icon.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Re: msflexgrid and icon

Post by sal21 »

HansV wrote:
29 Aug 2021, 17:56
I don;t think you can specify the position of the icon.
OK

User avatar
SpeakEasy
4StarLounger
Posts: 536
Joined: 27 Jun 2021, 10:46

Re: msflexgrid and icon

Post by SpeakEasy »

Well, you can, up to point, using the FlexGrid's .CellPictureAlignment property.

If you need more control than this, then you probably need to be looking at one of the alternative FlexGrid controls (such as VBFlexGrid), or be looking at Owner Draw techniques.