Q&A
HOME
Tips & Tech
Q&A
Discuss
Download
자유게시판
홍보 / 광고
구인 / 구직
LOGIN
회원가입
Titlebar에 버튼달기?
Titlebar에 버튼같은 임의의 컴포넌트를 달수있나여?
제목을 없앤뒤 바를 그려넣는 방법말고 말이져..
2
COMMENTS
최석기
•
2000.07.10 23:06
한상훈 wrote:
> Titlebar에 버튼같은 임의의 컴포넌트를 달수있나여?
> 제목을 없앤뒤 바를 그려넣는 방법말고 말이져..
>
캡션바에 버튼 올리는 방법입니다..
unit Main;
interface
uses
Windows, Buttons, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormResize(Sender: TObject);
private
CaptionBtn : TRect;
procedure DrawCaptButton;
procedure WMNCPaint(var Msg : TWMNCPaint); message WM_NCPaint;
procedure WMNCActivate(var Msg : TWMNCActivate); message WM_NCACTIVATE;
procedure WMSetText(var Msg : TWMSetText); message WM_SETTEXT;
procedure WMNCHitTest(var Msg : TWMNCHitTest); message WM_NCHITTEST;
procedure WMNCLButtonDown(var Msg : TWMNCLButtonDown); message WM_NCLBUTTONDOWN;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
const
htCaptionBtn = htSizeLast + 1;
{$R *.DFM}
procedure TForm1.DrawCaptButton;
var
xFrame,
yFrame,
xSize,
ySize : Integer;
R : TRect;
begin
//Dimensions of Sizeable Frame
xFrame := GetSystemMetrics(SM_CXFRAME);
yFrame := GetSystemMetrics(SM_CYFRAME);
//Dimensions of Caption Buttons
xSize := GetSystemMetrics(SM_CXSIZE);
ySize := GetSystemMetrics(SM_CYSIZE);
//Define the placement of the new caption button
//next to the existing caption buttons
CaptionBtn := Bounds(Width - xFrame - 4*xSize + 2,
yFrame + 2, xSize - 2, ySize - 4);
//Get the handle to canvas using Form's device context
Canvas.Handle := GetWindowDC(Self.Handle);
Canvas.Font.Name := 'Symbol';
Canvas.Font.Color := clBlue;
Canvas.Font.Style := [fsBold];
Canvas.Pen.Color := clYellow;
Canvas.Brush.Color := clBtnFace;
try
DrawButtonFace(Canvas, CaptionBtn, 1, bsAutoDetect, False, False, False);
//Define a smaller drawing rectangle within the button
R := Bounds(Width - xFrame - 4 * xSize + 2,
yFrame + 3, xSize - 6, ySize - 7);
with CaptionBtn do
Canvas.TextRect(R, R.Left + 2, R.Top - 1, 'W');
finally
//Get rid of the device context and set the canvas handle to default
ReleaseDC(Self.Handle, Canvas.Handle);
Canvas.Handle := 0;
end;
end;
//This traps the default form painting
procedure TForm1.WMNCPaint(var Msg : TWMNCPaint);
begin
inherited;
DrawCaptButton;
end;
//This traps form activation
procedure TForm1.WMNCActivate(var Msg : TWMNCActivate);
begin
inherited;
DrawCaptButton;
end;
//This traps any text being sent to the window
procedure TForm1.WMSetText(var Msg : TWMSetText);
begin
inherited;
DrawCaptButton;
end;
//This traps when the form's caption bar is hit with a mouse
procedure TForm1.WMNCHitTest(var Msg : TWMNCHitTest);
begin
inherited;
with Msg do
if PtInRect(CaptionBtn, Point(XPos - Left, YPos - Top)) then
Result := htCaptionBtn;
end;
//Traps a left-click on the caption bar
procedure TForm1.WMNCLButtonDown(var Msg : TWMNCLButtonDown);
begin
inherited;
if (Msg.HitTest = htCaptionBtn) then
ShowMessage('You hit the button on the caption bar');
end;
//Have to perform an NC_ACTIVATE when the form is resized
//so that the caption bar and button are redrawn. This is
//necessary because Win95/NT4+ draw all buttons relative to the
//right side of a window.
procedure TForm1.FormResize(Sender: TObject);
begin
//Force a redraw of caption bar if form is resized
Perform(WM_NCACTIVATE, Word(Active), 0);
end;
end.
0
0
삭제
수정
댓글
톰과 제리
•
2000.07.09 07:56
RA라이브러리에 컴포가 있습니다.
글구 이건 예젭니다.
그럼 사랑과 정의의 이름으로 ...
kl
type
TForm1 = class(TForm)
procedure FormResize(Sender: TObject);
private
{ Private declarations }
public
CaptionBtn : TRect;
procedure DrawCaptButton;
procedure WMNCPaint(var Msg : TWMNCPaint); message WM_NCPaint;
procedure WMNCActivate(var Msg : TWMNCActivate); message WM_NCACTIVATE;
procedure WMSetText(var Msg : TWMSetText); message WM_SETTEXT;
procedure WMNCHitTest(var Msg : TWMNCHitTest); message WM_NCHITTEST;
procedure WMNCLButtonDown(var Msg : TWMNCLButtonDown); message WM_NCLBUTTONDOWN;
end;
var
Form1: TForm1;
implementation
uses Buttons;
{$R *.DFM}
const
htCaptionBtn = htSizeLast + 1;
procedure TForm1.DrawCaptButton;
var
xFrame,
yFrame,
xSize,
ySize : Integer;
R : TRect;
begin
//Dimensions of Sizeable Frame
xFrame := GetSystemMetrics(SM_CXFRAME);
yFrame := GetSystemMetrics(SM_CYFRAME);
//Dimensions of Caption Buttons
xSize := GetSystemMetrics(SM_CXSIZE);
ySize := GetSystemMetrics(SM_CYSIZE);
//Define the placement of the new caption button
//next to the existing caption buttons
CaptionBtn := Bounds(Width - xFrame - 4*xSize + 2,
yFrame + 2, xSize - 2, ySize - 4);
//Get the handle to canvas using Form's device context
Canvas.Handle := GetWindowDC(Self.Handle);
Canvas.Font.Name := 'Symbol';
Canvas.Font.Color := clBlue;
Canvas.Font.Style := [fsBold];
Canvas.Pen.Color := clYellow;
Canvas.Brush.Color := clBtnFace;
try
DrawButtonFace(Canvas, CaptionBtn, 1, bsAutoDetect, False, False, False);
//Define a smaller drawing rectangle within the button
R := Bounds(Width - xFrame - 4 * xSize + 2,
yFrame + 3, xSize - 6, ySize - 7);
with CaptionBtn do
Canvas.TextRect(R, R.Left + 2, R.Top - 1, 'W');
finally
//Get rid of the device context and set the canvas handle to default
ReleaseDC(Self.Handle, Canvas.Handle);
Canvas.Handle := 0;
end;
end;
//This traps the default form painting
procedure TForm1.WMNCPaint(var Msg : TWMNCPaint);
begin
inherited;
DrawCaptButton;
end;
//This traps form activation
procedure TForm1.WMNCActivate(var Msg : TWMNCActivate);
begin
inherited;
DrawCaptButton;
end;
//This traps any text being sent to the window
procedure TForm1.WMSetText(var Msg : TWMSetText);
begin
inherited;
DrawCaptButton;
end;
//This traps when the form's caption bar is hit with a mouse
procedure TForm1.WMNCHitTest(var Msg : TWMNCHitTest);
begin
inherited;
with Msg do
if PtInRect(CaptionBtn, Point(XPos - Left, YPos - Top)) then
Result := htCaptionBtn;
end;
//Traps a left-click on the caption bar
procedure TForm1.WMNCLButtonDown(var Msg : TWMNCLButtonDown);
begin
inherited;
if (Msg.HitTest = htCaptionBtn) then
ShowMessage('You hit the button on the caption bar');
end;
procedure TForm1.FormResize(Sender: TObject);
begin
Perform(WM_NCACTIVATE, Word(Active), 0);
end;
end.
한상훈 wrote:
> Titlebar에 버튼같은 임의의 컴포넌트를 달수있나여?
> 제목을 없앤뒤 바를 그려넣는 방법말고 말이져..
>
0
0
삭제
수정
댓글
(NOTICE) You must be
logged in
to comment on this post.
한상훈
•
2000.07.10 05:29
2
COMMENTS
/
0
LIKES
Class내 정의된 procedure내에서 자신지정은?
밥벌레
•
2000.07.14 16:58
한상훈 wrote: > 초보라 잘 몰라서 물어요.. > > type > TMy=class > i:byte; > procedur...
한상훈
•
2000.07.15 11:57
밥벌레 wrote: > 한상훈 wrote: > > 초보라 잘 몰라서 물어요.. > > > > type > > TMy=class > > ...
어린왕자
2000.07.10 04:42
0
COMMENTS
/
0
LIKES
델파이가 이상혀요..날씨가 더워서 그런가? 앤이 없어서 그런가?
한상훈
•
2000.07.10 01:34
1
COMMENTS
/
0
LIKES
create했나?
Black}{ole
•
2000.07.10 01:50
한상훈 wrote: > 초보라 잘몰라서 물어요.. > > type > TMy=class > object1:Tobject1; > end; ...
한상훈
•
2000.07.09 23:03
9
COMMENTS
/
0
LIKES
begin-end와 exit의 차이?
양병규
•
2000.07.10 11:28
임형호
•
2000.07.10 14:36
한상훈
•
2000.07.10 13:32
임형호
•
2000.07.09 23:16
한상훈
•
2000.07.10 00:29
임형호
•
2000.07.10 04:49
한상훈
•
2000.07.10 07:32
• • •
헬프미
2000.07.09 09:42
0
COMMENTS
/
0
LIKES
FTP 업로드시....
parkisu
2000.07.09 09:04
0
COMMENTS
/
0
LIKES
InterBase6.0 에 대해서...
이승리
•
2000.07.09 08:26
2
COMMENTS
/
0
LIKES
폼크기 변경안돼요..
Mr.Q
•
2000.07.10 08:24
이승리 wrote: > 안녕하세요.. > > 폼크기를 최대한 작게 할려는데, Width 속성 100 이하로 안돼네요.....
Mr.Q
•
2000.07.21 13:52
Mr.Q wrote: > 이승리 wrote: > > 안녕하세요.. > > > > 폼크기를 최대한 작게 할려는데, Width 속성 ...
이승리
2000.07.09 07:59
0
COMMENTS
/
0
LIKES
폼 바탕에 그림을 계속해서 바꿔주려고하는데..
한상훈
•
2000.07.09 07:11
2
COMMENTS
/
0
LIKES
Titlebar에 버튼달기?
Titlebar에 버튼같은 임의의 컴포넌트를 달수있나여? 제목을 없앤뒤 바를 그려넣는 방법말고 말이져..
최석기
•
2000.07.10 23:06
한상훈 wrote: > Titlebar에 버튼같은 임의의 컴포넌트를 달수있나여? > 제목을 없앤뒤 바를 그려넣는 방...
톰과 제리
•
2000.07.09 07:56
RA라이브러리에 컴포가 있습니다. 글구 이건 예젭니다. 그럼 사랑과 정의의 이름으로 ... kl type...
유레카
2000.07.09 05:31
0
COMMENTS
/
0
LIKES
InterBase에서 UpdateSql 사용..
김종근
•
2000.07.09 03:05
1
COMMENTS
/
0
LIKES
html에서 ActiveX로 Parameter 전달은 어떻게 ?
김진호
•
2000.07.10 22:02
김종근 wrote: > > 제가 하려고 하는 목적은 Html에서 화일명을 ActiveX가 전달받아 화면의 > Active...
나그네
•
2000.07.09 02:14
1
COMMENTS
/
0
LIKES
기타
타락천사
•
2000.07.09 02:31
안녕하세여..타락임다.. -- 왜 그런 질문을? ?_? 델파이에는 출력콤포넌트가 기본적으로 들어가 있어...
아리엘
•
2000.07.09 00:19
2
COMMENTS
/
0
LIKES
사운드 효과를 넣고 시픈데 윈도우꺼 쓰는 법은??
Black}{ole
•
2000.07.09 00:43
아리엘 wrote: > 안녕하세요 이번엔 사운드 입니다. > > 그냥 wav플레이는 알겠는데 꼭 디렉토리 지정...
김진호
•
2000.07.10 22:19
Black}{ole wrote: > 아리엘 wrote: > > 안녕하세요 이번엔 사운드 입니다. > > > > 그냥 wav플레이는...
바다
2000.07.08 23:22
0
COMMENTS
/
0
LIKES
NT WorkStation 에서 Qreport 미리보기시 Access Vaiolation
한상훈
•
2000.07.08 22:40
1
COMMENTS
/
0
LIKES
MDI Form에서 OnKeyDown사용
병부잡이
•
2000.07.09 16:49
한상훈 wrote: > MDI Form에서 단축키를 사용하려고 OnKeyDown에 코드를 했지만 반응이 없네요.. > 물론 ...
한상훈
•
2000.07.08 22:31
1
COMMENTS
/
0
LIKES
ActionList의 필요성, Drag구별
최용일
•
2000.07.08 23:48
안녕하세요. 최용일입니다. 파라매터중에 Source가 있죠. 이것이 드래그 시작 객체입니다. if Source...
이주승
•
2000.07.08 21:15
3
COMMENTS
/
0
LIKES
MediaPlayer 콤포넌트 관련 질문임. 원인과 대책 고수의 도움바랍니다.
무명
•
2000.07.08 21:50
이주승 wrote: > MediaPlayer 콤포넌트를 이용해 간단한 MP3 파일 들어보기 프로그램을 작성했음. > 그런...
이주승
•
2000.07.08 22:32
무명 wrote: > 이주승 wrote: > > MediaPlayer 콤포넌트를 이용해 간단한 MP3 파일 들어보기 프로그램을 ...
이경문
•
2000.07.13 02:30
MP3를 지원하는 컴포넌트를 사용해 보세요. DLL이 필요한데 필요한 DLL 및 EXE만 있으면 됩니다. http://...
홍승현
2000.07.08 21:13
0
COMMENTS
/
0
LIKES
richedit -> oracle로 그대로 저장????
용이사랑
2000.07.08 21:06
0
COMMENTS
/
0
LIKES
컴포넌트 제작
김종석
2000.07.08 20:49
0
COMMENTS
/
0
LIKES
Delphi4 와 Delphi5 의 차이점....파일을 찾을 수 업대요..
한상훈
2000/07/09 07:11
Views
452
Likes
0
Comments
2
Reports
0
Tag List
수정
삭제
목록으로
한델 로그인 하기
로그인 상태 유지
아직 회원이 아니세요? 가입하세요!
암호를 잊어버리셨나요?
> Titlebar에 버튼같은 임의의 컴포넌트를 달수있나여?
> 제목을 없앤뒤 바를 그려넣는 방법말고 말이져..
>
캡션바에 버튼 올리는 방법입니다..
unit Main;
interface
uses
Windows, Buttons, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormResize(Sender: TObject);
private
CaptionBtn : TRect;
procedure DrawCaptButton;
procedure WMNCPaint(var Msg : TWMNCPaint); message WM_NCPaint;
procedure WMNCActivate(var Msg : TWMNCActivate); message WM_NCACTIVATE;
procedure WMSetText(var Msg : TWMSetText); message WM_SETTEXT;
procedure WMNCHitTest(var Msg : TWMNCHitTest); message WM_NCHITTEST;
procedure WMNCLButtonDown(var Msg : TWMNCLButtonDown); message WM_NCLBUTTONDOWN;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
const
htCaptionBtn = htSizeLast + 1;
{$R *.DFM}
procedure TForm1.DrawCaptButton;
var
xFrame,
yFrame,
xSize,
ySize : Integer;
R : TRect;
begin
//Dimensions of Sizeable Frame
xFrame := GetSystemMetrics(SM_CXFRAME);
yFrame := GetSystemMetrics(SM_CYFRAME);
//Dimensions of Caption Buttons
xSize := GetSystemMetrics(SM_CXSIZE);
ySize := GetSystemMetrics(SM_CYSIZE);
//Define the placement of the new caption button
//next to the existing caption buttons
CaptionBtn := Bounds(Width - xFrame - 4*xSize + 2,
yFrame + 2, xSize - 2, ySize - 4);
//Get the handle to canvas using Form's device context
Canvas.Handle := GetWindowDC(Self.Handle);
Canvas.Font.Name := 'Symbol';
Canvas.Font.Color := clBlue;
Canvas.Font.Style := [fsBold];
Canvas.Pen.Color := clYellow;
Canvas.Brush.Color := clBtnFace;
try
DrawButtonFace(Canvas, CaptionBtn, 1, bsAutoDetect, False, False, False);
//Define a smaller drawing rectangle within the button
R := Bounds(Width - xFrame - 4 * xSize + 2,
yFrame + 3, xSize - 6, ySize - 7);
with CaptionBtn do
Canvas.TextRect(R, R.Left + 2, R.Top - 1, 'W');
finally
//Get rid of the device context and set the canvas handle to default
ReleaseDC(Self.Handle, Canvas.Handle);
Canvas.Handle := 0;
end;
end;
//This traps the default form painting
procedure TForm1.WMNCPaint(var Msg : TWMNCPaint);
begin
inherited;
DrawCaptButton;
end;
//This traps form activation
procedure TForm1.WMNCActivate(var Msg : TWMNCActivate);
begin
inherited;
DrawCaptButton;
end;
//This traps any text being sent to the window
procedure TForm1.WMSetText(var Msg : TWMSetText);
begin
inherited;
DrawCaptButton;
end;
//This traps when the form's caption bar is hit with a mouse
procedure TForm1.WMNCHitTest(var Msg : TWMNCHitTest);
begin
inherited;
with Msg do
if PtInRect(CaptionBtn, Point(XPos - Left, YPos - Top)) then
Result := htCaptionBtn;
end;
//Traps a left-click on the caption bar
procedure TForm1.WMNCLButtonDown(var Msg : TWMNCLButtonDown);
begin
inherited;
if (Msg.HitTest = htCaptionBtn) then
ShowMessage('You hit the button on the caption bar');
end;
//Have to perform an NC_ACTIVATE when the form is resized
//so that the caption bar and button are redrawn. This is
//necessary because Win95/NT4+ draw all buttons relative to the
//right side of a window.
procedure TForm1.FormResize(Sender: TObject);
begin
//Force a redraw of caption bar if form is resized
Perform(WM_NCACTIVATE, Word(Active), 0);
end;
end.