Hi Lance,
I think you may need to scale the image first before your create the brush.
Private bmp As Bitmap
Private b As TextureBrush
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim MyBitmap As New Bitmap("c:\test.bmp")
Const scale As Single = 2
bmp = GetScaledImage(MyBitmap, scale)
b = New Drawing.TextureBrush(bmp)
Me.Size = New Size(MyBitmap.Width * scale, MyBitmap.Height * scale)
End Sub
Private Function GetScaledImage(ByVal srcbmp As Bitmap, ByVal scale As
Single) As Bitmap
Dim bm As New Bitmap(srcbmp.Width * scale, srcbmp.Height * scale,
Imaging.PixelFormat.Format24bppRgb)
Dim g As Graphics
g = Graphics.FromImage(bm)
g.ScaleTransform(scale, scale)
g.InterpolationMode = InterpolationMode.Bilinear
g.DrawImage(srcbmp, 0, 0)
g.Dispose()
Return bm
End Function
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
e.Graphics.FillRectangle(b, New Rectangle(New Point(0, 0),
Me.ClientSize))
End Sub
If you have any concern on this issue, please post here.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure!
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.