Solved

draw line component

Posted on 2001-06-07
3
148 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 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…
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…

749 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