Unit1.pas
上传用户:daoqigc
上传日期:2021-04-20
资源大小:2795k
文件大小:2k
源码类别:

RichEdit

开发平台:

Delphi

  1. {*******************************************************}
  2. {                                                       }
  3. {       RichView                                        }
  4. {       Combo Item Demo                                 }
  5. {                                                       }
  6. {       Copyright (c) Sergey Tkachenko                  }
  7. {       svt@trichview.com                               }
  8. {       http://www.trichview.com                        }
  9. {                                                       }
  10. {*******************************************************}
  11. unit Unit1;
  12. interface
  13. uses
  14.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls,
  15.   Dialogs, RVScroll, RichView, RVStyle, ComboItem, RVTable;
  16. type
  17.   TForm1 = class(TForm)
  18.     RVStyle1: TRVStyle;
  19.     rv: TRichView;
  20.     procedure FormCreate(Sender: TObject);
  21.   private
  22.     { Private declarations }
  23.   public
  24.     { Public declarations }
  25.   end;
  26. var
  27.   Form1: TForm1;
  28. implementation
  29. {$R *.dfm}
  30. procedure TForm1.FormCreate(Sender: TObject);
  31. var item: TRVComboItemInfo;
  32.     table: TRVTableItemInfo;
  33. begin
  34.   rv.AddNL('Virtual Greengrocery',0,1);
  35.   rv.AddNL('',0,1);
  36.   table := TRVTableItemInfo.CreateEx(2,2,rv.RVData);
  37.   table.BorderColor := clSilver;
  38.   table.BorderStyle := rvtbColor;
  39.   table.BorderWidth := 2;
  40.   table.Cells[0,0].Clear;
  41.   table.Cells[1,0].Clear;
  42.   table.Cells[0,1].Clear;
  43.   table.Cells[1,1].Clear;
  44.   table.Cells[0,0].AddNL('Select fruits:',0,0);
  45.   table.Cells[1,0].AddNL('Select vegetables:',0,0);
  46.   table.Cells[0,0].BestWidth := 200;
  47.   table.Cells[0,1].BestWidth := 120;
  48.   table.CellPadding := 5;
  49.   table.ParaNo := 1;
  50.   item := TRVComboItemInfo.CreateEx(rv.RVData, 1, '');
  51.   item.MinWidth := 100;
  52.   item.Items.Add('apple');
  53.   item.Items.Add('banana');
  54.   item.Items.Add('pear');
  55.   table.Cells[0,1].AddItem('', item);
  56.   item := TRVComboItemInfo.CreateEx(rv.RVData, 1, '');
  57.   item.Items.Add('cucumber');
  58.   item.Items.Add('tomato');
  59.   item.MinWidth := 100;
  60.   table.Cells[1,1].AddItem('', item);
  61.   rv.AddItem('', table);
  62.   rv.AddNL('(click the gray square to select)',0,1);
  63.   rv.Format;
  64. end;
  65. end.