powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Microsoft Access [игнор отключен] [закрыт для гостей] / Как динамически заталкивать в ImageList картинку из рекордсета (поле типа image (MSSQL))?????
2 сообщений из 2, страница 1 из 1
Как динамически заталкивать в ImageList картинку из рекордсета (поле типа image (MSSQL))?????
    #32336536
Самовар
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Как динамически заталкивать в ImageList картинку из рекордсета (поле типа image (MSSQL))?????
...
Рейтинг: 0 / 0
Как динамически заталкивать в ImageList картинку из рекордсета (поле типа image (MSSQL))?????
    #32336616
Kriven
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Видел на днях вот такую функцию:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
'функция создает и заполняет ImageList из таблицы и из файлов
Public Function LoadIconList() As Boolean
Dim rst As ADODB.Recordset
Dim fnum As Long
Dim bytPic() As Byte
Dim i As Long
Dim obj As Object
Dim strTemp As String
Dim strTemp1 As String

    Set rst = New ADODB.Recordset
    With rst
        .ActiveConnection = CurrentProject.Connection
        .LockType = adLockReadOnly
        .CursorLocation = adUseClient
        .CursorType = adOpenKeyset
        .Source =  "SELECT * FROM Icons" 
        .Open
    End With
    Set rst.ActiveConnection = Nothing
    
    Set MyImageList = Nothing
    If MyImageList Is Nothing = True Then Set MyImageList = CreateObject( "MSComctlLib.ImageListCtrl" )
    With MyImageList
        If .ListImages.Count =  0  Then
            .ImageHeight =  16 
            .ImageWidth =  16 
            .UseMaskColor = True
        End If
    End With
    For i =  0  To rst.RecordCount -  1 
        bytPic() = rst.Fields( "Image" ).GetChunk(rst.Fields( "Image" ).ActualSize)
        fnum = FreeFile
        Open CurrentProject.Path &  "\tempicon.dat"  For Binary As #fnum
        Put #fnum,  1 , bytPic()
        Close #fnum
        Set obj = MyImageList.ListImages.Add(, rst!Name.Value, LoadPicture(CurrentProject.Path &  "\tempicon.dat" ))
        obj.Tag = rst!TYP
        rst.MoveNext
        Kill CurrentProject.Path &  "\tempicon.dat" 
    Next i
    rst.Close
    Set rst = Nothing
    
    strTemp = Dir(CurrentProject.Path &  "\*.ico" )
    While Len(strTemp) >  0 
        strTemp1 = Right(strTemp, Len(strTemp) - InStrRev(strTemp,  "\" ))
        strTemp1 = Left(strTemp1, Len(strTemp1) -  4 )
        Set obj = MyImageList.ListImages.Add(, strTemp1, LoadPicture(CurrentProject.Path &  "\"  & strTemp))
        obj.Tag =  "иконка на диске" 
        strTemp = Dir()
    Wend
    strTemp = Dir(CurrentProject.Path &  "\*.bmp" )
    While Len(strTemp) >  0 
        strTemp1 = Right(strTemp, Len(strTemp) - InStrRev(strTemp,  "\" ))
        strTemp1 = Left(strTemp1, Len(strTemp1) -  4 )
        Set obj = MyImageList.ListImages.Add(, strTemp1, LoadPicture(CurrentProject.Path &  "\"  & strTemp))
        obj.Tag =  "рисунок *.bmp на диске" 
        strTemp = Dir()
    Wend
    
End Function


может поможет.
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / Microsoft Access [игнор отключен] [закрыт для гостей] / Как динамически заталкивать в ImageList картинку из рекордсета (поле типа image (MSSQL))?????
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]