473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

AntiAlias

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
Jun 16 '06 #1
8 1757
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

Jun 16 '06 #2

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

Jun 17 '06 #3
"pcnerd" <pc****@discussions.microsoft.com> schrieb:
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
\\\
objGraphics.SmoothingMode = SmoothingMode.AntiAlias
///
objRandom = New Random(Now.Millisecond)


Simply call the parameterless constructor here!

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jun 17 '06 #4
2 questions

You added the following code - "objGraphics.SmoothingMode =
SmoothingMode.AntiAlias". The compiler didn't like it!

You also stated - "Simply call the parameterless constructor here!" Where is
"here"?

Thank you. David

"Herfried K. Wagner [MVP]" wrote:
"pcnerd" <pc****@discussions.microsoft.com> schrieb:
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


\\\
objGraphics.SmoothingMode = SmoothingMode.AntiAlias
///
objRandom = New Random(Now.Millisecond)


Simply call the parameterless constructor here!

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jun 18 '06 #5
"pcnerd" <pc****@discussions.microsoft.com> schrieb:
You added the following code - "objGraphics.SmoothingMode =
SmoothingMode.AntiAlias". The compiler didn't like it!
You will have to add 'Imports System.Drawing.Drawing2D' on top of the source
file.
You also stated - "Simply call the parameterless constructor here!" Where
is
"here"?


\\\
Dim r As New Random()
///

You don't need to pass the current time to the constructor.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jun 18 '06 #6

HUH?

I give up. VB.NET is too complicated for me. I'm going back to VB6!
"Herfried K. Wagner [MVP]" wrote:
"pcnerd" <pc****@discussions.microsoft.com> schrieb:
You added the following code - "objGraphics.SmoothingMode =
SmoothingMode.AntiAlias". The compiler didn't like it!


You will have to add 'Imports System.Drawing.Drawing2D' on top of the source
file.
You also stated - "Simply call the parameterless constructor here!" Where
is
"here"?


\\\
Dim r As New Random()
///

You don't need to pass the current time to the constructor.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jun 18 '06 #7
Hello, David,

Re:
I give up. VB.NET is too complicated for me. I'm going back to VB6!
That will probably prove to be a mistake. Presumably you already "know"
VB6. This is, no doubt, because you have invested a lot of time and
effort learning it.

You need to understand that VB.Net is a substantially different language
than VB6. Therefore you must also be prepared to invest significant
effort in learning it.

I'd advise against "giving up". I think that you'll find the effort
required is well spent.

Cheers,
Randy
pcnerd wrote:
HUH?

I give up. VB.NET is too complicated for me. I'm going back to VB6!
"Herfried K. Wagner [MVP]" wrote:

"pcnerd" <pc****@discussions.microsoft.com> schrieb:
You added the following code - "objGraphics.SmoothingMode =
SmoothingMode.AntiAlias". The compiler didn't like it!


You will have to add 'Imports System.Drawing.Drawing2D' on top of the source
file.

You also stated - "Simply call the parameterless constructor here!" Where
is
"here"?


\\\
Dim r As New Random()
///

You don't need to pass the current time to the constructor.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jun 19 '06 #8

There are things that I like in VB6 that aren't available in VB.NET. For
example, with Pset I can plot individual pixels. I created a demo program in
VB6 that plots math functions. I can see the individual pixels. VB.NET
doesn't have Pset so there's no way to plot individual pixels. I have to
create circle of 1 pixel width & 1 pixel height. The VB.NET program that I'm
trying to do shows the circles as tiny boxes. In my VB6 program, I can see
the individual pixels & they are smaller than the boxes. In VB6, it's easy to
create a custom coordinate system (like the origin in the center of the
form). In VB.NET, it isn't. Every time that I hope to have a solution to a
problem, another problem comes up. For instance, someone explained how to use
AntiAlias so the compiler wouldn't complain. Somebody else suggested
something else so I tried it & the compiler complained. I can't win. I'm not
a patient person. Another thing that I don't like about VB.NET is that the
..NET Framework has to be installed before VB will run. I know that the .NET
Framework can be installed as part of the Setup. That's not a problem with
VB6. Just run the deployment wizard & put the program on a floppy or CD.

And Microsoft thinks that VB.NET is an improvement over VB6? Not in my
opinion.

Maybe I'll give VB.NET another try & maybe I won't.

"R. MacDonald" wrote:
Hello, David,

Re:
> I give up. VB.NET is too complicated for me. I'm going back to VB6!


That will probably prove to be a mistake. Presumably you already "know"
VB6. This is, no doubt, because you have invested a lot of time and
effort learning it.

You need to understand that VB.Net is a substantially different language
than VB6. Therefore you must also be prepared to invest significant
effort in learning it.

I'd advise against "giving up". I think that you'll find the effort
required is well spent.

Cheers,
Randy
pcnerd wrote:
HUH?

I give up. VB.NET is too complicated for me. I'm going back to VB6!
"Herfried K. Wagner [MVP]" wrote:

"pcnerd" <pc****@discussions.microsoft.com> schrieb:

You added the following code - "objGraphics.SmoothingMode =
SmoothingMode.AntiAlias". The compiler didn't like it!

You will have to add 'Imports System.Drawing.Drawing2D' on top of the source
file.
You also stated - "Simply call the parameterless constructor here!" Where
is
"here"?

\\\
Dim r As New Random()
///

You don't need to pass the current time to the constructor.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jun 20 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Furer Ramon | last post by:
Hello, I want to display all the text in my application in antialias-mode (Only my application!). I can overwrite theOnPaint-Events of all Controls to enable antialias with: Protected...
0
by: Rune Zedeler | last post by:
Not sure whether this is the right group. Help on that appreciated as well. I need to draw lines in subpixelprecision. Downscaling the canvas from Graphics2D should imho do that. The program ...
2
by: Peted | last post by:
Are there any options to enable an antialias function on standard winform controls ? things like the displayed text on buttons , radio buttons and other standard controls look a bit jagged and...
2
by: RSH | last post by:
Is it possible to override the onPaint event of the RichTextBox control to set the smoothing mode to anti-aliased? If so how do I do it? I havent been able to find anything about doing this on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.