home *** CD-ROM | disk | FTP | other *** search
/ PC Expert 29 / Pce29cd.iso / RUNIMAGE / DELPHI40 / DEMOS / TEECHART / UBITMAP.PAS < prev    next >
Pascal/Delphi Source File  |  1998-06-16  |  2KB  |  88 lines

  1. {****************************************}
  2. {    TeeChart. TChart Component          }
  3. { Copyright (c) 1995,96 by David Berneda }
  4. {    All Rights Reserved                 }
  5. {****************************************}
  6. unit UBitmap;
  7.  
  8. interface
  9.  
  10. { This example shows how to draw a custom Bitmap on a Panel Chart component }
  11.  
  12. { Bitmap images (TBitmap component) can be painted in several styles:
  13.  
  14.   pbmStretch : Bitmap is stretched to fit Chart Panel Rectangle
  15.   pbmTile    : Bitmap is repeteadly painted without stretching.
  16.   pbmCenter  : Bitmap is painted centered without stretching.
  17.  
  18.   You use the PanelBitmapMode property:
  19.  
  20.   Chart1.PanelBitmapMode := pbmTile ;
  21. }
  22.  
  23. uses
  24.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  25.   Forms, Dialogs, ExtCtrls, Chart, Series, StdCtrls, Teengine, Buttons,
  26.   TeeProcs;
  27.  
  28. type
  29.   TBitmapForm = class(TForm)
  30.     Chart1: TChart;
  31.     OpenDialog1: TOpenDialog;
  32.     Panel1: TPanel;
  33.     RadioGroup1: TRadioGroup;
  34.     BitBtn1: TBitBtn;
  35.     BitBtn3: TBitBtn;
  36.     CheckBox1: TCheckBox;
  37.     Series1: TBarSeries;
  38.     Button1: TButton;
  39.     Memo1: TMemo;
  40.     procedure FormCreate(Sender: TObject);
  41.     procedure RadioGroup1Click(Sender: TObject);
  42.     procedure BitBtn1Click(Sender: TObject);
  43.     procedure CheckBox1Click(Sender: TObject);
  44.     procedure Button1Click(Sender: TObject);
  45.   private
  46.     { Private declarations }
  47.   public
  48.     { Public declarations }
  49.   end;
  50.  
  51. implementation
  52.  
  53. {$R *.DFM}
  54.  
  55. procedure TBitmapForm.FormCreate(Sender: TObject);
  56. begin
  57.  { This is to show something random in this example }
  58.   Series1.FillSampleValues(10);
  59. end;
  60.  
  61. procedure TBitmapForm.RadioGroup1Click(Sender: TObject);
  62. begin
  63.   Chart1.BackImageMode:=TTeeBackImageMode(RadioGroup1.ItemIndex);
  64. end;
  65.  
  66. procedure TBitmapForm.BitBtn1Click(Sender: TObject);
  67. begin
  68.   if OpenDialog1.Execute then
  69.   begin
  70.     RadioGroup1.Enabled:=False;
  71.     Chart1.BackImage.LoadFromFile(OpenDialog1.FileName);
  72.     RadioGroup1.Enabled:=True;
  73.   end;
  74. end;
  75.  
  76. procedure TBitmapForm.CheckBox1Click(Sender: TObject);
  77. begin
  78.   Chart1.BackImageInside:=CheckBox1.Checked;
  79. end;
  80.  
  81. procedure TBitmapForm.Button1Click(Sender: TObject);
  82. begin
  83.   Chart1.BackImage:=nil;
  84. end;
  85.  
  86.  
  87. end.
  88.