Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
e As System.EventArgs) Handles MyBase.Load
ShrinkImage(picOriginal, picNotAntialiased)
ShrinkImage(picOriginal, picAntialiased, True)
End Sub
Private Sub ShrinkImage(ByVal from_pic As PictureBox, ByVal _
to_pic As PictureBox, Optional ByVal anti_alias As _
Boolean = False)
' Get the source Bitmap.
Dim from_bm As New Bitmap(from_pic.Image)
' Make the destination Bitmap.
Dim wid As Integer = from_pic.Width \ 2
Dim hgt As Integer = from_pic.Height \ 2
Dim to_bm As New Bitmap(wid, hgt)
' Copy the image.
Dim gr As Graphics = Graphics.FromImage(to_bm)
If anti_alias Then gr.InterpolationMode = _
Drawing2D.InterpolationMode.HighQualityBilinear
gr.DrawImage(from_bm, 0, 0, wid - 1, hgt - 1)
' Display the result.
to_pic.Image = to_bm
End Sub
|