Click on different buttons to generate a different form onto a panel, like frame usage--good

Source: Internet
Author: User

Click on different buttons to generate different pages to load onto a panel.
Procedure Tmainform.demobuttonclick (sender:tobject); var newdemoclass:tformclass; Tformclass = Class of Tform; refers to the class knowledge point of the class; Newdemoclass is represented as a class of form class, subject to textual research
Newdemo:tform; Begin case (Sender as Tspeedbutton). Tag of 0:newdemoclass: = Tspeedform; Type Tspeedform = Class (Tform)
    1:      Newdemoclass: = Tgeneralform;    2:      Newdemoclass: = Tpropertiesform;    3:      Newdemoclass: = Tvisibilityform;    5:      Newdemoclass: = Tgridform;    6:newdemoclass: = Tdrawtreeform;    7:  Newdemoclass: = Talignform;    8:  Newdemoclass: = Twindowsxpform;    9:newdemoclass: = Tnodeform;    Ten:  newdemoclass: = Theaderownerdrawform;  else    newdemoclass: = nil;  End;  The IF (containerpanel.controlcount = 0) or not (Containerpanel.controls[0] is Newdemoclass) and then//panel are not possible to be created without or not the current class.  begin    If containerpanel.controlcount > 0 then      containerpanel.controls[0]. Free;    If Assigned (newdemoclass) then      the begin Newdemo: = Newdemoclass.create (self);//belong to self refer to main form      Newdemo.hide;      Newdemo.borderstyle: = Bsnone;      Newdemo.parent: = Containerpanel; Displayed position      newdemo.align: = alclient;;    End;  End;end;


Click on different buttons to generate a different form onto a panel, like frame usage--good

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: 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.