Image Thumbnail Viewer
This is a very simple way to view a thumbnail of an image file while maintaining the aspect ration.
AI
KI-Zusammenfassung: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Quellcode
Option Explicit Public Sub ViewImage(strFile As String, picTemp As PictureBox, picTarget As PictureBox) Dim x&, y&, x1&, y1&, z1! Dim sNoPreview$ On Error GoTo ErrorHandler 'Set default stuffs picTarget.Cls picTarget.AutoRedraw = True picTemp.Visible = False picTemp.AutoSize = True 'get target sizing info x = picTarget.width y = picTarget.height 'Load the image picTemp.Picture = LoadPicture(strFile) 'get source sizing info x1 = picTemp.width y1 = picTemp.height 'Determin conversion ratio to use z1 = IIf(x / x1 * y1 < y, x / x1, y / y1) 'Calculate new image size x1 = x1 * z1 y1 = y1 * z1 'Draw Image picTarget.PaintPicture picTemp.Picture, (x - x1) / 2, (y - y1) / 2, x1, y1 Exit Sub ErrorHandler: 'set temp image to nothing picTemp.Picture = LoadPicture() 'Display default error message sNoPreview = "No Preview Available" picTarget.CurrentX = x / 2 - picTarget.TextWidth(sNoPreview) / 2 picTarget.CurrentY = y / 2 - picTarget.TextHeight(sNoPreview) / 2 picTarget.Print sNoPreview End Sub
Originalkommentare (3)
Wiederhergestellt von der Wayback Machine