Solved

draw line component

Posted on 2001-06-07
3
146 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
ID: 6166642
Hi asi,

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

Best regards

Cesario
0
 
LVL 3

Expert Comment

by:f15iaf
ID: 6166779
l
0
 

Expert Comment

by:BuD
ID: 6166858
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

16 Experts available now in Live!

Get 1:1 Help Now