views:

176

answers:

2

I recently downloaded the source to an "open source" project that unfortunately has dependencies on a bunch of expensive proprietary libraries, including Infopower 1stClass, which it seems to use primarily for TfcShapeButton, a component that acts like a standard TBitBtn, except that you can give it an arbitrary polygonal shape by describing a list of points. The DFM code looks like this:

      PointList.Strings = (
        '8,29'
        '18,19'
        '28,29'
        '20,37'
        '16,37')

I'm trying to clean this project up and make it look like a real open-source project that anyone can download and build without having to shell out hundreds of dollars for component libraries, but I'd like to change the look and feel as little as possible. So does anyone know of an open-source shape button component like this that will work with D2009 and up?

+2  A: 

Mason, a much better way of making a shaped button is to have a mask for it. The component that does that should be here: http://www.delphi-jedi.org/

glebm
Oh, there's a shaped button component in the JVCL? Cool!
Mason Wheeler
you can create the mask yourself using CreatePolygonRgn
PA
+2  A: 

this piece of code does exactly what you need.

const Points: array [1..5] of tPoint = (
    (x:8;y:29),
    (x:18;y:19),
    (x:28;y:29),
    (x:20;y:37),
    (x:16;y:37) );

begin
  SetWindowRgn(Button2.Handle, CreatePolygonRgn(Points, 5, WINDING), True);
end;
PA
Oh, is it that simple? With this, I can build my own shaped button control. Thanks!
Mason Wheeler