Вот пример из моей програмки, может поможет.
Я не стал ни чего удалять.
Код: Выделить всё
unit Menur;
interface
uses
Windows, Controls, StdCtrls, Classes, ExtCtrls, Forms, Messages, Graphics,
Buttons, Dan;
type
TMenur = class(TForm)
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Shape5: TShape;
Shape6: TShape;
Shape7: TShape;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
BitBtn1: TBitBtn;
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
procedure WMNCHITTEST(var Msg: TMessage); message WM_NCHITTEST;
public
{ Public declarations }
end;
var
Form_Menur: TMenur;
implementation
{$R *.dfm}
procedure TMenur.WMNCHITTEST(var Msg: TMessage);
begin
Msg.Result:=HTCAPTION;
end;
procedure TMenur.FormActivate(Sender: TObject);
var
Rgn1,Rgn2,Rgn3,Rgn4,Rgn5,Rgn6,Rgn7: HRGN;
begin
with Shape1 do
Rgn1:=CreateRectRgn(Left,Top,Left+Width,Top+Height);
with Shape2 do
Rgn2:=CreateRoundRectRgn(Left,Top,Left+Width,Top+Height,15,15);
with Shape3 do
Rgn3:=CreateRectRgn(Left,Top,Left+Width,Top+Height);
with Shape4 do
Rgn4:=CreateRectRgn(Left,Top,Left+Width,Top+Height);
with Shape5 do
Rgn5:=CreateRectRgn(Left,Top,Left+Width,Top+Height);
with Shape6 do
Rgn6:=CreateRoundRectRgn(Left,Top,Left+Width,Top+Height,15,15);
with Shape7 do
Rgn7:=CreateRoundRectRgn(Left,Top,Left+Width,Top+Height,15,15);
// with Shape6 do
// Rgn8:=CreateRoundRectRgn(Left,Top,Left+Width,Top+Height,15,15);
if CombineRgn(Rgn1,Rgn1,Rgn2,RGN_OR)<>ERROR then
if CombineRgn(Rgn1,Rgn1,Rgn3,RGN_DIFF)<>ERROR then
if CombineRgn(Rgn1,Rgn1,Rgn4,RGN_OR)<>ERROR then
if CombineRgn(Rgn1,Rgn1,Rgn5,RGN_OR)<>ERROR then
if CombineRgn(Rgn1,Rgn1,Rgn6,RGN_DIFF)<>ERROR then
if CombineRgn(Rgn1,Rgn1,Rgn7,RGN_DIFF)<>ERROR then
// if CombineRgn(Rgn1,Rgn1,Rgn8,RGN_DIFF)<>ERROR then
SetWindowRgn(Handle,Rgn1,True);
end;
procedure TMenur.Button1Click(Sender: TObject);
begin
Form_Dan.Show;
end;
procedure TMenur.SpeedButton1Click(Sender: TObject);
begin
Form_Dan.Show;
end;
end.