home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Power Pack / Visual_Basic4_Power_Pack.bin / vb4files / ilib_vb / udemo.pa_ / udemo.pa
Encoding:
Text File  |  1996-11-20  |  15.6 KB  |  476 lines

  1. {
  2. Written by Jan Dekkers and Kevin Adams (c) 1995, 1996. If you are a non
  3. registered client, you may use or alter this demo only for evaluation
  4. purposes.
  5.  
  6. Copyright by SkyLine Tools. All rights reserved.
  7.  
  8. Part of Imagelib VCL/DLL Library.
  9. }
  10.  
  11. unit Udemo;
  12.  
  13. {Includes settings to compile in either 16 or 32 bit}
  14. {$I DEFILIB.INC}
  15.  
  16. interface
  17.  
  18. uses
  19. {$IFDEF DEL32}
  20.   Windows,
  21. {$ELSE}
  22.   WinTypes,
  23.   WinProcs,
  24. {$ENDIF}
  25.   DLL95V1,  {ImageLib Dll interface and misc. functions}
  26.   SysUtils,
  27.   Messages,
  28.   Classes,
  29.   Graphics,
  30.   Controls,
  31.   Forms,
  32.   Dialogs,
  33.   StdCtrls,
  34.   ExtCtrls,
  35.   Buttons,
  36.   Printers,
  37.   IToolB,    {PMultiImage Toolbar VCL component}
  38.   UAbout,
  39.   UImage,    {PMultiImage Demo}
  40.   BImage,    {Image Convert Demo}
  41.   MMBlob,    {MultiMedia Blobfield Demo}
  42.   UBlob,     {MultiImage Blobfield Demo}
  43.   UMail,     {Demo}
  44.   UScroll,   {Scrolling messages demo}
  45.   UIconLB,   {Icon List/Combo Box demo}
  46.   UToolbar,  {PMultiImage Toolbar demo}
  47.   Udbtoolb,  {PDBMultiImage Toolbar demo}
  48.   UMdbtb,    {PDBMultiMedia Toolbar demo}
  49.   UMultim,   {PMultiMedia Toolbar demo}
  50.   UFGRAB,    {Video Frame Grabber demo}
  51.   U_gl_pal,  {Global Palette demo}
  52.   Urubberb,  {PDBMultiImage Toolbar demo with Rubberband zooming}
  53.   TMultiP;   {PMultiImage VCL component}
  54.  
  55. type
  56.   TDemoForm1 = class(TForm)
  57.     Panel1          : TPanel;
  58.     SpeedButton1    : TSpeedButton;
  59.     SpeedButton2    : TSpeedButton;
  60.     SpeedButton3    : TSpeedButton;
  61.     SpeedButton4    : TSpeedButton;
  62.     SpeedButton5    : TSpeedButton;
  63.     SpeedButton6    : TSpeedButton;
  64.     SpeedButton7    : TSpeedButton;
  65.     SpeedButton14   : TSpeedButton;
  66.     SpeedButton9    : TSpeedButton;
  67.     Memo1           : TMemo;
  68.     BitBtn1         : TBitBtn;
  69.     SpeedButton10   : TSpeedButton;
  70.     SpeedButton11   : TSpeedButton;
  71.     BitBtn2         : TBitBtn;
  72.     PrintDialog1    : TPrintDialog;
  73.     Panel2          : TPanel;
  74.     PMultiImage1    : TPMultiImage;
  75.     Panel3          : TPanel;
  76.     MultiImage2     : TPMultiImage;
  77.     SpeedButton12   : TSpeedButton;
  78.     ImageToolBar1   : TMImageToolBar;
  79.     SpeedButton8    : TSpeedButton;
  80.     SpeedButton13   : TSpeedButton;
  81.     SpeedButton15   : TSpeedButton;
  82.     SpeedButton16   : TSpeedButton;
  83.     SpeedButton17   : TSpeedButton;
  84.     BitBtn3         : TBitBtn;
  85.     SpeedButton18   : TSpeedButton;
  86.     SpeedButton19: TSpeedButton;
  87.     procedure FormCreate(Sender: TObject);
  88.     procedure SpeedButton1Click(Sender: TObject);
  89.     procedure SpeedButton2Click(Sender: TObject);
  90.     procedure SpeedButton3Click(Sender: TObject);
  91.     procedure SpeedButton4Click(Sender: TObject);
  92.     procedure SpeedButton5Click(Sender: TObject);
  93.     procedure SpeedButton6Click(Sender: TObject);
  94.     procedure SpeedButton7Click(Sender: TObject);
  95.     procedure SpeedButton14Click(Sender: TObject);
  96.     procedure BitBtn1Click(Sender: TObject);
  97.     procedure SpeedButton9Click(Sender: TObject);
  98.     procedure SpeedButton10Click(Sender: TObject);
  99.     procedure SpeedButton11Click(Sender: TObject);
  100.     procedure BitBtn2Click(Sender: TObject);
  101.     procedure SpeedButton12Click(Sender: TObject);
  102.     procedure FormActivate(Sender: TObject);
  103.     procedure SpeedButton8Click(Sender: TObject);
  104.     procedure SpeedButton13Click(Sender: TObject);
  105.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  106.     procedure SpeedButton15Click(Sender: TObject);
  107.     procedure SpeedButton16Click(Sender: TObject);
  108.     procedure SpeedButton17Click(Sender: TObject);
  109.     procedure BitBtn3Click(Sender: TObject);
  110.     procedure SpeedButton18Click(Sender: TObject);
  111.     procedure SpeedButton19Click(Sender: TObject);
  112.   private
  113.     { Private declarations }
  114.     Procedure Trigger(Sender : TObject; Var Done : Boolean);
  115.   public
  116.     { Public declarations }
  117.   end;
  118.  
  119. var
  120.   DemoForm1: TDemoForm1;
  121.  
  122. implementation
  123.  
  124. {$R *.DFM}
  125. {---------------------------------------------------------------------}
  126.  
  127. procedure TDemoForm1.FormCreate(Sender: TObject);
  128. begin
  129.   BForm1:=Nil;
  130.   DBMultiImageToolbar:=Nil;
  131.   MMForm1:=Nil;
  132.   MMForm3:=Nil;
  133.   RubberbandForm:=Nil;
  134.   Cursor:=crHourGlass;
  135.   PMultiImage1.ImageName:=ExtractFilePath(Application.ExeName)+'sjef.jpg';
  136.   Cursor:=crDefault;
  137.  {create a message at creation at MultiImage2 (Bottom one)}
  138.  {set Message text}
  139.  
  140. {$IFDEF DEL32}
  141.     MultiImage2.MsgText:='ImageLib 95/31 by SkyLine Tools. Add TIF, PNG, CMS, SCM, JPG, ICO, PCX, BMP, WMF and GIF images'+
  142.     ' to your applications. ImageLib supports both the File and Data-Aware (BLOB) read and write.'+
  143.     ' Add all the image formats and AVI, MOV, MID, RMI, WAV to a TBlobfield.'+
  144.     ' In ImageLib version 95, scrolling text messages can be 64Kb long. '+
  145.     ' ImageLib: Professional Version VCLs\DLL'+
  146.     ' ImageLib VCLs\DLL provides an excellent  tool for implementing  JPEG, GIF, PCX, PNG, WMF,'+
  147.     ' SCM.BMP,ICO and CMS into your applications.  A  royalty  free  VCL with source code is'+
  148.     ' included for the low price of $?????. (Price may vary  outside the United States.)'+
  149.     ' Other image and  multimedia development tools are a lot more expensive and do not include'+
  150.     ' ImageLib''s much talked about scrolling text messages.'+
  151.     ' When the developer compiles  ImageLib  into an executable application with the extension exe.,'+
  152.     ' there are no licensing fees or royalties.'+
  153.     ' When users compared ImageLib''s color resolution with other imaging tools, they found  ImageLib''s'+
  154.     ' to be superior to most.  In fact,  the JPEG is so professional looking that museums are using it'+
  155.     ' to catalogue their art.'+
  156.     ' Also, ImageLib adds DBMultiImage and DBMultiMedia to store and display JPEG, BMP, GIF, PNG,'+
  157.     ' CMS, SCM, PCX , AVI, MOV, MID, WAV and RMI multimedia files in/from a TBlobField.'+
  158.     ' International developers are able to  display strings  in the DLL as a resource file,'+
  159.     ' thereby enabling translation into foreign languages.'+
  160.     ' SkyLine Tools stands behind its product with its highly responsive technical support.';
  161. {$ELSE}
  162.     MultiImage2.MsgText:='ImageLib 95/31 by SkyLine Tools. Add TIF, PNG, CMS, SCM, JPG, ICO, PCX, BMP, WMF, GIF images'+
  163.     ' to your applications. ImageLib supports both the File and Data-Aware (BLOB) read and write.'+
  164.     ' Add all the image formats and AVI, MOV, MID, RMI, WAV to a TBlobfield.';
  165. {$ENDIF}
  166.  
  167.     {set Message font name;  Note you can alse do this with a font dialog}
  168.     MultiImage2.MsgFont.Name:='Arial';
  169.    {set Message font size}
  170.     MultiImage2.MsgFont.Size:=-12;
  171.     {set Message font style}
  172.     MultiImage2.MsgFont.Style:=[];
  173.     {set Message font color}
  174.     MultiImage2.MsgFont.Color:=clAqua;
  175.     {set Message background. Note you could do this also with a color dialog}
  176.     MultiImage2.MsgBkGrnd:=clNavy;
  177.     {set Message speed from 1 is fast to 10 is slow}
  178.     MultiImage2.MsgSpeed:=7;
  179.     {inititiate new message}
  180.     MultiImage2.NewMessage;
  181.  
  182.     {IMPORTANT}
  183.     {This is the moving engine for all the messages. Since an applcation
  184.     can have only one OnIdle Trigger, this trigger needs to be subdivided
  185.     by all your moving and animated objects. In this particular case the
  186.     function is called TRIGGER but you can name it as you want as long
  187.     you have a procedure named the same.}
  188.     Application.OnIdle:=Trigger;
  189.  
  190.     If FileExists(ExtractFilePath(Application.ExeName)+'IMAGEL31.HLP') then begin
  191.      Application.HelpFile := ExtractFilePath(Application.ExeName)+'IMAGEL31.HLP';
  192.      SpeedButton11.Enabled:=True;
  193.     end;
  194.  
  195. end;
  196. {---------------------------------------------------------------------}
  197.  
  198. Procedure TDemoForm1.Trigger(Sender : TObject; Var Done : Boolean);
  199. begin
  200.    {This function is called when your app is idle. Subdivide the
  201.     trigger event to your ImageLib objects who may need one.
  202.     If no Message is active it will not take up significant time}
  203.  
  204.     MultiImage2.Trigger;
  205.  
  206.     PMultiImage1.Trigger;
  207.  
  208.     if DBMultiImageToolbar <> Nil then
  209.      DBMultiImageToolbar.PDBMultiImage1.Trigger;
  210.  
  211.     if BForm1 <> Nil then
  212.      BForm1.PMultiImage1.Trigger;
  213.  
  214.     if MMForm1 <> Nil then
  215.      MMForm1.PDBMultiMedia1.Trigger;
  216.  
  217.     if MMForm3 <> Nil then
  218.      MMForm3.PMultiMedia1.Trigger;
  219. end;
  220. {---------------------------------------------------------------------}
  221.  
  222. procedure TDemoForm1.SpeedButton1Click(Sender: TObject);
  223. begin
  224.   FrameGrab:=TFrameGrab.Create(self);
  225.   FrameGrab.ShowModal;
  226.   FrameGrab.Free;
  227. end;
  228. {---------------------------------------------------------------------}
  229.  
  230. procedure TDemoForm1.SpeedButton2Click(Sender: TObject);
  231. begin
  232.   MultiImage2.Visible:=False;
  233.   ViewImageForm:=TViewImageForm.Create(self);
  234.   ViewImageForm.ShowModal;
  235.   ViewImageForm.Free;
  236.   MultiImage2.Visible:=true;
  237.   Application.OnIdle:=Trigger;
  238. end;
  239. {---------------------------------------------------------------------}
  240.  
  241. procedure TDemoForm1.SpeedButton3Click(Sender: TObject);
  242. begin
  243.   ConvertForm1:=TConvertForm1.Create(self);
  244.   ConvertForm1.ShowModal;
  245.   ConvertForm1.Free;
  246.   Application.OnIdle:=Trigger;
  247. end;
  248. {---------------------------------------------------------------------}
  249.  
  250. procedure TDemoForm1.SpeedButton4Click(Sender: TObject);
  251. begin
  252.   MultiImage2.Visible:=False;
  253.   MMBlobForm:=TMMBlobForm.Create(self);
  254.   MMBlobForm.ShowModal;
  255.   MMBlobForm.Free;
  256.   MultiImage2.Visible:=true;
  257.   Application.OnIdle:=Trigger;
  258. end;
  259. {---------------------------------------------------------------------}
  260.  
  261. procedure TDemoForm1.SpeedButton5Click(Sender: TObject);
  262. begin
  263.   MultiImage2.Visible:=False;
  264.   BlobForm1:=TBlobForm1.Create(self);
  265.   BlobForm1.ShowModal;
  266.   BlobForm1.Free;
  267.   MultiImage2.Visible:=true;
  268.   Application.OnIdle:=Trigger;
  269. end;
  270. {---------------------------------------------------------------------}
  271.  
  272. procedure TDemoForm1.SpeedButton6Click(Sender: TObject);
  273. begin
  274.   MultiImage2.Visible:=False;
  275.   MailOrderForm:=TMailOrderForm.Create(self);
  276.   MailOrderForm.ShowModal;
  277.   MailOrderForm.Free;
  278.   MultiImage2.Visible:=true;
  279.   Application.OnIdle:=Trigger;
  280. end;
  281. {---------------------------------------------------------------------}
  282.  
  283. procedure TDemoForm1.SpeedButton7Click(Sender: TObject);
  284. begin
  285.   MultiImage2.Visible:=False;
  286.   ScrollForm1:=TScrollForm1.Create(self);
  287.   ScrollForm1.ShowModal;
  288.   ScrollForm1.Free;
  289.   MultiImage2.Visible:=true;
  290.   Application.OnIdle:=Trigger;
  291. end;
  292. {---------------------------------------------------------------------}
  293.  
  294. procedure TDemoForm1.SpeedButton8Click(Sender: TObject);
  295. begin
  296.  GlobalPalette:=PMultiImage1.Picture.Bitmap.Palette;
  297.  GPaletteD:=TGPaletteD.Create(Self);
  298.  GPaletteD.ShowModal;
  299.  GPaletteD.Free;
  300.  GlobalPalette:=0;
  301. end;
  302. {---------------------------------------------------------------------}
  303.  
  304. procedure TDemoForm1.BitBtn1Click(Sender: TObject);
  305. begin
  306.  Memo1.Visible:=False;
  307.  BitBtn1.Visible:=False;
  308.  BitBtn2.Visible:=False;
  309. end;
  310. {---------------------------------------------------------------------}
  311.  
  312. procedure TDemoForm1.SpeedButton9Click(Sender: TObject);
  313. begin
  314.  Memo1.Lines.Clear;
  315.  Memo1.Lines.LoadFromFile(ExtractFilePath(Application.ExeName)+'ILibCust.txt');
  316.  Memo1.Visible:=true;
  317.  BitBtn1.Visible:=true;
  318.  BitBtn2.Visible:=true;
  319. end;
  320. {---------------------------------------------------------------------}
  321.  
  322. procedure TDemoForm1.SpeedButton10Click(Sender: TObject);
  323. begin
  324.  Memo1.Lines.Clear;
  325.  Memo1.Lines.LoadFromFile(ExtractFilePath(Application.ExeName)+'ILibRef.txt');
  326.  Memo1.Visible:=true;
  327.  BitBtn1.Visible:=true;
  328.  BitBtn2.Visible:=true;
  329. end;
  330. {---------------------------------------------------------------------}
  331.  
  332. procedure TDemoForm1.SpeedButton18Click(Sender: TObject);
  333. begin
  334.  Memo1.Lines.Clear;
  335.  Memo1.Lines.LoadFromFile(ExtractFilePath(Application.ExeName)+'ImageLib.txt');
  336.  Memo1.Visible:=true;
  337.  BitBtn1.Visible:=true;
  338.  BitBtn2.Visible:=true;
  339.  BitBtn2.Visible:=true;
  340. end;
  341. {---------------------------------------------------------------------}
  342.  
  343. procedure TDemoForm1.SpeedButton11Click(Sender: TObject);
  344. begin
  345.  Application.HelpJump('');
  346. end;
  347. {---------------------------------------------------------------------}
  348.  
  349. procedure TDemoForm1.BitBtn3Click(Sender: TObject);
  350. begin
  351.   AboutBox.Image1.Picture.BitMap:=PMultiImage1.Picture.BitMap;
  352.   AboutBox.ShowModal;
  353. end;
  354. {---------------------------------------------------------------------}
  355.  
  356. procedure TDemoForm1.BitBtn2Click(Sender: TObject);
  357. var i : integer;
  358.     p : integer;
  359. begin
  360.  if PrintDialog1.execute then begin
  361.  
  362.    Printer.Begindoc;
  363.    p:=0;
  364.    For i:=0 to Memo1.Lines.Count -1 do begin
  365.     p:=i*45;
  366.     Printer.Canvas.Textout(5,P,Memo1.Lines[i]);
  367.    end;
  368.    Printer.Enddoc;
  369.  end;
  370. end;
  371. {---------------------------------------------------------------------}
  372.  
  373. procedure TDemoForm1.SpeedButton12Click(Sender: TObject);
  374. begin
  375.   IconListBoxDlg:=TIconListBoxDlg.Create(Self);
  376.   IconListBoxDlg.ShowModal;
  377.   IconListBoxDlg.Free;
  378.   PMultiImage1.Invalidate;
  379. end;
  380. {---------------------------------------------------------------------}
  381.  
  382. procedure TDemoForm1.FormActivate(Sender: TObject);
  383. begin
  384.   {Write some text over the image}
  385.   PMultiImage1.Font.Size:=10;
  386.   PMultiImage1.Font.Color:=clLime;
  387.   PMultiImage1.Text:='ImageLib 95/31 evaluation copy by SkyLine Tools (c)';
  388.   PMultiImage1.TextShadow:=True;
  389.   PMultiImage1.TextLeft:=1;
  390.   PMultiImage1.TextTop:=PMultiImage1.ClientRect.Top;
  391.   PMultiImage1.TextRotate:=0;
  392.   PMultiImage1.TextTransParent:=True;
  393.   DemoForm1.Caption:='ImageLib 31 Portfolio';
  394. end;
  395. {---------------------------------------------------------------------}
  396.  
  397. procedure TDemoForm1.SpeedButton14Click(Sender: TObject);
  398. begin
  399.  {Show or hide the toolbar
  400.   Note: The toolbar can only be uses on NON modal forms}
  401.   ImageToolBar1.ShowToolbar:= not ImageToolBar1.ShowToolbar;
  402. end;
  403. {---------------------------------------------------------------------}
  404.  
  405. procedure TDemoForm1.FormClose(Sender: TObject; var Action: TCloseAction);
  406. begin
  407.   {Kill the OnIdle just to be save}
  408.   Application.OnIdle:=Nil;
  409.  
  410.   {In case the toolbar forms are not nil we could free it}
  411.   If BForm1 <> Nil then
  412.    BForm1.Free;
  413.  
  414.   If DBMultiImageToolbar <> Nil then
  415.    DBMultiImageToolbar.Free;
  416.  
  417.   If MMForm1 <> Nil then
  418.    MMForm1.Free;
  419.  
  420.   If MMForm3 <> Nil then
  421.    MMForm3.Free;
  422. end;
  423. {---------------------------------------------------------------------}
  424.  
  425. procedure TDemoForm1.SpeedButton13Click(Sender: TObject);
  426. begin
  427.   {This from includes a toolbar so that we must show it non modal}
  428.   If BForm1 = Nil then
  429.    BForm1:=TBForm1.Create(self);
  430.   BForm1.Show;
  431. end;
  432. {---------------------------------------------------------------------}
  433.  
  434. procedure TDemoForm1.SpeedButton15Click(Sender: TObject);
  435. begin
  436.   {This from includes a toolbar so that we must show it non modal}
  437.   If DBMultiImageToolbar = Nil then
  438.    DBMultiImageToolbar:=TDBMultiImageToolbar.Create(self);
  439.   DBMultiImageToolbar.Show;
  440. end;
  441. {---------------------------------------------------------------------}
  442.  
  443. procedure TDemoForm1.SpeedButton16Click(Sender: TObject);
  444. begin
  445.   {This from includes a toolbar so that we must show it non modal}
  446.   If MMForm1 = Nil then
  447.    MMForm1:=TMMForm1.Create(self);
  448.   MMForm1.Show;
  449. end;
  450. {---------------------------------------------------------------------}
  451.  
  452. procedure TDemoForm1.SpeedButton17Click(Sender: TObject);
  453. begin
  454.   {This from includes a toolbar so that we must show it non modal}
  455.   If MMForm3 = Nil then
  456.    MMForm3:=TMMForm3.Create(self);
  457.   MMForm3.Show;
  458. end;
  459. {---------------------------------------------------------------------}
  460.  
  461. procedure TDemoForm1.SpeedButton19Click(Sender: TObject);
  462. begin
  463.   If RubberbandForm = Nil then
  464.    RubberbandForm:=TRubberbandForm.Create(self);
  465.   RubberbandForm.Show;
  466. end;
  467. {---------------------------------------------------------------------}
  468. {---------------------------------------------------------------------}
  469.  
  470. end.
  471.  
  472.  
  473.  
  474.  
  475.  
  476.