VintaSoft Imaging .NET SDK 15.1: Документация для .NET разработчика
В этом разделе
Как изменить яркость изображения в WinForms просмотрщике изображений?
В этом разделе
Для обработки (например, изменения яркости) изображения в просмотрщике изображений необходимо выполнить следующие действия:
Вот C#/VB.NET код, который демонстрирует, как изменить яркость видимой области в ImageViewer:
/// <summary>
/// Adds the visual tool, which changes brightness of visible area of image viewer, to the image viewer.
/// </summary>
/// <param name="imageViewer">The image viewer.</param>
/// <param name="imageBrightness">The image brightness value in percents. Valid values are from -100 to 100.</param>
public void AddVisualToolForProcessingVisibleAreaInImageViewer(
    Vintasoft.Imaging.UI.ImageViewer imageViewer,
    int imageBrightness)
{
    // create command for changing of image brightness
    Vintasoft.Imaging.ImageProcessing.Color.ChangeBrightnessCommand changeBrightnessCommand = 
        new Vintasoft.Imaging.ImageProcessing.Color.ChangeBrightnessCommand();
    // set the command parameters
    changeBrightnessCommand.Brightness = imageBrightness;

    // create an instance of the ImageViewerProcessingTool class
    Vintasoft.Imaging.UI.VisualTools.ImageViewerProcessingTool imageViewerProcessingTool =
        new Vintasoft.Imaging.UI.VisualTools.ImageViewerProcessingTool();
    // specify that visual tool must use the command for processing visible area in image viewer
    imageViewerProcessingTool.ProcessingCommand = changeBrightnessCommand;

    // set the tool as the current tool of the ImageViewer
    imageViewer.VisualTool = imageViewerProcessingTool;
}
''' <summary>
''' Adds the visual tool, which changes brightness of visible area of image viewer, to the image viewer.
''' </summary>
''' <param name="imageViewer">The image viewer.</param>
''' <param name="imageBrightness">The image brightness value in percents. Valid values are from -100 to 100.</param>
Public Sub AddVisualToolForProcessingVisibleAreaInImageViewer(imageViewer As Vintasoft.Imaging.UI.ImageViewer, imageBrightness As Integer)
    ' create command for changing of image brightness
    Dim changeBrightnessCommand As New Vintasoft.Imaging.ImageProcessing.Color.ChangeBrightnessCommand()
    ' set the command parameters
    changeBrightnessCommand.Brightness = imageBrightness

    ' create an instance of the ImageViewerProcessingTool class
    Dim imageViewerProcessingTool As New Vintasoft.Imaging.UI.VisualTools.ImageViewerProcessingTool()
    ' specify that visual tool must use the command for processing visible area in image viewer
    imageViewerProcessingTool.ProcessingCommand = changeBrightnessCommand

    ' set the tool as the current tool of the ImageViewer
    imageViewer.VisualTool = imageViewerProcessingTool
End Sub