VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.UI Namespace / ThumbnailCaption Class / CaptionFormatted Event
Синтаксис Example Требования Смотрите также
В этом разделе
    CaptionFormatted Событие (ThumbnailCaption)
    В этом разделе
    Происходит при форматировании текста подписи.
    Синтаксис
    Пример

    Вот C#/VB.NET код, который демонстрирует, как настроить заголовок миниатюры:

    
    ''' <summary>
    ''' Sets the custom thumbnail caption.
    ''' </summary>
    ''' <param name="thumbnailViewer">The thumbnail viewer.</param>
    Public Shared Sub SetCustomThumbnailCaption(thumbnailViewer As Vintasoft.Imaging.UI.ThumbnailViewer)
        AddHandler thumbnailViewer.ThumbnailCaption.CaptionFormatted, AddressOf ThumbnailCaption_CaptionFormatted
        thumbnailViewer.ThumbnailCaption.IsVisible = True
    End Sub
    
    ''' <summary>
    ''' Handles the CaptionFormatted event of the ThumbnailCaption.
    ''' </summary>
    ''' <param name="sender">The source of the event.</param>
    ''' <param name="e">The <see cref="Vintasoft.Imaging.UI.ThumbnailCaptionFormattedEventArgs"/> instance containing the event data.</param>
    Private Shared Sub ThumbnailCaption_CaptionFormatted(sender As Object, e As Vintasoft.Imaging.UI.ThumbnailCaptionFormattedEventArgs)
        Dim image As Vintasoft.Imaging.VintasoftImage = e.Thumbnail.Source
        Dim imageIndex As Integer = e.ThumbnailViewer.Images.IndexOf(image)
        If e.ThumbnailViewer.SelectedIndices.Contains(imageIndex) Then
            e.Caption = "Selected"
        Else
            e.Caption = String.Format("{0}, page {1}", System.IO.Path.GetFileName(image.SourceInfo.Filename), image.SourceInfo.PageIndex + 1)
        End If
    End Sub
    
    
    
    /// <summary>
    /// Sets the custom thumbnail caption.
    /// </summary>
    /// <param name="thumbnailViewer">The thumbnail viewer.</param>
    public static void SetCustomThumbnailCaption(Vintasoft.Imaging.UI.ThumbnailViewer thumbnailViewer)
    {
        thumbnailViewer.ThumbnailCaption.CaptionFormatted += ThumbnailCaption_CaptionFormatted;
        thumbnailViewer.ThumbnailCaption.IsVisible = true;
    }
    
    /// <summary>
    /// Handles the CaptionFormatted event of the ThumbnailCaption.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="Vintasoft.Imaging.UI.ThumbnailCaptionFormattedEventArgs"/> instance containing the event data.</param>
    private static void ThumbnailCaption_CaptionFormatted(object sender, Vintasoft.Imaging.UI.ThumbnailCaptionFormattedEventArgs e)
    {
        Vintasoft.Imaging.VintasoftImage image = e.Thumbnail.Source;
        int imageIndex = e.ThumbnailViewer.Images.IndexOf(image);
        if (e.ThumbnailViewer.SelectedIndices.Contains(imageIndex))
        {
            e.Caption = "Selected";
        }
        else
        {
            e.Caption = string.Format("{0}, page {1}", System.IO.Path.GetFileName(image.SourceInfo.Filename), image.SourceInfo.PageIndex + 1);
        }
    }
    
    

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также