Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Disable anti-aliasing

248 views
Skip to first unread message

Kurzweil

unread,
Aug 12, 2003, 3:55:01 AM8/12/03
to
How do I disable anti-aliasing when painting a Bitmap onto something.
I now have a Bitmap object and a Picturebox and assigned the bitmap to the
picturebox.

Thanks in advance,
Kurzweil


Bob Powell [MVP]

unread,
Aug 12, 2003, 6:15:41 AM8/12/03
to
> How do I disable anti-aliasing when painting a Bitmap onto something.
> I now have a Bitmap object and a Picturebox and assigned the bitmap to the
> picturebox.

If you use the PictureBox you'll get whatever interpolation mode it chooses.

PictureBox is unneccesary though. You can display an image so easily and
choose whatever antialiasing and interpolation modes you like. After my
signature is an image control in Visual Basic that does this.

--
Bob Powell [MVP]
C#, System.Drawing

ANNOUNCING: Well Formed.
The monthy electronic magazine for
Windows Forms and GDI+ engineers
http://www.bobpowell.net/wellformed.htm

Check out the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

---------------------------
Imports System

Imports System.ComponentModel

Imports System.Drawing

Imports System.Windows.Forms

Public Class QuickPicBox

Inherits Control

Dim _image As Image

Public Property Image() As Image

Get

Return _image

End Get

Set(ByVal Value As Image)

_image = Value

End Set

End Property

Protected Overloads Overrides Sub OnPaint(ByVal e As PaintEventArgs)

If _image Is Nothing Then

Return

End If

'set up any interpolation mode you like here...

e.Graphics.InterpolationMode = Drawing2D.InterpolationMode.NearestNeighbor

e.Graphics.DrawImage(_image, New Rectangle(0, 0, Width, Height), New
Rectangle(0, 0, _image.Width, _image.Height), GraphicsUnit.Pixel)

End Sub

End Class

---------------------------


"Kurzweil" <rayk...@hotmail.com> wrote in message
news:10606747...@newsreader2.wirehub.nl...

0 new messages