Alright! Your suggestion worked! The compiler didn't complain! Now how do I
use it?
Here's the situation. I've created a demo program that draws various sizes
of circles & ellipses in random locations on the form. Sometimes, I see
"jaggies". Where in the code do I use the "objSmoothing"?
Here follows the code from the button_Click event:
Dim CircleWidth As Integer
Dim CircleHeight As Integer
Dim CenterX As Integer
Dim CenterY As Integer
Dim RedColor As Integer
Dim GreenColor As Integer
Dim BlueColor As Integer
Dim Transparency As Integer
Dim objGraphics As Graphics
objGraphics = Me.CreateGraphics
' Dim objSmoothing As System.Drawing.Drawing2D.SmoothingMode
' objSmoothing = Drawing2D.SmoothingMode.AntiAlias
Dim objRandom As System.Random
' Initialize the Random object
objRandom = New Random(Now.Millisecond)
Transparency = objRandom.Next(0, 256)
CircleWidth = objRandom.Next(0, 10)
CircleHeight = objRandom.Next(0, 10)
CenterX = objRandom.Next(0, 1279)
CenterY = objRandom.Next(0, 1023)
RedColor = objRandom.Next(0, 256)
GreenColor = objRandom.Next(0, 256)
BlueColor = objRandom.Next(0, 256)
Dim DrawingPen As Pen
' DrawingPen = New Pen(Color.FromArgb(Transparency, RedColor, GreenColor,
BlueColor), 5)
DrawingPen = New Pen(Color.FromArgb(RedColor, GreenColor, BlueColor), 5)
Dim Index As Integer
For Index = 1 To 10000
' System.Threading.Thread.Sleep(100)
' Me.CreateGraphics.DrawEllipse(DrawingPen, CenterX, CenterY,
CircleWidth, CircleHeight)
Me.CreateGraphics.DrawEllipse(DrawingPen, CenterX, CenterY,
CircleWidth, CircleHeight)
CenterX = objRandom.Next(0, 1279)
CenterY = objRandom.Next(0, 1023)
RedColor = objRandom.Next(0, 256)
GreenColor = objRandom.Next(0, 256)
BlueColor = objRandom.Next(0, 256)
Next Index
Some of the comments are because I'm experimenting.
I tried adding the "objSmoothing" to the end of the For...Next, but the
compiler complained.
So, where in the code do I add the "objSmoothing"?
Thank you.
David
"R. MacDonald" wrote:
Hello, David,
That seems odd to me. The compiler "should" be complaining about the
first line instead.
Rather than being a type, "AntiAlias" is one of the values of the
SmoothingMode enumeration. Try the following instead:
Dim objSmoothing As System.Drawing.Drawing2D.SmoothingMode
objSmoothing = Drawing2D.SmoothingMode.AntiAlias
Cheers,
Randy
pcnerd wrote: I'm a VB.NET "newbie". I want to use AntiAlias, but every thing that I try
the compiler doesn't like. Sometimes it will suggest a change, but when I
change it, it doesn't like that either! Weird! I can't win!
So far, I have "Dim objSmoothing AS
System.Drawing.Drawing2D.SmoothingMode.AntiAlias". On the next line I have
"objSmoothing =" No matter what I try after the equals sign, the compiler
doesn't like it!
So, what do I put after the equals sign that the compiler will like & not
complain about? Thank you. David