Fully customizable form-style implementations

Source: Internet
Author: User

Minimize to the taskbar
PostMessage (self.handle,wm_syscommand,sc_minimize,0);

Maximize or Restore
procedure Tf_mainform.rztoolbutton1click (sender:tobject);
var
  Abd:tappbardata;
Begin
  inherited;
  If Windowstate=wsnormal then BEGIN
    WindowState: = wsmaximized; //borderstyleî for Bsnone
    abd.cbsize: = sizeof (ABD);
    SHAppBarMessage (Abm_gettaskbarpos, ABD); Read the taskbar's area
    self.height: = Self.height-(abd.rc.bottom-abd.rc.top); //reserve the location of the task bar
    (Sender as Trztoolbutton). Hint: = ' restore ';
    (Sender as Trztoolbutton). ImageIndex: = 8;
  END Else if WindowState =wsmaximized then BEGIN
    WindowState: =wsnormal;
    (Sender as Trztoolbutton). Hint: = ' maximized ';
    (Sender as Trztoolbutton). ImageIndex: = 2;
  END;
End;

Move a untitled form
Procedure Tf_mainform.rzpanel2mousedown (Sender:tobject;
Button:tmousebutton; Shift:tshiftstate; X, Y:integer);
Begin
inherited;
If Button=mbleft Then
Begin
ReleaseCapture;
Perform (wm_nclbuttondown,htcaption,0);
End
End

A borderless form can also change the size of a form by holding the mouse
Protected
Procedure CreateParams (var params:tcreateparams); Override
Procedure Tf_mainform.createparams (var params:tcreateparams);
Begin
BorderStyle: = Bsnone; Îþ±ß¿ò´°ìåò²äü¸ä±ä´°ìåµä´óð¡
inherited;
Params.exstyle: = Params.exstyle or Ws_ex_staticedge;
Params.style: = Params.style or Ws_sizebox;
End

Mouse click button Pop-up menu
Procedure Tf_mainform.createparams (var params:tcreateparams);
Begin
BorderStyle: = Bsnone;
inherited;
Params.exstyle: = Params.exstyle or Ws_ex_staticedge;
Params.style: = Params.style or Ws_sizebox;
End

Form fillet processing
Procedure Tf_mainform.formresize (Sender:tobject);
var Hr:thandle;
Begin
inherited;
Hr:=createroundrectrgn (0,0,width,height,20,20);
SetWindowRgn (handle,hr,true);
End

Some methods of form embedding Tabsheet
Procedure Tf_mainform.rzpagecontrol1close (Sender:tobject;
var allowclose:boolean);
Var
P:trzpagecontrol;
T:trztabsheet;
Begin
inherited;
P: = sender as Trzpagecontrol;
T: =p.activepage;
If T.caption <> ' Ïµí³µ¼º½ ' then BEGIN
AllowClose: = True;
Tform (T.controls[0]). Close;
T.free;
End else AllowClose: =false;
End

function Tf_mainform.createtab (const acaption:string): Trztabsheet;
Begin
Result: = Trztabsheet.create (RzPageControl1);
Result.pagecontrol: = RzPageControl1;
Result.caption: = acaption;
Rzpagecontrol1.activepage: = Result;
End

Function Tf_mainform.existtab (const acaption:string): Boolean;
var
  I:integer;
Begin
  Result: = false;
  for I: = 0 to Rzpagecontrol1.pagecount-1 do
  begin
    if rzpagecontrol1.pages[i]. Caption = Acaption then
    begin
      Result: = true;
      rzpagecontrol1.activepage: = Rzpagecontrol1.pages[i];
      break;
    end;
  END;
End;

Procedure Tf_mainform.openform (Aformclass:tformclass;
Aowner:twincontrol);
var I:integer;
F:tform;
Begin
F: = Aformclass.create (Aowner);
F.color: =c_color;
For i:=0 to F.componentcount-1 do begin
If F.components[i] is Trzdbgrid then BEGIN
Trzdbgrid (F.components[i]). Fixedcolor: = C_color;
End else if F.components[i] is Trzdbnavigator then BEGIN
Trzdbnavigator (F.components[i]). Color: =c_color;
End
End
F.manualdock (Aowner);
F.windowstate: = wsmaximized;
F.align: = alclient;
F.show;
End

Http://www.cnblogs.com/hnxxcxg/archive/2012/05/10/2493680.html

Fully customizable form-style implementations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.