Solved

draw line component

Posted on 2001-06-07
3
147 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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