BitMenuF.pas
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:5k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit BitMenuF;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  5.   ExtCtrls, Menus;
  6. type
  7.   TForm1 = class(TForm)
  8.     ShapeDemo: TShape;
  9.     MainMenu1: TMainMenu;
  10.     File1: TMenuItem;
  11.     Exit1: TMenuItem;
  12.     Shape1: TMenuItem;
  13.     Ellipse1: TMenuItem;
  14.     RoundRec1: TMenuItem;
  15.     Rectang1: TMenuItem;
  16.     Color1: TMenuItem;
  17.     Red1: TMenuItem;
  18.     Green1: TMenuItem;
  19.     Blue1: TMenuItem;
  20.     Help1: TMenuItem;
  21.     About1: TMenuItem;
  22.     procedure FormResize(Sender: TObject);
  23.     procedure Exit1Click(Sender: TObject);
  24.     procedure About1Click(Sender: TObject);
  25.     procedure ColorClick(Sender: TObject);
  26.     procedure FormCreate(Sender: TObject);
  27.     procedure Ellipse1Click(Sender: TObject);
  28.     procedure RoundRec1Click(Sender: TObject);
  29.     procedure Rectang1Click(Sender: TObject);
  30.     procedure ColorMeasureItem(Sender: TObject; ACanvas: TCanvas;
  31.       var Width, Height: Integer);
  32.     procedure ColorDrawItem(Sender: TObject; ACanvas: TCanvas;
  33.       ARect: TRect; Selected: Boolean);
  34.     procedure ShapeMeasureItem(Sender: TObject; ACanvas: TCanvas;
  35.       var Width, Height: Integer);
  36.     procedure Ellipse1DrawItem(Sender: TObject; ACanvas: TCanvas;
  37.       ARect: TRect; Selected: Boolean);
  38.     procedure RoundRec1DrawItem(Sender: TObject; ACanvas: TCanvas;
  39.       ARect: TRect; Selected: Boolean);
  40.     procedure Rectang1DrawItem(Sender: TObject; ACanvas: TCanvas;
  41.       ARect: TRect; Selected: Boolean);
  42.   private
  43.     { Private declarations }
  44.   end;
  45. var
  46.   Form1: TForm1;
  47. implementation
  48. {$R *.DFM}
  49. procedure TForm1.FormResize(Sender: TObject);
  50. begin
  51.   ShapeDemo.SetBounds (ClientWidth div 6, ClientHeight div 6,
  52.     2 * ClientWidth div 3, 2 * ClientHeight div 3);
  53. end;
  54. procedure TForm1.Exit1Click(Sender: TObject);
  55. begin
  56.   Close;
  57. end;
  58. procedure TForm1.About1Click(Sender: TObject);
  59. begin
  60.   MessageDlg ('Owner-draw menu example,'#13 +
  61.     'from "Mastering Delphi" by Marco Cant