Solved

Need tutorial on irregular-shaped forms (layered windows?)

Posted on 2002-04-20
19
448 Views
Last Modified: 2010-05-18
I'm totally new to Delphi but I have a programming project in mind ;)

I'd like ot create an app that display an animated gif with a transparent background on the desktop with no window (form). I'm have no idea however how to create an app with an invisible form, and even more important how to have a animated gif with a transparent background stay transparent (i.e. you can see the desktop through the gif).

Can anyone recommend some online tutorials I can read to figure out how to do this?

Thanks!
0
Comment
Question by:totsubo
  • 6
  • 5
  • 2
  • +4
19 Comments
 

Expert Comment

by:lottol
ID: 6955791
You should use regions.
1)Fistly Create a region(s)
2)combine them, if needed
3)Set region to window
4)on destroy - destroy regions

Region funcitons are

CombineRgn
CreateEllipticRgn
CreateEllipticRgnIndirect
CreatePolygonRgn
CreatePolyPolygonRgn
CreateRectRgn
CreateRectRgnIndirect
CreateRoundRectRgn
EqualRgn
ExtCreateRegion
FillRgn
FrameRgn
GetPolyFillMode
GetRegionData
GetRgnBox
InvertRgn
OffsetRgn
PaintRgn
PtInRegion
RectInRegion
SetPolyFillMode

Read anout them you can in Wicrosoft SDK help. It's can be installed with Delphi.
There is an example of region usage:

unit main;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
    HRGN :integer;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
 // Create a region
 HRGN := CreateEllipticRgn(0, 0, width, height);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 // Set it to window
 SetWindowRgn(handle, HRGN, true);
end;

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

end.
0
 

Author Comment

by:totsubo
ID: 6955792
Thanks for the info. However will this allow an animated gif to play and seem to be transparent?

For example I would like to have an animated gif of a horse running and make it look like it is running across the desktop. The gif keeps changing shape *and* it has a transparent background ...

Jc
0
 

Expert Comment

by:lottol
ID: 6955867
if you use regions for it, you should use special region for each frame, but it can take some resources.

Another desicion is to take handle of a display device context of Desktop (GetDC(0)) and draw transparent Image on it. In this case, you should decide the problem of interacting with user (Ex. drag and dropping of a horse)
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 6956730
you could take a look at TCoolForm and TGIFImage-s source
because creating a mask isn't a fast thing to do you should store a mask for each frame
extract the frames from the animated gif, save them as 8 bit bitmaps (smaller bitmaps)
create the mas for all the bitmaps
store everything in some resource file
then when displaying the form change the frames periodically
haven't tried it so I don't know how will it work
it's something I wanted to do myself :)
0
 
LVL 3

Expert Comment

by:SteveWaite
ID: 6957207
Start a new project and add a button, double click the form and the button and copy/paste in the following:

procedure TForm1.FormCreate(Sender: TObject);
var
  Hnd: THandle;
begin
  Hnd := CreateEllipticRgn(4, 4, Width - 3, Height - 3);
  SetWindowRgn(Handle, Hnd, True);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Close;
end;

Also look in the help or on MSDN at the create region stuff like CreateEllipticRgn().

Regards,
Steve
0
 
LVL 3

Expert Comment

by:SteveWaite
ID: 6957209
oops, already posted, sorry..
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6957277
Regions for odd shapes (horse) can get much more complex to make than an Elliptic Region. Flipping the regions for an animation could get off. I started an animation project for fun, some time ago. It uses 7 images of a flame 65 x 55 pixels. Here is the code for it

the animate.dfm

object Form1: TForm1
  Left = 192
  Top = 114
  BorderStyle = bsNone
  Caption = '1'
  ClientHeight = 86
  ClientWidth = 129
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  FormStyle = fsStayOnTop
  OldCreateOrder = False
  OnClick = FormClick
  OnClose = FormClose
  OnCreate = FormCreate
  OnDblClick = FormDblClick
  OnKeyPress = FormKeyPress
  OnPaint = FormPaint
  PixelsPerInch = 96
  TextHeight = 13
  object Timer1: TTimer
    Enabled = False
    Interval = 136
    OnTimer = Timer1Timer
    Left = 72
    Top = 40
  end
