Как нарисовать текст на миниатюрах?
В этом разделе
Любой текст или графика могут быть нарисованы на миниатюре в
ThumbnailViewer с помощью события
ThumbnailViewer.ThumbnailPainted.
Вот C#/VB.NET код, который демонстрирует, как добавить подпись к миниатюрам в
ThumbnailViewer:
Vintasoft.Imaging.UI.ThumbnailCaption caption = thumbnailViewer1.ThumbnailCaption;
caption.IsVisible = true;
caption.CaptionFormat = "{PageNumber} page";
caption.Anchor = Vintasoft.Imaging.AnchorType.Bottom;
caption.TextColor = System.Drawing.Color.Blue;
caption.Font = new System.Drawing.Font(
System.Drawing.SystemFonts.DefaultFont.FontFamily, 15f);
Dim caption As Vintasoft.Imaging.UI.ThumbnailCaption = thumbnailViewer1.ThumbnailCaption
caption.IsVisible = True
caption.CaptionFormat = "{PageNumber} page"
caption.Anchor = Vintasoft.Imaging.AnchorType.Bottom
caption.TextColor = System.Drawing.Color.Blue
caption.Font = New System.Drawing.Font(System.Drawing.SystemFonts.DefaultFont.FontFamily, 15F)
Вот C#/VB.NET код, который демонстрирует, как нарисовать текст на миниатюрах изображений в
ThumbnailViewer:
public void Run()
{
thumbnailViewer1.ThumbnailPainted +=
new System.EventHandler<Vintasoft.Imaging.UI.ThumbnailPaintEventArgs>(thumbnailViewer1_ThumbnailPainted);
}
void thumbnailViewer1_ThumbnailPainted(object sender, Vintasoft.Imaging.UI.ThumbnailPaintEventArgs e)
{
System.Drawing.Graphics graphics = e.Graphics;
string text = "Test";
using (System.Drawing.Font font = new System.Drawing.Font(
System.Drawing.SystemFonts.DefaultFont.FontFamily, 15f))
{
graphics.DrawString(text, font,
System.Drawing.Brushes.Blue,
new System.Drawing.Point(0, 0));
}
}
Public Sub Run()
AddHandler thumbnailViewer1.ThumbnailPainted, New System.EventHandler(Of Vintasoft.Imaging.UI.ThumbnailPaintEventArgs)(AddressOf thumbnailViewer1_ThumbnailPainted)
End Sub
Private Sub thumbnailViewer1_ThumbnailPainted(sender As Object, e As Vintasoft.Imaging.UI.ThumbnailPaintEventArgs)
Dim graphics As System.Drawing.Graphics = e.Graphics
Dim text As String = "Test"
Using font As New System.Drawing.Font(System.Drawing.SystemFonts.DefaultFont.FontFamily, 15F)
graphics.DrawString(text, font, System.Drawing.Brushes.Blue, New System.Drawing.Point(0, 0))
End Using
End Sub