Solved

draw line component

Posted on 2001-06-07
3
145 Views
Last Modified: 2010-04-06
hi,

Draw line on canvas is very easy (with Tcanvas).

but to detect when the mouse is on/over that line is not.

I try to search some component but did not find,

any one know component for that purpose.

10x
Asi

0
Comment
Question by:asi
3 Comments
 
LVL 8

Accepted Solution

by:
Cesario earned 50 total points
Comment Utility
Hi asi,

try this component:
http://www.efg2.com/lab/Graphics/LineStretch.htm

Best regards

Cesario
0
 
LVL 3

Expert Comment

by:f15iaf
Comment Utility
l
0
 

Expert Comment

by:BuD
Comment Utility
Try this component i wrote. It has 2 events (OnMouseenter & OnMouseExit).


unit BNS_Shape;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls;

type
  TBNS_Shape = class(TShape)
  private
   FOnMouseEnter : TNotifyEvent;
   FOnMouseExit : TNotifyEvent;
   Leaving : Boolean;
  protected
   procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
   procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
  public
    { Public declarations }
  published
   property OnMouseEnter : TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
   property OnMouseExit : TNotifyEvent read FOnMouseExit write FOnMouseExit;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('BNS Controls', [TBNS_Shape]);
end;

{ TBNS_Shape }

procedure TBNS_Shape.CMMouseEnter(var Message: TMessage);
begin
 if not (csDesigning in ComponentState) then
  begin
   if Assigned(FOnMouseEnter) then
    FOnMouseEnter(Self);
  end;
end;

procedure TBNS_Shape.CMMouseLeave(var Message: TMessage);
begin
 if Leaving then exit;
 Leaving := True;
 try
  if not (csDesigning in ComponentState) then
   begin
    if Assigned(OnMouseExit) then
     FOnMouseExit(Self);
   end;
 finally
  Leaving := False;
 end;
end;

end.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now