태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

[델파이소스] 폼이 화면 밖으로 나가지 못하게

|

폼들이 화면 밖으로 나가지 못하게 하려할때!
포인트 : WM_WINDOWPOSCHANGING 후킹

interface

uses

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

type
TForm1 = class(TForm)

private
   { Private declarations }
   procedure WMWindowPosChanging(var Message: TWMWindowPosChanging); message    
WM_WINDOWPOSCHANGING;
public
   { Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}



procedure TForm1.WMWindowPosChanging(var Message: TWMWindowPosChanging);
begin
  with Message.WindowPos^ do
  begin
    // Message.WindowPos^의 좌표를 이용해 폼이 데스크탑의 밖으로 나갈때
    // 가로채서 바탕화면의 가장자리에 붙여버린다.

    // 아래는 왼쪽 가장자리.. x : x 좌표 y : y 좌표, cx : 너비 cy :높이
    if X < 30 then x := 0;
    if Y < 30 then Y := 0;
    if X > Screen.Width - cx - 30 then X := Screen.Width - cx;
    if Y > Screen.Height - cy - 30 then Y := Screen.Height - cy;
  end;
end;

end.  

크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 And Comment 0
prev | 1 ... | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 ... | 273 | next