Hello,
I think this may be my problem here. Each bar is it's own class, because it
holds other data like start date, end date, number of people working on
project, etc. The class has its own render method which is called from the
controls OnPaint event as it goes through each bar object (I have an array
list of bar objects which the OnPaint method goes through and calls their
render method) to draw it on the control. Now, please tell me if I am doing
this incorrectly, is this how I should do it? if so how would i create an
array of rectangles in the main control to look for the bar objects? Here's
an example of the Bar class (simplified version with just data and the
render stub)
Public Class BarObject
Private d_StartDate as date
Private d_EndDate as date
Private i_WorkerCount as integer
public property GetStartDate...
public property GetEndDate...
public property GetWorkerCount. ..
Public Sub Render(byval e as PaintEventArgs)
'/// Do Rendering of bar here on control
e.graphics.draw rectangle....
End Sub
thats a quick example...
now what I want to do is have the control when the user places the mouse
over a bar show a tooltip that says the worker count, start, and end date.
all the rendering I know how to do on my own. it's just the mouse
interaction that is getting me. I did see somewhere on vbacellerator (one of
the outlook style listbar classes) that they created an IMouseObject
implementation that had MouseOver MouseMove.. stuff like that and
implemented it in their object...
I guess what I need to see is example code... all the code I have loooked at
has so much else in it (like the outlook bar on vbacellerator) that just
distracts my thinking...
End Class
"yEaH rIgHt" <no******@haha. com> wrote in message
news:10******** *****@corp.supe rnews.com...
Use an array of Rectangle objects and use the rectangles Contains method.
'-- Sample
Dim r As New Rectangle(1, 10, 20, 40)
If r.Contains(e.Y, e.Y) then
'-- I'm hit
End If
Brian Henry wrote:
yes that part i get, but how do i determain which bar i drew on the
screen is the one that the mouse had interaction with
"Sven Groot" <sv*******@gmx. net> wrote in message
news:Oy******** ******@TK2MSFTN GP09.phx.gbl...
Brian Henry wrote:
Hello,
I am trying to make a user control that is interactive. What I am
doing is drawing a set of bars on a control similar to a gantt chart
and allowing a user to place the mouse over them to see a tool tip,
or if you click on them to open a form associated with data tied
behind them.
Basically you need to capture mouse events of whatever container you're
drawing the bars on, and use the mouse coordinates to determine yourself
over which bar the mouse is positioned.
--
Sven Groot