473,790 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Smoot hingMode.AntiAl ias". On the next line I have
"objSmoothi ng =" 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 1778
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.Smoot hingMode
objSmoothing = Drawing2D.Smoot hingMode.AntiAl ias

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.Smoot hingMode.AntiAl ias". On the next line I have
"objSmoothi ng =" 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 "objSmoothi ng"?

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.CreateGraphi cs

' Dim objSmoothing As System.Drawing. Drawing2D.Smoot hingMode
' objSmoothing = Drawing2D.Smoot hingMode.AntiAl ias

Dim objRandom As System.Random

' Initialize the Random object
objRandom = New Random(Now.Mill isecond)

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.FromA rgb(Transparenc y, RedColor, GreenColor,
BlueColor), 5)
DrawingPen = New Pen(Color.FromA rgb(RedColor, GreenColor, BlueColor), 5)

Dim Index As Integer

For Index = 1 To 10000
' System.Threadin g.Thread.Sleep( 100)
' Me.CreateGraphi cs.DrawEllipse( DrawingPen, CenterX, CenterY,
CircleWidth, CircleHeight)
Me.CreateGraphi cs.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 "objSmoothi ng" to the end of the For...Next, but the
compiler complained.

So, where in the code do I add the "objSmoothi ng"?

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.Smoot hingMode
objSmoothing = Drawing2D.Smoot hingMode.AntiAl ias

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.Smoot hingMode.AntiAl ias". On the next line I have
"objSmoothi ng =" 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****@discuss ions.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 "objSmoothi ng"?

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.CreateGraphi cs

' Dim objSmoothing As System.Drawing. Drawing2D.Smoot hingMode
' objSmoothing = Drawing2D.Smoot hingMode.AntiAl ias
\\\
objGraphics.Smo othingMode = SmoothingMode.A ntiAlias
///
objRandom = New Random(Now.Mill isecond)


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.Sm oothingMode =
SmoothingMode.A ntiAlias". 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****@discuss ions.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 "objSmoothi ng"?

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.CreateGraphi cs

' Dim objSmoothing As System.Drawing. Drawing2D.Smoot hingMode
' objSmoothing = Drawing2D.Smoot hingMode.AntiAl ias


\\\
objGraphics.Smo othingMode = SmoothingMode.A ntiAlias
///
objRandom = New Random(Now.Mill isecond)


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****@discuss ions.microsoft. com> schrieb:
You added the following code - "objGraphics.Sm oothingMode =
SmoothingMode.A ntiAlias". 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****@discuss ions.microsoft. com> schrieb:
You added the following code - "objGraphics.Sm oothingMode =
SmoothingMode.A ntiAlias". 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****@discuss ions.microsoft. com> schrieb:
You added the following code - "objGraphics.Sm oothingMode =
SmoothingMod e.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****@discuss ions.microsoft. com> schrieb:

You added the following code - "objGraphics.Sm oothingMode =
SmoothingMod e.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
969
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 Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit MyBase.OnPaint(e) End Sub
0
2292
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 import java.awt.*; import javax.swing.*; public class TestGfx2D extends JPanel {
2
3073
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 stuff, is it possible to antialis the text that gets entered into the text property of the controls ?
2
2669
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 the web. Thanks! Ron
0
10413
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.