473,654 Members | 3,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clicking on a path between points

Hi

I am drawing two points (which could have any coordinates), and a path between them. The problem is, I want to know when a user clicks on this path between them. I am confused as to how I would do this. Do I have to get deep into math to calculate the linear path from one point to another, and then manually check if the coords of the mouse line up on this line? Is there a .NET function already for this

Also, I'm pretty sure this is not possible, but is there any way to tie an event handler to a specific thing happening? Like, can I specify that when a user scrolls over a certain region of the form, a certain event will be fired? I'm guessing not, and that I have to consume the MouseOver event and just check if the mouse is in that region..

Thanks

Yaron
Nov 16 '05 #1
1 1354
The GDI+ FAQ has an article on hit-testing lines that will help you.

--
Bob Powell [MVP]
Visual C#, System.Drawing

All you ever wanted to know about ListView custom drawing is in Well Formed.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

*RSS*RSS*RSS*RS S*RSS*RSS*RSS*R SS*RSS*RSS*RSS* RSS*RSS*

The GDI+ FAQ: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://royo.is-a-geek.com/siteFeeder...aspx?FeedId=41

*RSS*RSS*RSS*RS S*RSS*RSS*RSS*R SS*RSS*RSS*RSS* RSS*RSS*

"Yaron" <an*******@disc ussions.microso ft.com> wrote in message
news:DA******** *************** ***********@mic rosoft.com...
Hi,

I am drawing two points (which could have any coordinates), and a path between them. The problem is, I want to know when a user clicks on this path
between them. I am confused as to how I would do this. Do I have to get deep
into math to calculate the linear path from one point to another, and then
manually check if the coords of the mouse line up on this line? Is there a
..NET function already for this?
Also, I'm pretty sure this is not possible, but is there any way to tie an event handler to a specific thing happening? Like, can I specify that when a
user scrolls over a certain region of the form, a certain event will be
fired? I'm guessing not, and that I have to consume the MouseOver event and
just check if the mouse is in that region...
Thanks!

Yaron

Nov 16 '05 #2

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

Similar topics

31
3900
by: John Roth | last post by:
I'm adding a thread for comments on Gerrit Holl's pre-pep, which can be found here: http://tinyurl.com/2578q Frankly, I like the idea. It's about time that all of the file and directory stuff in the os module got objectified properly (or at least with some semblance of OO propriety!) In the issues section:
70
4072
by: Michael Hoffman | last post by:
Many of you are familiar with Jason Orendorff's path module <http://www.jorendorff.com/articles/python/path/>, which is frequently recommended here on c.l.p. I submitted an RFE to add it to the Python standard library, and Reinhold Birkenfeld started a discussion on it in python-dev <http://mail.python.org/pipermail/python-dev/2005-June/054438.html>. The upshot of the discussion was that many python-dev'ers wanted path added to the...
34
3245
by: Reinhold Birkenfeld | last post by:
Hi, the arguments in the previous thread were convincing enough, so I made the Path class inherit from str/unicode again. It still can be found in CVS: /python/nondist/sandbox/path/{path.py,test_path.py} One thing is still different, though: a Path instance won't compare to a regular string.
0
1035
by: James dean | last post by:
I have a problem in performance when there are many points in the path. When updating one point in the path i redraw the whole path again. This i guess is the problem. What is the most efficient way to update one point in a path with many points?. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
2
2320
by: James dean | last post by:
When i draw a path with many points the editing becomes slow. I ran devPartner and it said that the GDI+ method "GetPathPoints" was taking up alot of processing time. Also GetPathOutline is slow. Has anybody got advice on the most efficient way to draw paths in C#. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
0
873
by: flipdoubt | last post by:
Are there any specialized methods for determining whether a path or UNC points to a location within a site's web directories? Are there any methods for turning an absolute path into a relative URL? My app has UNCs stored in a database and needs to serve the files that the UNC points to. If the UNC is within the site, I just need to return a relative path. If it isn't, I need to copy the file to a public cache and return a relative path...
2
1672
by: theinvisibleGhost | last post by:
Subject says it all really. I'm being passed a string, and I'm wondering if theres an easy way to determine what exactly the string points at? Cheers Chris.
7
2944
by: ApexData | last post by:
Hello I currently Link the FE/BE using the LinkTables Option and the Linked Table Manager. Any time I need to move the BE to another location, I have to go through this process over again. I need the flexibility of being able to move the BE data to wherever I want, without manually going through this process. I just want to change the Path/Filename that I keep in a FE Table. I want to be able to place a Path/Filename in a FE Table...
0
1397
by: MrColeyted | last post by:
I am designing an app that is similar to Windows Explorer. I have all working well. By clicking a directory in the treeview, the folders and files for that directory are displayed in the listview. I want to know how to: By clicking a folder in the listview, expand and repopulate the corresponding node in the treeview. I have literally tried everything that I can think of, and I cannot get anything to work. This is for an assignment in...
0
8815
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
8708
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...
0
8594
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
7307
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
6161
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
5622
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
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2716
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
2
1596
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.