Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2002.10.28;
Скачать: CL | DM;

Вниз

Использую DrawFrameControl появляется где надо кнопка, только:   Найти похожие ветки 

 
iNew   (2002-09-16 18:11) [0]

1.Она не нажимается 2. Как перехватить нажатие.
P.S. Я только учусь!


 
Song ©   (2002-09-16 18:18) [1]

WM_NCLBUTTONDOWN


 
iNew   (2002-09-16 18:19) [2]

> Song
Плиз можно по конкретнее.


 
Song ©   (2002-09-16 19:39) [3]

А чего тут конкретней-то?

***************** help **************************
The WM_NCLBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

WM_NCLBUTTONDOWN
nHittest = (INT) wParam; // hit-test value
pts = MAKEPOINTS(lParam); // position of cursor


Parameters

nHittest

Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

pts

Value of lParam. Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.
**********************************************************

Чего здесь непонятного? Перехватываете координаты щелчка, сравниваете с координатами Вашей кнопки, рисуете её нажатой, потом выполняете то действие, что надо выполнить по нажатию этой кнопки.


 
Diamond Cat ©   (2002-09-17 01:44) [4]

конкретный пример
unit Unit1;

interface

uses
Windows, Messages, Forms, Classes, Controls, Buttons, StdCtrls,// YzFrameControl,
ExtCtrls;

type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
function DrawButton(State: Cardinal): boolean;
protected
procedure WndProc(var Message: TMessage); override;
procedure WMNCLButtonDown(var Message: TWMNCLButtonDown ); message WM_NCLButtonDown;
procedure WMNCLButtonUp(var Message: TWMNCLButtonUp ); message WM_NCLButtonUp;
public
procedure ButtonClicked;
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.ButtonClicked;
begin
if height>height-clientheight then height:=height-clientheight else height:=171;
end;

function TForm1.DrawButton(State: Cardinal): boolean;
var
P: TPoint;
R: TRect;
DC: hDC;
begin
GetCursorPos(P);
Dec(P.X, Left);
Dec(P.Y, Top);
R.Left := GetSystemMetrics(SM_CxFrame)+45 + Canvas.TextWidth(Caption);
R.Right := Width - GetSystemMetrics(SM_CxFrame) - 20;
R.Top := GetSystemMetrics(SM_CyFrame)+GetSystemMetrics(SM_CYEDGE);
R.Bottom := GetSystemMetrics(SM_CYSIZE)+GetSystemMetrics(SM_CYEDGE);
Result := (State = 0) or PtInRect(R, P);
if Result
then begin
DC := GetWindowDC(Handle);
try
if height=height-clientheight then DrawFrameControl(DC, R, DFC_SCROLL , DFCS_SCROLLDOWN or State) else
DrawFrameControl(DC, R, DFC_SCROLL , DFCS_SCROLLUP or State)
finally
ReleaseDC(Handle, DC)
end
end;
end;

procedure TForm1.WMNCLButtonDown(var Message: TWMNCLButtonDown);
begin
if not DrawButton(DFCS_Pushed) then inherited
end;

procedure TForm1.WMNCLButtonUp(var Message: TWMNCLButtonUp);
begin
if DrawButton(0) then ButtonClicked else inherited
end;

procedure TForm1.WndProc(var Message: TMessage);
begin
inherited WndProc(Message);
case Message.Msg of
wm_ncactivate,WM_NCCALCSIZE, WM_Activate, WM_ncPaint, WM_WindowPosChanging: DrawButton(0)
end { of case };
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
BorderIcons := BorderIcons - [biminimize];
BorderIcons := BorderIcons - [bimaximize];
borderStyle:=bssizeable;
height:=171;
width:=400;
end;

end.



Страницы: 1 вся ветка

Текущий архив: 2002.10.28;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.016 c
1-92423
Valek
2002-10-16 10:14
2002.10.28
excel numberformat


1-92462
Le!
2002-10-18 08:06
2002.10.28
Сдвиг обьектов при запуске программы на другом компе!


1-92527
Semion
2002-10-16 08:24
2002.10.28
реестор


4-92795
Sahmon
2002-09-16 18:14
2002.10.28
В DLL неправильно считает


1-92611
Cker
2002-10-12 23:58
2002.10.28
А как-бы мне строку, введенную в edit преобразовать в unicode???