473,699 Members | 2,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 MouseDoubleClic k event with the following code:

Dim position as Point
position=Contro l.MousePostion
tijd=position.X
height=position .Y

Now it seems that the height is in screencoordinat es, not in
graphicscoordin ates, 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
graphicscoordin ates?
--
Groeten,
Jaap Bos
Aug 11 '06 #1
4 1091
Jaap Bos wrote:
Is there a better way to get the coordinates in a graphics window in
graphicscoordin ates?
Control.PointTo Client and Control.PointTo Screen will convert back and
forth for you.
--
Larry Lard
la*******@googl email.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*******@goog lemail.com>
Jaap Bos wrote:
>Is there a better way to get the coordinates in a graphics window in
graphicscoordi nates?

Control.PointTo Client and Control.PointTo Screen 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*******@goog lemail.com>
>Jaap Bos wrote:
>>Is there a better way to get the coordinates in a graphics window in
graphicscoord inates?
Control.PointT oClient and Control.PointTo Screen 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.n et/>

--
Larry Lard
la*******@googl email.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*******@goog lemail.comschre ef
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.n et/>

--
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
1858
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 Mozilla. Please have a look at http://www.dovenetq.net.au/~gabrielle/ The CSS for the links are:
6
2981
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 this on a graph. Then I want to rotate the image 1 degree and read the next line down, if you see what I mean. My question is, how do I determine how many pixels wide I should read, in order not to miss anything out? IE: If I rotate it 1...
4
23870
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 bitmap object. How to do this with C#? Any hints? Thank you very much. Best regards. Xiaoguang
18
2486
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 to continue work until I understand what I'm doing wrong. http://www.christchurchinfo.net The site displays nicely in Firefox/Mozilla and Safari, but the stained glass windows navigation portion is getting pushed down in IE, and the "news"...
2
4207
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 File Cannot Be Found error. I've copied the pixels from the file and pasted them into a favicon that is working and showing up, renamed it by just adding a number to the end, and still it won't show up, either as an .ico or a .gif. So I've...
9
1989
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 Transitional as the doctype, you cannot set the style.left and style.top properties of image or div tags. If you remove the doctype from the page it works just fine, although I would rather not do this. You can work around this by setting the cssText...
0
3148
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 bar, I have two iframes contained in one div and each iframe in its own inside the container div. In theory it was supposed to have shown the user statistics to the left at a width of 160 pixels and lowered from the top at 73 pixels. That displays...
1
3004
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 this code isn't working (the table cell is getting much bigger than 142 pixels): <table align="center" cellpadding="0" cellspacing="0" class="sidebarText" width="1"> <tr><td colspan="6" align="center"><img src="images/
0
8687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9174
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...
1
8914
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
7750
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...
0
4376
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...
0
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.