end



the animate.pas


unit animate;

interface

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

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    procedure FormClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormPaint(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormDblClick(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
    Fire1,Fire2,Fire3,Fire4,Fire5,Fire6,Fire7: TBitmap;
    GotIt,DoInc,MoveIt,GoIdle: Boolean;
    i: Integer;
    FirePic: Array [0..6] of TBitmap;
    procedure IdleHandler(Sender: TObject; var Done: Boolean);
    procedure WMEraseBkgnd (var Msg : TMessage); message WM_ERASEBKGND;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormClick(Sender: TObject);
begin
Close
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
i := 0;
DoInc := True;
MoveIt := True;
GoIdle := True;
Application.OnIdle := IdleHandler;
Fire1 := TBitmap.Create;
Fire1.LoadFromFile('torch1.bmp');
Fire1.Transparent := True;
FirePic[0] := Fire1;
Fire2 := TBitmap.Create;
Fire2.LoadFromFile('torch2.bmp');
Fire2.Transparent := True;
FirePic[1] := Fire2;
Fire3 := TBitmap.Create;
Fire3.LoadFromFile('torch3.bmp');
Fire3.Transparent := True;
FirePic[2] := Fire3;
Fire4 := TBitmap.Create;
Fire4.LoadFromFile('torch4.bmp');
Fire4.Transparent := True;
FirePic[3] := Fire4;
Fire5 := TBitmap.Create;
Fire5.LoadFromFile('torch5.bmp');
Fire5.Transparent := True;
FirePic[4] := Fire5;
Fire6 := TBitmap.Create;
Fire6.LoadFromFile('torch6.bmp');
Fire6.Transparent := True;
FirePic[5] := Fire6;
Fire7 := TBitmap.Create;
Fire7.LoadFromFile('torch7.bmp');
Fire7.Transparent := True;
FirePic[6] := Fire7;
Form1.Width := Fire1.Width+2;
Form1.Height := Fire1.Height+2;
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
GotIt := False;
end;

procedure TForm1.WMEraseBkgnd (var Msg : TMessage);
begin
  Msg.Result := 0;
end;

procedure TForm1.IdleHandler(Sender: TObject; var Done: Boolean);
const
  LOOP_TIME = 140;
var
  start_time: DWORD;
begin
  // Get loop start time
  if GoIdle then
  start_time := GetTickCount() else
  Exit;
MoveWindow(Form1.Handle,Form1.Left+40,Form1.Top+40,2,2,True);
Sleep(2);
MoveWindow(Form1.Handle,Form1.Left-38,Form1.Top-36,Fire1.Width+2,Fire1.Height+2,True);

Form1.Canvas.Draw(1,1,FirePic[i]);

if DoInc then
Inc(i) else Dec(i);
if i = 6 then DoInc := False;
if i = 0 then DoInc := True;

  // Wait until LOOP_TIME
  while(GetTickCount() - start_time < LOOP_TIME) do;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
MoveWindow(Form1.Handle,Form1.Left+40,Form1.Top+40,2,2,True);

Sleep(1);

MoveWindow(Form1.Handle,Form1.Left-38,Form1.Top-36,Fire1.Width+2,Fire1.Height+2,True);
Form1.Canvas.Draw(1,1,FirePic[i]);
if DoInc then
Inc(i) else Dec(i);
if i = 6 then DoInc := False;
if i = 0 then DoInc := True;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
i: Integer;
begin
Fire1.FreeImage;
for i := 0 to 6 do
FirePic[i].Free;
end;

procedure TForm1.FormDblClick(Sender: TObject);
begin
Timer1.Enabled := False;
end;

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = 's' then
Timer1.Enabled := False;
if Key = 'w' then
GoIdle := False;
if Key = 'p' then Form1.Paint;
if Key = 'm' then
  begin
  Form1.Hide;
  Form1.Show;
  end;
if Key = 'v' then Form1.Canvas.Draw(1,1,FirePic[0]);
if Key = 'c' then MoveWindow(Form1.Handle,Form1.Left,Form1.Top,2,2,True);
if Key = 'x' then MoveWindow(Form1.Handle,Form1.Left+2,Form1.Top,Fire1.Width+2,Fire1.Height+2,True);
end;

end.


- - - - - - - - - - - - - - - - - - - - - - - - -  --
I may not can find time now to mess with this again, let me know if this is something that is like what you want. I have a multimedia timer that will do the timer better.
0
 
LVL 1

Expert Comment

by:martin_g
ID: 6957282
You probalby should use sprites.  Nelson Chu has a great (and simple :) ) demo program illustrating how to use animated characters on your desktop.  You can download it at:
http://www.cs.ust.hk/~cpegnel/desk_spr.html
0
 

Author Comment

by:totsubo
ID: 6958676
Thanks Martin for the info on Sprites. I'm looking into it.

If you can't quite picture what the kind of app I am trying to program please have a look at http://www.virtuagirl.com/

Is Delphi right for this (in terms of ease and speed) or should I use VBA or even C/C++?

Thanks for any opinions and info!

0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 12

Expert Comment

by:Lee_Nover
ID: 6959811
actually delphi is the most suited :)
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6961924
I had an old app that I tried for this regions thing, but it didn't get it. I found it and kicked it alot to get it to do a fair job. You will need the Region file producer app that I did at

