473,387 Members | 1,517 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,387 software developers and data experts.

Trouble with pixels

In VB2005 I use a rectangle (50,50,910,600) into which to display my
graphics.
After graphing my X-Y data I want to do some measurements on that curve
using a crosshair cursor.

So I a made a MouseDoubleClick event with the following code:

Dim position as Point
position=Control.MousePostion
tijd=position.X
height=position.Y

Now it seems that the height is in screencoordinates, not in
graphicscoordinates, e.g. if I doubleclick on the topline of my rectangle I
get height=76 pixels, instead of 50 pixels (the difference of 26 pixels is
the height of the forms titelbar). This difference of course becomes larger
with a form that is not maximized.

Now I can live with that by always using a maximized screen and substracting
26 from the position.Y, but that does not seems not very elegant.

Is there a better way to get the coordinates in a graphics window in
graphicscoordinates?
--
Groeten,
Jaap Bos
Aug 11 '06 #1
4 1085
Jaap Bos wrote:
Is there a better way to get the coordinates in a graphics window in
graphicscoordinates?
Control.PointToClient and Control.PointToScreen will convert back and
forth for you.
--
Larry Lard
la*******@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Aug 11 '06 #2

"Larry Lard" <la*******@googlemail.com>
Jaap Bos wrote:
>Is there a better way to get the coordinates in a graphics window in
graphicscoordinates?

Control.PointToClient and Control.PointToScreen will convert back and
forth for you.
Thank you Larry, you solved my problem!

As an afterthought, I find, as a newbie, that it is rather difficult to get
a grasp of the possibilities of using graphics in VB2005.
I read the Michael Halvorson Step by Step book and watched the Microsoft
online video's.
After this I have some knowledge about VB-programming, but I still know nil
about graphics, apart from drawing a line or a rectangle.
Befor I asked my question I looked into the Help-index of VB but really
could not find the answer that you gave me.
Can you point me to a (not to advanced :-) ) book or online material on
VB-graphics?

Thanks again,

Jaap

Aug 11 '06 #3
Jaap Bos wrote:
"Larry Lard" <la*******@googlemail.com>
>Jaap Bos wrote:
>>Is there a better way to get the coordinates in a graphics window in
graphicscoordinates?
Control.PointToClient and Control.PointToScreen will convert back and
forth for you.

Thank you Larry, you solved my problem!

As an afterthought, I find, as a newbie, that it is rather difficult to get
a grasp of the possibilities of using graphics in VB2005.
I read the Michael Halvorson Step by Step book and watched the Microsoft
online video's.
After this I have some knowledge about VB-programming, but I still know nil
about graphics, apart from drawing a line or a rectangle.
Befor I asked my question I looked into the Help-index of VB but really
could not find the answer that you gave me.
Can you point me to a (not to advanced :-) ) book or online material on
VB-graphics?
Bob Powell's excellent website is my first port of call whenever I have
a graphics issue:

<http://www.bobpowell.net/>

--
Larry Lard
la*******@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Aug 14 '06 #4

"Larry Lard" <la*******@googlemail.comschreef
Jaap Bos wrote:
>Can you point me to a (not to advanced :-) ) book or online material on
VB-graphics?

Bob Powell's excellent website is my first port of call whenever I have a
graphics issue:

<http://www.bobpowell.net/>

--
Larry Lard
Thanks Larry. Looks like that this site will keep me occupied for a while
:-) .

Jaap Bos
Aug 14 '06 #5

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

Similar topics

9
by: Norm Gibson | last post by:
Hi, I have just written some simple rollover links in a table using CSS classes. It views perfectly in IE but has added a couple of pixels on the top and bottom of the row when you view it in...
6
by: Craig Parsons | last post by:
Folks, I have an image of a circle, which I am trying to straighten out into a flat line. I am essentially wanting to look at the image, and read a straight line from the centre, and then plot...
4
by: Ma Xiaoguang | last post by:
Dear ladies and gentlemen: How to access all the pixels of a bitmap with C#? I am working with Delphi before. In Delphi, you can use TBitmap.Scanline property to access all the pixels of a...
18
by: fishwick | last post by:
I haven't really done any css in quite a while, and am banging my head against the wall trying get the rudimentary layout together of a church website home page to display correctly - I don't want...
2
by: alice | last post by:
I'm trying to create a favicon which I've done before, and it just won't show up. I've even saved the file as a gif and entered the URL of where the file is according to my FTP program, and I get a...
9
by: =?Utf-8?B?Sm9obiBCYWlsZXk=?= | last post by:
I have a ASP .Net page that allows moving around items on the page through javascript. This page works fine in IE. In FireFox however, I have found that if the page is using XHTML 1.0...
0
Screaming Eagle
by: Screaming Eagle | last post by:
Ok, so some associates and I are building a website, and I'm in charge of the design and layout. I've decided to go with a simple navigation bar on top contained in its own div. Under the navigation...
1
by: laredotornado | last post by:
Hi, On both PC IE 7 and Firefox, I'm having this problem. I want a particular table cell to be exactly 142 pixels wide and would prefer the rest to evenly take up the rest of the width. But...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.