[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
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:

  1. include <cassert>
//--------------------------------------------------------------------------- __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); } //---------------------------------------------------------------------------






last edited (May 8, 2007) by bilderbikkel, Number of views: 708, Current Rev: 2 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.