How to draw text on thumbnails?
In This Topic
Any text or graphics can be drawn on thumbnail in
ThumbnailViewer using the
ThumbnailViewer.ThumbnailPainted event.
Here is an example that shows how add caption for thumbnails in
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)
Here is an example that shows how draw text on thumbnail images in
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