?
Solved

Visual Basic 6.0 Mouse_Over/Hover to display Graph information

Posted on 2005-05-03
9
Medium Priority
?
632 Views
Last Modified: 2013-12-20
Hello everyone,
We have a system written in Visual Basic 6.0.  On the splash screen there are two pie charts.  I've been given the task of setting the setting the form up so when you hover over a section of the pie chart with your mouse it will display the data for that slice of the pie.  Any idea how to do this?  It seems every other application/development tool has this built in but VB 6.

I appreciate any help or ideas you have.

bfitch01
0
Comment
Question by:bfitch01
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 10

Expert Comment

by:edwardiii
ID: 13920897
Hi, bfitch01.

You could use a picture boxes MouseDown event as shown at this EE post:

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/VB_Controls/Q_20422895.html

Or, you could create an html page that mirrors the look of your splash screen (e.g. whatever text in addition to the two pie charts), and use image mapping to link to images/text that open in their own Web pages or as stand-alone images.  Then build a new splash page by filling a userform with a WebBrowser control, and setting BorderStyle to 0 (if desired).  Whenever users click on different sections of your new splash page, different data/images will popup.
0
 
LVL 10

Assisted Solution

by:edwardiii
edwardiii earned 450 total points
ID: 13921003
Addition to the picturebox solution--you can get exact ranges by clicking on start/end points and doing:

     MsgBox "X= " & X & "     Y= " & Y

Once you've got the ranges down you can use IF/Then statements or Select/Case statements:

     If X >= 1000 And X <= 2000 And Y >= 405 And Y <= 1000 Then
         'cause a new image to appear (for example, in a separate userform.
     End If    
0
 
LVL 10

Accepted Solution

by:
fds_fatboy earned 450 total points
ID: 13921765
The easiest way is to use MouseOver to get the X and Y location of a picturebox with your pie chart, use the X and Y to work out which slice you are over and place the details into the into the tooltiptext property of the control. Failing that, to get true MouseHover events you will have to subclass the picturebox control.
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 

Author Comment

by:bfitch01
ID: 13921802
These charts are updated daily.  It sounds like the X/Y solution will only be valid for a static chart.  Is my interpretation correct?
0
 
LVL 10

Expert Comment

by:fds_fatboy
ID: 13921825
No. Why should that be?
0
 
LVL 10

Expert Comment

by:fds_fatboy
ID: 13921862
Sorry, I meant, if you have the data that produces the charts then it should be easy, just a bit of trigonometry. It would be easier still if you
draw the pie charts straight into the picture boxes. Also, you could look up the colour of the pixel under the mouse pointer this could be used to get which slice you are over.
If you don't have the data then you may be stuffed.
0
 
LVL 10

Expert Comment

by:edwardiii
ID: 13922397
Good questions regarding dynamic charts.  How are the charts added to the splash screen (e.g. what is the source of your charts)?
0
 
LVL 8

Expert Comment

by:tonsofpcs
ID: 13931347
You basically need to build an Image map and calculate what pixels are within the regions.
0
 

Author Comment

by:bfitch01
ID: 13931923
They are built through a feed from SQL Server.  I figured out how to do it.  Thanks everyone for the help.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question