Image Класс
Определение
Абстрактный базовый класс, который предоставляет функциональные возможности для производных классов Bitmap и Metafile. An abstract base class that provides functionality for the Bitmap and Metafile descended classes.
Примеры
Следующий пример кода предназначен для использования с Windows Forms. The following code example is designed for use with Windows Forms. Это обработчик Paint события. It is a handler for the Paint event. GraphicsОбъект передается в событие и используется для рисования изображения в форме. A Graphics object is passed to the event and is used to draw the image on the form. Код выполняет следующие действия. The code performs the following actions:
Создает изображение из файла с именем SampImag.jpg. Creates an image from a file named SampImag.jpg. Этот файл должен находиться в той же папке, что и исполняемый файл приложения. This file must be located in the same folder as the application executable file.
Создает точку, в которой рисуется левый верхний угол изображения. Creates a point at which to draw the upper-left corner of the image.
Рисует немасштабированное изображение в форме. Draws the unscaled image on the form.
Комментарии
Для рисования Image в Windows Forms следует использовать один из DrawImage методов. To draw an Image on a Windows Form, you should use one of the DrawImage methods.
Свойства
Возвращает флаги атрибутов для пиксельных данных этого объекта Image. Gets attribute flags for the pixel data of this Image.
Возвращает массив идентификаторов GUID, представляющих размеры кадров в объекте Image. Gets an array of GUIDs that represent the dimensions of frames within this Image.
Возвращает высоту объекта Image в пикселях. Gets the height, in pixels, of this Image.
Возвращает горизонтальное разрешение объекта Image в пикселях на дюйм. Gets the horizontal resolution, in pixels per inch, of this Image.
Возвращает или задает палитру цветов, используемую для объекта Image. Gets or sets the color palette used for this Image.
Возвращает ширину и высоту данного изображения. Gets the width and height of this image.
Возвращает формат пикселей для этого объекта Image. Gets the pixel format for this Image.
Возвращает идентификаторы элементов свойств, хранящихся в объекте Image. Gets IDs of the property items stored in this Image.
Возвращает все элементы свойств (части метаданных), хранящихся в объекте Image. Gets all the property items (pieces of metadata) stored in this Image.
Возвращает формат файла этого объекта Image. Gets the file format of this Image.
Возвращает ширину и высоту изображения в пикселях. Gets the width and height, in pixels, of this image.
Возвращает или задает объект, предоставляющий дополнительные данные об изображении. Gets or sets an object that provides additional data about the image.
Возвращает вертикальное разрешение объекта Image в пикселях на дюйм. Gets the vertical resolution, in pixels per inch, of this Image.
Возвращает ширину объекта Image в пикселях. Gets the width, in pixels, of this Image.
Методы
Создает точную копию данного объекта Image. Creates an exact copy of this Image.
Создает объект, который содержит всю необходимую информацию для создания прокси-сервера, используемого для взаимодействия с удаленным объектом. Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Унаследовано от MarshalByRefObject)
Освобождает все ресурсы, используемые этим объектом Image. Releases all resources used by this Image.
Освобождает неуправляемые ресурсы, используемые объектом Image, а при необходимости освобождает также управляемые ресурсы. Releases the unmanaged resources used by the Image and optionally releases the managed resources.
Определяет, равен ли указанный объект текущему объекту. Determines whether the specified object is equal to the current object.
(Унаследовано от Object)
Позволяет объекту попытаться освободить ресурсы и выполнить другие операции очистки, перед тем как он будет уничтожен во время сборки мусора. Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
Создает объект Image из указанного файла. Creates an Image from the specified file.
Создает объект Image из указанного файла, используя внедренную информацию управления цветом из файла. Creates an Image from the specified file using embedded color management information in that file.
Создает объект Bitmap из дескриптора точечного рисунка GDI. Creates a Bitmap from a handle to a GDI bitmap.
Создает объект Bitmap из дескриптора точечного рисунка GDI и дескриптора палитры GDI. Creates a Bitmap from a handle to a GDI bitmap and a handle to a GDI palette.
Создает объект Image из указанного потока данных. Creates an Image from the specified data stream.
Создает объект Image из указанного потока данных, используя при необходимости внедренную информацию управления цветом из потока. Creates an Image from the specified data stream, optionally using embedded color management information in that stream.
Создает объект Image из заданного потока данных, используя при необходимости внедренную информацию об управлении цветом и проверяя данные изображения. Creates an Image from the specified data stream, optionally using embedded color management information and validating the image data.
Возвращает границы изображения в указанных единицах измерения. Gets the bounds of the image in the specified unit.
Возвращает информацию о параметрах, поддерживаемых указанным кодировщиком изображения. Returns information about the parameters supported by the specified image encoder.
Возвращает количество кадров указанного размера. Returns the number of frames of the specified dimension.
Служит хэш-функцией по умолчанию. Serves as the default hash function.
(Унаследовано от Object)
Извлекает объект обслуживания во время существования, который управляет политикой времени существования данного экземпляра. Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Унаследовано от MarshalByRefObject)
Возвращает глубину цвета (число бит на пиксель) для указанного формата пикселей. Returns the color depth, in number of bits per pixel, of the specified pixel format.
Возвращает указанный элемент свойства из объекта Image. Gets the specified property item from this Image.
Возвращает эскиз для этого объекта Image. Returns a thumbnail for this Image.
Возвращает объект Type для текущего экземпляра. Gets the Type of the current instance.
(Унаследовано от Object)
Получает объект службы времени существования для управления политикой времени существования для этого экземпляра. Obtains a lifetime service object to control the lifetime policy for this instance.
(Унаследовано от MarshalByRefObject)
Возвращает значение, указывающее, содержит ли формат пикселей данного объекта Image данные альфа-канала. Returns a value that indicates whether the pixel format for this Image contains alpha information.
Возвращает значение, определяющее, приходится ли в формате пикселей 32 бита на пиксель. Returns a value that indicates whether the pixel format is 32 bits per pixel.
Возвращает значение, определяющее, приходится ли в формате пикселей 64 бита на пиксель. Returns a value that indicates whether the pixel format is 64 bits per pixel.
Создает неполную копию текущего объекта Object. Creates a shallow copy of the current Object.
(Унаследовано от Object)
Создает неполную копию текущего объекта MarshalByRefObject. Creates a shallow copy of the current MarshalByRefObject object.
(Унаследовано от MarshalByRefObject)
Удаляет указанный элемент свойства из этого Image. Removes the specified property item from this Image.
Поворачивает, зеркально отражает, либо поворачивает и зеркально отражает объект Image. Rotates, flips, or rotates and flips the Image.
Сохраняет данное изображение в указанный поток с заданным кодировщиком и определенными параметрами кодировщика изображения. Saves this image to the specified stream, with the specified encoder and image encoder parameters.
Сохраняет данное изображение в указанный поток в указанном формате. Saves this image to the specified stream in the specified format.
Сохраняет объект Image в указанный файл или поток. Saves this Image to the specified file or stream.
Сохраняет объект Image в указанный файл с заданным кодировщиком и определенными параметрами кодировщика изображения. Saves this Image to the specified file, with the specified encoder and image-encoder parameters.
Сохраняет объект Image в указанный файл в указанном формате. Saves this Image to the specified file in the specified format.
Добавляет кадр в файл или поток, указанный в предыдущем вызове метода Save. Adds a frame to the file or stream specified in a previous call to the Save method. Используйте данный метод для сохранения выбранных кадров из многокадрового изображения в другое многокадровое изображение. Use this method to save selected frames from a multiple-frame image to another multiple-frame image.
Добавляет кадр в файл или поток, указанный в предыдущем вызове метода Save. Adds a frame to the file or stream specified in a previous call to the Save method.
Выделяет кадр, определяемый размером и индексом. Selects the frame specified by the dimension and index.
Сохраняет элемент свойства (часть метаданных) в Image. Stores a property item (piece of metadata) in this Image.
Возвращает строку, представляющую текущий объект. Returns a string that represents the current object.
(Унаследовано от Object)
Явные реализации интерфейса
Заполняет объект SerializationInfo данными, необходимыми для сериализации целевого объекта. Populates a SerializationInfo with the data needed to serialize the target object.
Image List Класс
Определение
Предоставляет методы для управления коллекцией объектов Image. Provides methods to manage a collection of Image objects. Этот класс не наследуется. This class cannot be inherited.
Примеры
В следующем примере кода показано, как выбирать, удалять и отображать изображения. The following code example shows how to select, remove, and display images.
Комментарии
ImageList обычно используется другими элементами управления, такими как ListView , TreeView или ToolBar . ImageList is typically used by other controls, such as the ListView, TreeView, or ToolBar. В можно добавлять растровые изображения или значки ImageList , а другие элементы управления могут использовать изображения по мере необходимости. You can add bitmaps or icons to the ImageList, and the other controls are able to use the images as they require.
ImageList использует маркер для управления списком образов. ImageList uses a handle to manage the list of images. HandleНе создается до тех пор, пока определенные операции, такие как получение Handle или вызов Draw , выполняются в списке изображений. The Handle is not created until certain operations, such as getting the Handle or calling Draw, are performed on the image list. Выполнение других операций, таких как установка ColorDepth или, ImageSize приведет к Handle повторному созданию. Performing other operations, such as setting the ColorDepth or ImageSize will cause the Handle to be recreated. Поэтому перед добавлением образов в необходимо выполнить эти операции ImageList . Therefore, you should perform these operations before you add images to the ImageList. Кроме того, при работе с формами, которые будут локализованы, всегда следует добавлять ImageList изображения и, если для свойства Language формы задано значение по умолчанию. In addition, when you work with forms that will be localized, you should always add an ImageList and images when the Language property of a form is set to Default. Изменение языка формы перед добавлением изображений приведет к повреждению файлов ресурсов приложения. Changing the form’s language before you add images will corrupt the application resource files.
Конструкторы
Инициализирует новый экземпляр класса ImageList, устанавливая значения по умолчанию для свойств ColorDepth, ImageSize и TransparentColor. Initializes a new instance of the ImageList class with default values for ColorDepth, ImageSize, and TransparentColor.
Инициализирует новый экземпляр класса ImageList, связывая его с контейнером. Initializes a new instance of the ImageList class, associating it with a container.
Свойства
Возвращает значение, показывающее, может ли компонент вызывать событие. Gets a value indicating whether the component can raise an event.
(Унаследовано от Component)
Получает глубину цвета для изображений в списке. Gets the color depth of the image list.
Возвращает объект IContainer, который содержит коллекцию Component. Gets the IContainer that contains the Component.
(Унаследовано от Component)
Возвращает значение, указывающее, находится ли данный компонент Component в режиме конструктора в настоящее время. Gets a value that indicates whether the Component is currently in design mode.
(Унаследовано от Component)
Возвращает список обработчиков событий, которые прикреплены к этому объекту Component. Gets the list of event handlers that are attached to this Component.
(Унаследовано от Component)
Получает дескриптор объекта списка изображений. Gets the handle of the image list object.
Получает значение, показывающее, создан ли основной дескриптор Win32. Gets a value indicating whether the underlying Win32 handle has been created.
Получает ImageList.ImageCollection для данного списка изображений. Gets the ImageList.ImageCollection for this image list.
Получает или задает размер изображений в списке изображений. Gets or sets the size of the images in the image list.
Получает объект ImageListStreamer, связанный с данным списком изображений. Gets the ImageListStreamer associated with this image list.
Получает или задает ISite объекта Component. Gets or sets the ISite of the Component.
(Унаследовано от Component)
Получает или задает объект, содержащий дополнительные данные о списке ImageList. Gets or sets an object that contains additional data about the ImageList.
Получает или задает цвет, обрабатываемый как прозрачный. Gets or sets the color to treat as transparent.
Методы
Создает объект, который содержит всю необходимую информацию для создания прокси-сервера, используемого для взаимодействия с удаленным объектом. Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Унаследовано от MarshalByRefObject)
Освобождает все ресурсы, занятые модулем Component. Releases all resources used by the Component.
(Унаследовано от Component)
Освобождает неуправляемые ресурсы, используемые объектом Component, а при необходимости освобождает также управляемые ресурсы. Releases the unmanaged resources used by the Component and optionally releases the managed resources.
(Унаследовано от Component)
Рисует в заданном месте изображение согласно индексу, который определен в указанном объекте Graphics. Draws the image indicated by the given index on the specified Graphics at the specified location.
Рисует в заданном месте и с заданным размером изображение согласно индексу, который определен в указанном объекте Graphics. Draws the image indicated by the given index on the specified Graphics using the specified location and size.
Рисует в заданном месте изображение согласно индексу, который определен в указанном объекте Graphics. Draws the image indicated by the specified index on the specified Graphics at the given location.
Определяет, равен ли указанный объект текущему объекту. Determines whether the specified object is equal to the current object.
(Унаследовано от Object)
Служит хэш-функцией по умолчанию. Serves as the default hash function.
(Унаследовано от Object)
Извлекает объект обслуживания во время существования, который управляет политикой времени существования данного экземпляра. Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Унаследовано от MarshalByRefObject)
Возвращает объект, представляющий службу, предоставляемую классом Component или классом Container. Returns an object that represents a service provided by the Component or by its Container.
(Унаследовано от Component)
Возвращает объект Type для текущего экземпляра. Gets the Type of the current instance.
(Унаследовано от Object)
Получает объект службы времени существования для управления политикой времени существования для этого экземпляра. Obtains a lifetime service object to control the lifetime policy for this instance.
(Унаследовано от MarshalByRefObject)
Создает неполную копию текущего объекта Object. Creates a shallow copy of the current Object.
(Унаследовано от Object)
Создает неполную копию текущего объекта MarshalByRefObject. Creates a shallow copy of the current MarshalByRefObject object.
(Унаследовано от MarshalByRefObject)
Возвращает строку, которая представляет текущий объект ImageList. Returns a string that represents the current ImageList.
События
Возникает при удалении компонента путем вызова метода Dispose(). Occurs when the component is disposed by a call to the Dispose() method.
(Унаследовано от Component)
Происходит при повторном создании Handle. Occurs when the Handle is recreated.