Board index » delphi » Advanced shaped forms

Advanced shaped forms

Thanks for the help on elliptical an rectangular (and combined) forms .

But ....

when i see the PalmPilot-Emulator for win95 , they either

1) use pixel-regions

2) use at least 60 combined rectangle regions for creating the
   S-curves at the bottom .

Is there definitely no way to create a region out of a bitmap  ?

(other than creating a rectangular region for every pixel an merging
 them ... aaaaargh )

 

Re:Advanced shaped forms


I think that's the way: Scan through bitmap "edges" and create rectangular
region! That's how I've done it (32x32 icon on a caption bar!).

I have seen a component which does this with any bitmap.

Quote
Andreas Koch wrote in message

<35BC35C1.3...@rbg.informatik.tu-darmstadt.de>...
Quote
>Thanks for the help on elliptical an rectangular (and combined) forms .

>But ....

>when i see the PalmPilot-Emulator for win95 , they either

>1) use pixel-regions

>2) use at least 60 combined rectangle regions for creating the
>   S-curves at the bottom .

>Is there definitely no way to create a region out of a bitmap  ?

>(other than creating a rectangular region for every pixel an merging
> them ... aaaaargh )

Re:Advanced shaped forms


Quote
Ilkka Pirttimaa wrote:

> I think that's the way: Scan through bitmap "edges" and create rectangular
> region! That's how I've done it (32x32 icon on a caption bar!).

> I have seen a component which does this with any bitmap.

> Andreas Koch wrote in message
> <35BC35C1.3...@rbg.informatik.tu-darmstadt.de>...
> >Thanks for the help on elliptical an rectangular (and combined) forms .

> >But ....

> >when i see the PalmPilot-Emulator for win95 , they either

> >1) use pixel-regions

> >2) use at least 60 combined rectangle regions for creating the
> >   S-curves at the bottom .

> >Is there definitely no way to create a region out of a bitmap  ?

> >(other than creating a rectangular region for every pixel an merging
> > them ... aaaaargh )

        I bet those S-shaped curves came from PathToRegion.

--
David Ullrich

sig.txt not found

Re:Advanced shaped forms


Hi Andreas,

I don't know the PalmPilot-Emulator, but when you speek about a
S-curve at the bottom of the form you could use the following example:

unit BottomSForm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private-Deklarationen }
    procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

var
  Region: HRgn;

procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);
begin
  inherited;
  Msg.Result := HTCAPTION;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  DC: HDC;
  MarginX, MarginY: Integer;
  Points: array[0..2] of TPoint;
begin
  MarginX := (Width - ClientWidth) div 2;
  MarginY := Height - ClientHeight - MarginX;

  Points[0].x := MarginX + Width div 3;
  Points[0].y := Height + Height div 3;
  Points[1].x := MarginX + 2 * Width div 3;
  Points[1].y := Height div 3;
  Points[2].x := Width - MarginX;
  Points[2].y := Height - MarginX - Height div 6;

  DC := Canvas.Handle;

  BeginPath(DC);

  MoveToEx(DC, MarginX, Height - MarginX - Height div 3, nil);

  PolyBezierTo(DC, Points, 3);

  LineTo(DC, Width - MarginX, MarginY);
  LineTo(DC, MarginX, MarginY);
  LineTo(DC, MarginX, Height - MarginX - Height div 3);
  EndPath(DC);
  Region := PathToRegion(DC);
  SetWindowRgn(Handle, Region, TRUE);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  DeleteObject(Region);
end;

end.

Hope it's what you're looking for.

Kerstin

Quote
Andreas Koch wrote:

> Thanks for the help on elliptical an rectangular (and combined) forms
> .

> But ....

> when i see the PalmPilot-Emulator for win95 , they either

> 1) use pixel-regions

> 2) use at least 60 combined rectangle regions for creating the
>    S-curves at the bottom .

> Is there definitely no way to create a region out of a bitmap  ?

> (other than creating a rectangular region for every pixel an merging
>  them ... aaaaargh )

Re:Advanced shaped forms


HI,

there is a componant on the DSP - you drop it on the form, assign a
bitmap and it takes the shape of the bitmap.

- Allen.

Re:Advanced shaped forms


Please specify the name of component or provide the address if you have

thanks
manoj

Quote
Allen wrote in message ...
>HI,

>there is a componant on the DSP - you drop it on the form, assign a
>bitmap and it takes the shape of the bitmap.

>- Allen.

Other Threads