dbTalk Databases Forums  

ImageList & Treevie

comp.databases.ms-access comp.databases.ms-access


Discuss ImageList & Treevie in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Phil Stanton
 
Posts: n/a

Default ImageList & Treevie - 10-09-2008 , 05:30 AM






I am using a Treeview type menu sustem and need to load various icons

I have a form called Icons with a MSComctlLib.ImageListCtrl.2 control on it
called ImList

The IconTable holds IconNo and IconName

I use the following code OnOpen of the form which is supposed to load images
stored in a folder which is defined by CoIconPath

Function ImageList_Fill(ByVal ImageList As Object, ByVal IconTableName As
String) As Boolean

On Error GoTo ImageList_Fill_Error

Dim img As ListImage
Dim MyDb As Database
Dim IconTable As Recordset

'*initialise
ImageList_Fill = False

ImList.Object.ImageWidth = 16
ImList.Object.ImageHeight = 16

Set MyDb = CurrentDb()
Set IconTable = MyDb.OpenRecordset(IconTableName, dbOpenDynaset)
With IconTable

' If no icons specified - exit
If .RecordCount = 0 Then GoTo ImageList_Fill_Exit

.MoveFirst
While Not .EOF
' Add Image
Set img = ImageList.ListImages.Add(!IconNo + 1, !IconName, _
LoadPicture(CoIconPath & "\" & !IconName & ".ico"))
'StoredIcon.Picture = img.Picture
MsgBox "Image" & img.Index, vbOKOnly
.MoveNext
Wend

' Success
ImageList_Fill = True

ImageList_Fill_Exit:
.Close
Set IconTable = Nothing
End With

MyDb.Close

Set MyDb = Nothing

DoCmd.Save , Me.Name
Exit Function

ImageList_Fill_Error:
MsgBox Err.Description, vbCritical, "No." & Err.Number
Resume ImageList_Fill_Exit

End Function

The message box comes up 11 times, so I guess that the images are loaded. If
I go back to the form in design view, the InList control shows no images.
Why
How do I display what is held in this control.
If I uncomment out the line StoredIcon.Picture = img.Picture, I get an error
message "Microsoft Access can't open the file '55033946'. This file number
appears different every time

Any help please

Thanks

Phil



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.