Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[5764] [답변] KING2ND/ 이거 어떻게 하는지 가르쳐 주세요...
쉰들러 [ ] 929 읽음    1999-02-20 12:50
아래를 참고하세요...이건 델파이코리아에서 가져온 소스인데
아주 간단해요 CM_MOUSELEAVE와 CM_MOUSEENTER메세지를 가로 채서
라벨의 속성을 바꾸는 것입니다.
unit hottrack;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Shellapi;

type
TForm1 = class(TForm)
  Label1: TLabel;
  Label2: TLabel;
  procedure Label1Click(Sender: TObject);
  procedure Label2Click(Sender: TObject);
private
  { Private declarations }
  procedure Wndproc(var kmessage: Tmessage); override;
public
  { Public declarations }
  procedure changelabel(Sender: TObject; Imessage: integer);
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure Tform1.Wndproc(var kmessage: Tmessage);
begin
inherited WndProc(KMessage);
if kMessage.LParam = longint(label1) then
   changelabel(label1, kmessage.msg);
if kMessage.LParam = longint(label2) then
   changelabel(label2, kmessage.msg);
end;

procedure Tform1.changelabel(Sender: TObject; Imessage: integer);
begin
if Sender is Tlabel then
begin
  if Imessage = CM_MOUSELEAVE then
  begin
    (Sender as Tlabel).font.Color := clblack;
    (Sender as Tlabel).Font.Style := [];
     Screen.Cursor := crDefault;
  end;
  if Imessage = CM_MOUSEENTER then
  begin
    (Sender as Tlabel).font.Color := clblue;
    (Sender as Tlabel).Font.Style := [fsunderline];
     Screen.Cursor := crHandPoint;
  end;
end;
end;


end.

음 그리고 두번째 질문은 PTinRECT 함수를 이용하면 되겠군요
BOOL PtInRect(

    CONST RECT *lprc, // address of structure with rectangle
    POINT pt  // structure with point
   );

어떤 폼의 영역(RECT)에 마우스포인터가 위치하고 있는 지를 알려주는
함수 입니다.
예를 들자면
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if PtInRect(Rect(48, 32,48 + 249, 32+249), POint(x,y)) then begin
     Form1.Cursor  := crHandPoint;
  end
  else
     Form1.Cursor  := crDefault;
end;

와 같이 하면 되겠습니다.

도움이 되셨죠.... 인재였습니다...오랜만에 답변을 하네요...


+ -

관련 글 리스트
5764 [답변] KING2ND/ 이거 어떻게 하는지 가르쳐 주세요... 쉰들러 929 1999/02/20
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.