[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppVclCustomShapedForm
Add to ?Unit1.cpp in the private section the following line:
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppVclCustomShapedForm
(C++ VCL) How do I get a custom shaped TForm?
Add to ?Unit.h in the private section the following line:HRGN mRegion;
Add to ?Unit1.cpp in the private section the following line:
//--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner), mRegion(0) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { mRegion = CreateEllipticRgn(0,0, Width, Height); //Assume the line above went without errors assert(mRegion!=0); //Set the active window region to this region SetWindowRgn(Handle, mRegion, true); } //--------------------------------------------------------------------------- void __fastcall TForm1::FormDestroy(TObject *Sender) { DeleteObject(mRegion); } //---------------------------------------------------------------------------
- include <cassert>
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
