Trouble Creating a Point Object

P

Phil Galey

I'm trying to create a Point object and set it at X = 0.5, Y = 0.5. I've
tried the following two ways:

--------------------------------------------------------
Dim pt as new System.Drawing.Point(0.5, 0.5)
--------------------------------------------------------

and

--------------------------------------------------------
Dim pt as new System.Drawing.Point
pt.X = 0.5
pt.Y = 0.5
---------------------------------------------------------

However, both methods result in a point object containing the point (0, 0)
instead of (0.5, 0.5)

How can I get the coordinates into the point object?
 
H

Herfried K. Wagner [MVP]

Phil,


First, turn 'Option Strict On'. This will cause the IDE to detect the
mistake you made. 'Point' can only deal with integral coordinates. Use
'PointF' instead of 'Point' to deal with arbitrary numbers.
 
C

Chris, Master of All Things Insignificant

If you look at the constructor for Point it takes an integer. You are
trying to send in a decimal.

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top