Delphi cutting glass

1.4k views Asked by At

I'm using Delphi XE2, and I like glass effects, and I want to "cut" glass as in Windows 7 tablet tools. If you also know how cut a button I'll be happy if you tell me how.

enter image description here

Thanks

2

There are 2 answers

0
daven11 On

Did you mean you want shaped forms? If so

Irregularly shaped forms

could help. I imagine this will work on Windows 7 (note Remy's comment in the answer).

hth

4
Warren  P On

Drawing in the top area is simply a matter of using a glass frame and painting in the non-client area, or alternatively, using the DwmExtendFrameIntoClientArea API.

The best code sample I have seen for this is the VCL "Ribbon" control, which provides a "QAT" (quick Access toolbar) area, painted in the "non client area".

Note that the author has to think not only about how to render when Vista/Win7 systems which have Glass ON, but also has to decide how to render on WinXp, Win7 and Vista when the Themes engine is off. There is quite a bit of logic in the Vcl.Ribbon.pas (or just Ribbon.pas if you're in XE or earlier) unit dedicated to that.

Look at procedure TCustomRibbonQuickAccessPopupToolbar.NCPaint(DC: HDC); in the Vcl Ribbon sources.

Drawing a non-rectangular "extended area" that protrudes from the bottom is probably a matter of applying a custom window clipping region.