http://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=20238383

to make the Region files I use in the resource for this app. This app shows a cheata flying down and then running across the screen. This app uses 9 bitmaps and 9 region files in the resource (.rc) file. this is the code for the Frames.rc file. -


FRGN0 RGN "catRgn0.rgn"
FRGN1 RGN "catRgn1.rgn"
FRGN2 RGN "catRgn2.rgn"
FRGN3 RGN "catRgn3.rgn"
FRGN4 RGN "catRgn4.rgn"
FRGN5 RGN "catRgn5.rgn"
FRGN6 RGN "catRgn6.rgn"
FRGN7 RGN "catRgn7.rgn"
FLYRGN0 RGN "flyRgn0.rgn"
FBMP0 BITMAP "frame0.bmp"
FBMP1 BITMAP "frame1.bmp"
FBMP2 BITMAP "frame2.bmp"
FBMP3 BITMAP "frame3.bmp"
FBMP4 BITMAP "frame4.bmp"
FBMP5 BITMAP "frame5.bmp"
FBMP6 BITMAP "frame6.bmp"
FBMP7 BITMAP "frame7.bmp"
FLYBMP0 BITMAP "fly0.bmp"


complile it with brcc32.exe

the .dfm file

object Form1: TForm1
  Left = 192
  Top = 114
  Cursor = crHandPoint
  BorderStyle = bsNone
  Caption = '1'
  ClientHeight = 76
  ClientWidth = 116
  Color = clWindow
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  FormStyle = fsStayOnTop
  OldCreateOrder = False
  OnClose = FormClose
  OnCreate = FormCreate
  OnMouseDown = FormMouseDown
  OnMouseMove = FormMouseMove
  OnMouseUp = FormMouseUp
  PixelsPerInch = 96
  TextHeight = 13
  object ApplicationEvents1: TApplicationEvents
    OnActivate = ApplicationEvents1Activate
    Left = 24
    Top = 16
  end
end


I first did this using a Multimedia timer, but when a system modal dialog box (Ctl+Alt+Del) comes up, every process is suspended, but NOT the MM timer, it keeps going (who Knew?). So I use a Thread timer instead.

unit animate;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  ExtCtrls, Dialogs, mmsystem, AppEvnts, Menus;

type

  ThreadRec = record
    Interval: Cardinal;
    isTiming: Boolean;
    ID: Byte;
    end;

  TForm1 = class(TForm)
    ApplicationEvents1: TApplicationEvents;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure ApplicationEvents1Activate(Sender: TObject);
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
  private
    { Private declarations }
    DoInc,DoMove,GoIdle, MoveForm, Start, Fly, DoRgn: Boolean;
    PicNum, PosX, PosY: Integer;
    CatPic: Array [0..8] of TBitmap;
    RgnHArry: Array [0..1] of THandle;
    //RgnHandle: THandle;
    hThread: THandle;
    OffSet: TPoint;
    SRect: TRect;
    procedure MoveIt;
    procedure ShowPopMenu(X, Y: Integer);
    procedure DoThreadTimer;
    procedure WMEraseBkgnd (var Msg : TMessage); message WM_ERASEBKGND;
    procedure WndProc(var Message: TMessage); override;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  TimerR: ThreadRec;

