На главную

On-line справка по Win32 API

Написать письмо
БЕСПЛАТНАЯ ежедневная online лотерея! Выигрывай каждый день БЕСПЛАТНО!
Список всех статей A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z | Скачать Вниз

Creating an Image List



To create an image list, use the ImageList_Create function, specifying the type of image list to create (unmasked or masked); the width and height, in pixels, of the images; the number of images you intend to add to the image list; and the amount of images by which the list can grow when it is resized to accommodate additional images. The common control DLL contains the executable code for the image list functions. You must ensure that the library is loaded by using the InitCommonControls function before making any calls to image list functions.

The following example creates a masked image list and uses the ImageList_AddIcon function to add two icons to the list.

// AddIconsToImageList - creates a masked image list and adds some
// icons to it.
// Returns the handle of the new image list.
// hinst - handle of the application instance
//
// Global variables and constants
// g_nBird and g_nTree - indexes of the images
// CX_ICON and CY_ICON - width and height of the icon
// NUM_ICONS - number of icons to add to the image list
extern int g_nBird, g_nTree;

#define CX_ICON 32

#define CY_ICON 32
#define NUM_ICONS 3

HIMAGELIST AddIconsToImageList(HINSTANCE hinst)
{
HIMAGELIST himlIcons; // handle of new image list
HICON hicon; // handle of icon

// Ensure that the common control DLL is loaded.
InitCommonControls();

// Create a masked image list large enough to hold the icons.
himlIcons = ImageList_Create(CX_ICON, CY_ICON, TRUE, NUM_ICONS, 0);

// Load the icon resources, and add the icons to the image list.

hicon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_BIRD));
g_nBird = ImageList_AddIcon(himlIcons, hicon);

hicon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_TREE));
g_nTree = ImageList_AddIcon(himlIcons, hicon);

return himlIcons;
}



Пригласи друзей и счет твоего мобильника всегда будет положительным!
Предыдущая статья
 
Сайт Народ.Ру Интернет
Следующая статья
Пригласи друзей и счет твоего мобильника всегда будет положительным!

Создание Списка Образа



Для того, чтобы создавать список образа, используйте функцию ImageList_Create, определяющую тип списка образа, чтобы создавать (разрешенный или замаскированный); ширина и высота, на пикселях, образов; количество образов, которые Вы собираетесь добавлять к списку образа; и сумма образов, которыми список может возрасти когда он поменен размеры, чтобы размещать дополнительные образы. Общее управление DLL содержит выполняемый код для функций списка образа. Вы должны проверить, что библиотека загружена использованием функции InitCommonControls перед получением любых вызовов в функции списка образа.

Следующий пример создает замаскированный список образа и использует функцию ImageList_AddIcon, чтобы добавлять две иконы к списку.

// AddIconsToImageList - СОЗДАЕТ замаскированный список образа и добавляет некоторые // иконы к этому.
// Возврат ручка нового списка образа.
// hinst - ручка прикладного примера
//
// Глобальные переменные и константы // g_nBird и g_nTree - индексы образов // CX_ICON и CY_ICON - ширина и высота иконы // NUM_ICONS - количество икон, чтобы добавлять к списку образа extern int g_nBird, g_nTree;

#define CX_ICON 32

#define CY_ICON 32 #define NUM_ICONS 3

HIMAGELIST AddIconsToImageList(HINSTANCE hinst)
{
HIMAGELIST himlIcons; // ручка нового списка образа HICON hicon; // ручка иконы

// Проверьте, что общее управление DLL загружено.
InitCommonControls();

// Создайте замаскированный список образа большой достаточно, чтобы держать иконы.
himlIcons = ImageList_Create(CX_ICON, CY_ICON, ИСТИНА, NUM_ICONS, 0);

// Нагрузка иконные ресурсы и добавляют иконы к списку образа.

hicon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_BIRD));
g_nBird = ImageList_AddIcon(himlIcons, hicon);

hicon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_TREE));
g_nTree = ImageList_AddIcon(himlIcons, hicon);

возвращайте himlIcons;
}



Вверх Version 1.3, Oct 26 2010 © 2007, 2010, mrhx Вверх
 mrhx software  Русский перевод OpenGL  Русский перевод Win32 API
 
Используются технологии uCoz