[quoted text, click to view] On 14 =CD=C1=D2, 20:21, gnewsgroup <gnewsgr...@gmail.com> wrote:
> On Mar 14, 12:37 pm, Mad-Hollander <phusakou...@gmail.com> wrote:
>
> Thank you very much. =9ABut, I have little graphics programming
> experience. =9ASo would you mind explaining what each class and major
There is pseudocode of simplier version
abstract class PictureBase // base class for all objects
{
public Rectangle Bounds {get;set;} // contains the topleft
corner (position) of object and its width and height
// when your object has not a rectangle shape, you should
implement you own class for boundaries
public abstract void Draw(Graphics gr); // draws the content
and setup property Bounds
// example - if method draws a rectangle with size (10,10) at
point of topleft corner (100,100), you should use these values for
Bounds property.
public string Tip {get;set;} // the string for showing when
mouse is moving over the objec
public System.Windows.Forms.Cursor Cursor {get;set;} // the
cursor for using when mouse is moving over the object
}
class View // this is usercontrol or panel which contains a canvas
control or it is the class of canvas :-)
{
// to do
// this method shoul be called on each move move event
void TrackMouseMove()
{
// CheckHitTest - the method which uses
PictureBase.Bounds property and determines the object under the mouse
pointer.
//Usually it iterates through all objects and return
an object which Bounds contains mouse position.
PictureBase htObj =3D
CheckHitTest(m_lastMouseMovePos);
if(htObj =3D=3D null)
{
m_canvas.Cursor =3D m_defaultCursor; // set
default cursor
return;
}
if (m_lastHoveredObj !=3D htObj) // another object under
the mouse
{
m_tooltip.Active =3D false;
m_tooltip.SetToolTip(m_canvas, (htObj !=3D
null) ? htObj.Tip : null);
m_tooltip.Active =3D (htObj !=3D null);
m_canvas.Cursor =3D htObject.Cursor;
m_lastHoveredObj =3D htObj;
}
}