implementation

{$R *.DFM}
{$R Frames.RES}

function ThreadFunc(Parameter: Pointer): Integer; stdcall;
begin
Result := 0;
while TimerR.isTiming do
  begin
  {isTiming cuts this thread off, it uses a while loop with a
  SleepEx to get a timer interval effect}
  SleepEx(TimerR.Interval, False);
  if TimerR.isTiming then Form1.MoveIt;
  end;
TimerR.ID := 0;
EndThread(Result);
{no code below EndThread will be executed}
end;

procedure TForm1.DoThreadTimer;
var
ThreadId: LongWord;
begin
{The interval should be MORE than 4 or alot of the processor
time cycles are used, if you need an interval less than 10 then
you may want to set the Thread Priority higher with
SetThreadPriority( )}
if TimerR.ID <> 0 then Exit;
{TimerR.ID is set to 0 when the Thread ends, so check for 0
to make sure you don't start a thread if one is still running}
if TimerR.Interval < 5 then
TimerR.Interval := 5;
TimerR.ID := 1;
CloseHandle(hThread);
{since a thread may be created more than once,
you should Close the Handle}

{if you wanted to use more than one thread then you should keep track
of each thread's handle and close it}
hThread := BeginThread(nil, 0, @ThreadFunc, nil, 0, ThreadId);
end;

procedure TForm1.MoveIt;
var
Res : TResourceStream;
RegionData: Pointer;
RegionSize: Cardinal;
begin
if Fly then
  begin
  if DoRgn then
    begin
    if SetWindowRgn(Form1.Handle, RgnHArry[0], True) = 0 then
    TimerR.isTiming := False;
    RgnHArry[1] := RgnHArry[0];
    DoRgn := False
    end;
  MoveWindow(Form1.Handle,PosX,PosY,CatPic[0].Width+2,CatPic[0].Height,True);
  BitBlt(Form1.Canvas.Handle, 0, 0, CatPic[8].Width, CatPic[8].Height, CatPic[8].Canvas.Handle, 0, 0, SRCCOPY);
  if PosY < SRect.Bottom-CatPic[8].Height then
    begin
    Inc(PosX,12);
    Inc(PosY,10);
    Exit;
    end else
    begin
    TimerR.Interval := 78;
    Res := TResourceStream.Create(hInstance, 'FRGN0', 'RGN');
    Res.Read(RegionSize,SizeOf(Cardinal));
    RegionData := AllocMem(RegionSize);
    Res.Read(RegionData^, RegionSize);
    RgnHArry[0] := ExtCreateRegion(nil,RegionSize,TRgnData(RegionData^));
    Freemem(RegionData);
    RegionData := nil;
    Res.Free;
    Fly := False;
    end;
  end;

if SetWindowRgn(Form1.Handle, RgnHArry[0], True) = 0 then
  TimerR.isTiming := False;

MoveWindow(Form1.Handle,PosX,PosY,CatPic[0].Width+2,CatPic[0].Height,True);
BitBlt(Form1.Canvas.Handle, 0, 0, CatPic[PicNum].Width, CatPic[PicNum].Height, CatPic[PicNum].Canvas.Handle, 0, 0, SRCCOPY);
DeleteObJect(RgnHArry[1]);
RgnHArry[1] := RgnHArry[0];



if DoInc then
Inc(PicNum) else Dec(PicNum);
if PicNum = 7 then DoInc := False;
if PicNum = 0 then DoInc := True;

  Res := TResourceStream.Create(hInstance, 'FRGN'+IntToStr(PicNum), 'RGN');
  Res.Read(RegionSize,SizeOf(Cardinal));
  RegionData := AllocMem(RegionSize);
  Res.Read(RegionData^, RegionSize);
  RgnHArry[0] := ExtCreateRegion(nil,RegionSize,TRgnData(RegionData^));
  Freemem(RegionData);
  RegionData := nil;
  Res.Free;

//Sleep(2);
//MoveWindow(Form1.Handle,Form1.Left-38,Form1.Top-36,CatPic[0].Width+2,CatPic[0].Height+2,False);
if PosX < Screen.Width then
Inc(PosX,22) else
PosX := 8-CatPic[0].Width;
//Inc(PosY,2);
end;

procedure TForm1.FormCreate(Sender: TObject);
var
j: Integer;
Res : TResourceStream;
RegionData: Pointer;
RegionSize: Cardinal;
begin
hThread := 0;
PicNum := 0;
Start := True;
DoInc := True;
DoMove := True;
GoIdle := True;
Fly := True;
DoRgn := True;
MoveForm := False;

if not SystemParametersInfo(SPI_GETWORKAREA,0,@SRect,0) then
SRect := Rect(0,0,Screen.Width,Screen.Height - 32);

for j := 0 to 7 do
  begin
  CatPic[j] := TBitmap.Create;
  CatPic[j].LoadFromResourceName(hInstance,'FBMP'+IntToStr(j));
  end;
CatPic[8] := TBitmap.Create;
CatPic[8].LoadFromResourceName(hInstance,'FLYBMP0');

If CatPic[0].Empty then
  begin
  Close;
  Exit;
  end;

PosY := ((SRect.Bottom - SRect.Top) div 2) -CatPic[8].Height;
PosX := 10-CatPic[8].Width;

  Res := TResourceStream.Create(hInstance, 'FLYRGN0', 'RGN');
  Res.Read(RegionSize,SizeOf(Cardinal));
  RegionData := AllocMem(RegionSize);
  Res.Read(RegionData^, RegionSize);
  RgnHArry[0] := ExtCreateRegion(nil,RegionSize,TRgnData(RegionData^));
  Freemem(RegionData);
  RegionData := nil;
  Res.Free;

If RgnHArry[0] = 0 then
  begin
  Close;
  Exit;
  end;

Form1.Width := CatPic[0].Width;
Form1.Height := CatPic[0].Height;
TimerR.Interval := 40;
Top := PosY;
Left := PosX;
end;

procedure TForm1.WMEraseBkgnd (var Msg : TMessage);
begin
  Msg.Result := 1;
end;

procedure TForm1.WndProc(var Message: TMessage);
begin
case Message.Msg of
  WM_COMMAND: if Message.lParam = 0 then
              case LOWORD(Message.wParam) of
              101: begin
                   TimerR.isTiming := False;
                   end;
              102: begin
                   SuspendThread(hThread);
                   ShowMessage('No Options currently availible');
                   {a messagebox stops the this apps processing but not
                   the hThread's}
                   ResumeThread(hThread);
                   end;
              103: Close;
              end;
  WM_EXITMENULOOP: ResumeThread(hThread);
  WM_ENTERMENULOOP: SuspendThread(hThread);
  WM_CONTEXTMENU: ShowPopMenu(LOWORD(Message.lParam),HIWORD(Message.lParam));
  end;

inherited;
end;

procedure TForm1.ShowPopMenu(X, Y: Integer);
var
hPopMenu: HMENU;
begin
hPopMenu := CreatePopupMenu;
InsertMenu(hPopMenu,0,MF_BYPOSITION or MF_STRING,101,'Sound');
InsertMenu(hPopMenu,1,MF_BYPOSITION or MF_STRING,102,'Options');
InsertMenu(hPopMenu,2,MF_BYPOSITION or MF_STRING,103,'Close');

{the TrackPopupMenu fuction is active as long as the PopUp Menu is displayed}
TrackPopupMenu(hPopMenu,      // handle of shortcut menu
    TPM_LEFTALIGN or TPM_LEFTBUTTON,      // screen-position and mouse-button flags
    X-5,      // horizontal position, in screen coordinates
    Y-5,      // vertical position, in screen coordinates
    0,      // reserved, must be zero
    Handle,      // handle of window that gets menu messages
    nil      // points to RECT that specifies no-dismissal area
   );
DestroyMenu(hPopMenu);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
i: Integer;
begin
SetWindowRgn(Form1.Handle, 0, False);
TimerR.isTiming := False;
CloseHandle(hThread);
for i := 0 to 8 do
  CatPic[i].Free;
DeleteObject(RgnHArry[0]);
DeleteObject(RgnHArry[1]);
end;

procedure TForm1.ApplicationEvents1Activate(Sender: TObject);
begin
if Start then
  begin
  TimerR.isTiming := True;
  DoThreadTimer;
  Start := False;
  end;
end;

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
  begin
  TimerR.isTiming := False;
  OffSet.x := X;
  OffSet.y := Y;
  MoveForm := True;
  end;
end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
  begin
  MoveForm := False;
  Start := True;
  ApplicationEvents1Activate(Self);
  end;
end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
Pt1: TPoint;
begin
If MoveForm then
  begin
  Pt1.x := X;
  Pt1.y := Y;
  Pt1 := ClientToScreen(Pt1);
  Top := Pt1.y - Offset.y;
  Left := Pt1.x - Offset.x;
  PosX := Left;
  PosY := Top;
  end;
end;

end.


- - - - - - - - - - - - - - - - - - - - - - - - - -
If you click and drag this animation you can move it around the desktop. If you right click it a pop up menu will come up so you can close it (I couldn't get the TPopUpMenu to behave so I created my own popup menu).
0
 

Author Comment

by:totsubo
ID: 6961933
Slick, thanks for the code but before I even start using code I need to understand the basics involved. For example I don't even know what regions files are ... Can you point me to a tutorial so that I can understand what your code does and moreimportantly *how* it does it?
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6964596
? ? ? OK, I did that animate program for fun, not so much as a tutoral, there were alot of things that I had to work around to get the effect you were after. There's alot to cover in what I did, I guess you might start with regions, try this page

http://members.truepath.com/delphi/tips/tip55_formshapecircleellipse1.htm

And efg's delphi reference site has given me alot of information, here the addy for their API reference, you might can find pages or zip files here to give you some instruction

http://www.efg2.com/Lab/Library/Delphi/Graphics/Win32API.htm#APICalls


also for regions, look in the Win32 API help that came with delphi, look in the index for Regions.

I did some scanline in the make region program, a page about that -

http://www.efg2.com/Lab/ImageProcessing/Scanline.htm

look around the efg's site, you can find enough there to keep you learning for a long time
0
 

Author Comment

by:totsubo
ID: 6965009
Slick, can you send me the bmp files I need to run your code? Or send me an exe? My email is jean_christian@myrealbox.com

I'm still going to your code, slowly, and trying to see how things get done ...
0
 
LVL 33

Accepted Solution

by:
Slick812 earned 200 total points
ID: 6967704
???? Bitmap images? you can use any bitmap images that you want. If you ain't got no images, then why are you asking for code? Get an animated  .gif file from the internet and then use an animated gif editor to extract the images as bitmaps. A free editor that will extract .gif animated images is Irfan View at

http://www.ryansimmons.com/users/irfanview/

and

http://www.irfanview.com/

it is a very GOOD image Viewer, I use it as the default image viewer (open) on all of my puters.

I may send you a working version of my app.
0
 

Author Comment

by:totsubo
ID: 6967738
Slick, I'm talking about the following region files and bmp files. I wanted to test run your code to see what it looked like when run.

FRGN0 RGN "catRgn0.rgn"
FRGN1 RGN "catRgn1.rgn"
FRGN2 RGN "catRgn2.rgn"
FRGN3 RGN "catRgn3.rgn"
FRGN4 RGN "catRgn4.rgn"
FRGN5 RGN "catRgn5.rgn"
FRGN6 RGN "catRgn6.rgn"
FRGN7 RGN "catRgn7.rgn"
FLYRGN0 RGN "flyRgn0.rgn"
FBMP0 BITMAP "frame0.bmp"
FBMP1 BITMAP "frame1.bmp"
FBMP2 BITMAP "frame2.bmp"
FBMP3 BITMAP "frame3.bmp"
FBMP4 BITMAP "frame4.bmp"
FBMP5 BITMAP "frame5.bmp"
FBMP6 BITMAP "frame6.bmp"
FBMP7 BITMAP "frame7.bmp"
FLYBMP0 BITMAP "fly0.bmp"
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6969529
look for an Email
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6982570
Did the app work well enough for you? Could you get the regions from the RES to shape your form?
0
 
LVL 1

Expert Comment

by:pnh73
ID: 9003698
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept answer from Slick812

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now