Welcome

Welcome, thanks to look my blog

Thursday, 17 July 2014

membuat form tidak bisa di pindah tetapi tetap di tengah

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ComCtrls, Buttons, sSkinManager, sLabel;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    ProgressBar1: TProgressBar;
    BitBtn1: TBitBtn;
    sSkinManager1: TsSkinManager;
    sLabelFX1: TsLabelFX;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure sLabelFX1Click(Sender: TObject);
  private
    { Private declarations }
         procedure OnWMHitTest(var msg: TWMNCHitTest); message WM_NCHITTEST;
          procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
  public
    { Public declarations }

     //  procedure WMWindowPosChanging(var Message:TWMWindowPosChanging);
   // message WM_WINDOWPOSCHANGING;
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}
procedure TForm1.OnWMHitTest(var msg: TWMNCHitTest);
begin
//ShowMessage('1');
 inherited;
 if msg.Result = HTCLIENT then
 msg.Result := HTCAPTION;

end;

 procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
begin
 if ((msg.CmdType and $FFF0) = SC_MOVE) then begin msg.Result:=0;
 exit;
 end;
 inherited;
end;
{procedure TForm1.WMWindowPosChanging(var Message:TWMWindowPosChanging);
begin
ShowMessage('2');
  with Message.WindowPos^do
  flags:=flags OR SWP_NOMOVE;
end; }


procedure TForm1.Timer1Timer(Sender: TObject);
begin
   if progressbar1.Position=100 then
     begin
       //Form1.Show;
       form2.show;
       timer1.Enabled:=false;
     end
else
     begin
        progressbar1.Position:=progressbar1.Position+5;
     end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Form1.Position:=poDesktopCenter;
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
 Close;
end;



No comments:

Post a Comment