mainu.pas
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:10k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit mainu;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  5.   StdCtrls, ExtCtrls, fcImageForm, fcbutton,
  6.   ComCtrls, Buttons, fcShapeBtn, fcImgBtn, fcImage, fcClearPanel,
  7.   fcButtonGroup, fcStatusBar, fcOutlookList, fcOutlookBar, fcFontCombo,
  8.   fcCombo, fcTreeCombo, fcLabel, fcdbtreeview, Db, DBTables, fcColorCombo,
  9.   DBCtrls, ShellApi, fcDemoRichEdit, dbselftree, paneldemo,panel2u,calcdemou,
  10.   trackdemo, progressdemo;
  11. type
  12.   TMainForm = class(TForm)
  13.     PageControl1: TPageControl;
  14.     TabSheet4: TTabSheet;
  15.     GroupBox2: TGroupBox;
  16.     GroupBox3: TGroupBox;
  17.     DemoButtonImageBtn: TfcShapeBtn;
  18.     GroupBox1: TGroupBox;
  19.     DemoButtonShapeBtn1: TfcShapeBtn;
  20.     DemoButtonLabel: TfcShapeBtn;
  21.     TabSheet1: TTabSheet;
  22.     TabSheet2: TTabSheet;
  23.     GroupBox5: TGroupBox;
  24.     GroupBox6: TGroupBox;
  25.     TabSheet3: TTabSheet;
  26.     TabSheet5: TTabSheet;
  27.     DemoButtonButtonGroup: TfcShapeBtn;
  28.     DemoButtonOutlookBar: TfcShapeBtn;
  29.     TabSheet6: TTabSheet;
  30.     GroupBox4: TGroupBox;
  31.     GroupBox7: TGroupBox;
  32.     TabSheet7: TTabSheet;
  33.     DemoButtonStatusBar: TfcShapeBtn;
  34.     TabSheet8: TTabSheet;
  35.     DemoButtonTiler: TfcShapeBtn;
  36.     fcShapeBtn1: TfcShapeBtn;
  37.     fcImageForm1: TfcImageForm;
  38.     fcButtonGroup1: TfcButtonGroup;
  39.     TitleLabel: TfcLabel;
  40.     fcShapeBtn3: TfcShapeBtn;
  41.     fcLabel2: TfcLabel;
  42.     Shape1: TShape;
  43.     fcImageBtn1: TfcImageBtn;
  44.     fcShapeBtn2: TfcShapeBtn;
  45.     fcShapeBtn5: TfcShapeBtn;
  46.     fcShapeBtn6: TfcShapeBtn;
  47.     fcShapeBtn7: TfcShapeBtn;
  48.     fcShapeBtn8: TfcShapeBtn;
  49.     fcOutlookBar1: TfcOutlookBar;
  50.     RichEditPage1: TfcShapeBtn;
  51.     RichEditPage2: TfcShapeBtn;
  52.     RichEditPage3: TfcShapeBtn;
  53.     RichEditPage4: TfcShapeBtn;
  54.     RichEditPage5: TfcShapeBtn;
  55.     RichEditPage6: TfcShapeBtn;
  56.     RichEditPage7: TfcShapeBtn;
  57.     RichEditPage8: TfcShapeBtn;
  58.     fcDemoRichEdit1: TfcDemoRichEdit;
  59.     fcDemoRichEdit2: TfcDemoRichEdit;
  60.     fcDemoRichEdit3: TfcDemoRichEdit;
  61.     fcDemoRichEdit4: TfcDemoRichEdit;
  62.     fcDemoRichEdit5: TfcDemoRichEdit;
  63.     fcDemoRichEdit6: TfcDemoRichEdit;
  64.     fcDemoRichEdit7: TfcDemoRichEdit;
  65.     fcDemoRichEdit8: TfcDemoRichEdit;
  66.     fcShapeBtn9: TfcShapeBtn;
  67.     fcShapeBtn10: TfcShapeBtn;
  68.     fcShapeBtn11: TfcShapeBtn;
  69.     DemoFramingBtn: TfcShapeBtn;
  70.     TabSheet9: TTabSheet;
  71.     RichEditPage9: TfcShapeBtn;
  72.     fcDemoRichEdit9: TfcDemoRichEdit;
  73.     GroupBox8: TGroupBox;
  74.     fcImageBtn2: TfcImageBtn;
  75.     fcShapeBtn12: TfcShapeBtn;
  76.     fcShapeBtn13: TfcShapeBtn;
  77.     fcShapeBtn14: TfcShapeBtn;
  78.     fcShapeBtn15: TfcShapeBtn;
  79.     fcShapeBtn16: TfcShapeBtn;
  80.     DemoPanels: TfcShapeBtn;
  81.     RichEditPage10: TfcShapeBtn;
  82.     fcDemoRichEdit10: TfcDemoRichEdit;
  83.     TabSheet10: TTabSheet;
  84.     fcShapeBtn4: TfcShapeBtn;
  85.     DBImagerDemoButton: TfcShapeBtn;
  86.     Label2DemoButton: TfcShapeBtn;
  87.     GroupBox9: TGroupBox;
  88.     CalculatorDemoButton: TfcShapeBtn;
  89.     Panel2DemoButton: TfcShapeBtn;
  90.     DemoBars: TfcShapeBtn;
  91.     RichEditPage11: TfcShapeBtn;
  92.     fcDemoRichEdit11: TfcDemoRichEdit;
  93.     TabSheet11: TTabSheet;
  94.     fcShapeBtn17: TfcShapeBtn;
  95.     fcShapeBtn18: TfcShapeBtn;
  96.     procedure fcShapeBtn3Click(Sender: TObject);
  97.     procedure fcShapeBtn2Click(Sender: TObject);
  98.     procedure DemoButtonTilerClick(Sender: TObject);
  99.     procedure DemoButtonStatusBarClick(Sender: TObject);
  100.     procedure fcButtonGroup2Change(ButtonGroup: TfcCustomButtonGroup;
  101.       OldSelected, Selected: TfcButtonGroupItem);
  102.     procedure DemoButtonLabelClick(Sender: TObject);
  103.     procedure DemoButtonShapeBtn1Click(Sender: TObject);
  104.     procedure DemoButtonImageBtnClick(Sender: TObject);
  105.     procedure DemoButtonOutlookBarClick(Sender: TObject);
  106.     procedure DemoButtonButtonGroupClick(Sender: TObject);
  107.     procedure fcShapeBtn1Click(Sender: TObject);
  108.     procedure fcButtonGroup1Change(ButtonGroup: TfcCustomButtonGroup;
  109.       OldSelected, Selected: TfcButtonGroupItem);
  110.     procedure DemoButtonImageFormClick(Sender: TObject);
  111.     procedure fcShapeBtn4Click(Sender: TObject);
  112.     procedure fcShapeBtn5Click(Sender: TObject);
  113.     procedure fcShapeBtn6Click(Sender: TObject);
  114.     procedure fcShapeBtn7Click(Sender: TObject);
  115.     procedure fcShapeBtn8Click(Sender: TObject);
  116.     procedure fcImageBtn2Click(Sender: TObject);
  117.     procedure FancyButtonClick(Sender: TObject);
  118.     procedure fcImageBtn3Click(Sender: TObject);
  119.     procedure DemoButtonTreeViewClick(Sender: TObject);
  120.     procedure fcShapeBtn9Click(Sender: TObject);
  121.     procedure fcShapeBtn11Click(Sender: TObject);
  122.     procedure fcShapeBtn12Click(Sender: TObject);
  123.     procedure fcShapeBtn13Click(Sender: TObject);
  124.     procedure fcShapeBtn14Click(Sender: TObject);
  125.     procedure fcShapeBtn15Click(Sender: TObject);
  126.     procedure fcShapeBtn16Click(Sender: TObject);
  127.     procedure DBImagerDemoButtonClick(Sender: TObject);
  128.     procedure Label2DemoButtonClick(Sender: TObject);
  129.     procedure Panel2DemoButtonClick(Sender: TObject);
  130.     procedure CalculatorDemoButtonClick(Sender: TObject);
  131.     procedure fcShapeBtn18Click(Sender: TObject);
  132.     procedure fcShapeBtn17Click(Sender: TObject);
  133.   private
  134.     { Private declarations }
  135.   public
  136.     { Public declarations }
  137.     Procedure ExecuteDemo(AFormClass:TFormClass);
  138.   end;
  139. var
  140.   MainForm: TMainForm;
  141. implementation
  142. uses StatusBars, labelu, Shapeu, ImgButtonDemo, PaintUnit,
  143.   ImgCombos, mapu, orderformu, tabbuttons, imagetabformu,
  144.   DBTreeSample1, TreeDemo, colordemou, TilerUnit, buttongroupdemo,
  145.   ImagerMain, proportional, OutlookBarUnit, Frameu, DBLabelu, DBImageru;
  146. {$R *.DFM}
  147. procedure TMainForm.ExecuteDemo(AFormClass: TFormClass);
  148. begin
  149.    Screen.cursor:= crHourGlass;
  150.    with AFormClass.create(Application) do begin
  151.       Screen.cursor:= crDefault;
  152.       ShowModal;
  153.       Free;
  154.    end
  155. end;
  156. procedure TMainForm.fcShapeBtn3Click(Sender: TObject);
  157. begin
  158.   Close;
  159. end;
  160. procedure TMainForm.fcButtonGroup2Change(ButtonGroup: TfcCustomButtonGroup;
  161.   OldSelected, Selected: TfcButtonGroupItem);
  162. begin
  163.   PageControl1.ActivePage :=
  164.      FindComponent('TabSheet'+IntToStr(Selected.Button.Tag)) as TTabSheet;
  165. end;
  166. procedure TMainForm.fcButtonGroup1Change(ButtonGroup: TfcCustomButtonGroup;
  167.   OldSelected, Selected: TfcButtonGroupItem);
  168. begin
  169.   {Color Active Button's Font and reset old font}
  170.   if OldSelected <> Nil then
  171.      OldSelected.Button.Font.Color := clWhite;
  172.   Selected.Button.Font.Color := clYellow;
  173.   PageControl1.ActivePage :=
  174.      (FindComponent('TabSheet'+IntToStr(Selected.Button.Tag)) as TTabSheet);
  175.   fcOutlookBar1.ActivePage :=
  176.      (FindComponent('RichEditPage'+IntToStr(Selected.Button.Tag)) as TfcCustomBitBtn);
  177.   TitleLabel.Caption := Selected.Button.Caption;
  178. end;
  179. procedure TMainForm.fcShapeBtn2Click(Sender: TObject);
  180. begin
  181.    ExecuteDemo(TTabBtnGroupForm);
  182. end;
  183. procedure TMainForm.DemoButtonTilerClick(Sender: TObject);
  184. begin
  185.    ExecuteDemo(TTilerForm);
  186. end;
  187. procedure TMainForm.DemoButtonStatusBarClick(Sender: TObject);
  188. begin
  189.    ExecuteDemo(TStatusBarDemoForm);
  190. end;
  191. procedure TMainForm.DemoButtonLabelClick(Sender: TObject);
  192. begin
  193.    ExecuteDemo(TLabelForm);
  194. end;
  195. procedure TMainForm.DemoButtonShapeBtn1Click(Sender: TObject);
  196. begin
  197.    ExecuteDemo(TShapeBtnDemoForm);
  198. end;
  199. procedure TMainForm.DemoButtonImageBtnClick(Sender: TObject);
  200. begin
  201.    ExecuteDemo(TImageBtnDemoForm);
  202. end;
  203. procedure TMainForm.DemoButtonOutlookBarClick(Sender: TObject);
  204. begin
  205.    ExecuteDemo(TPaintForm);
  206. end;
  207. procedure TMainForm.DemoButtonButtonGroupClick(Sender: TObject);
  208. begin
  209.    if FileExists(PChar(ExtractFileDir(Application.ExeName) + 'ButtonGroupDemo1stClassMDI.exe')) then
  210.       ShellExecute(Handle, 'OPEN', PChar(ExtractFileDir(Application.ExeName) + 'ButtonGroupDemo1stClassMDI.exe'), nil, nil, sw_shownormal)
  211.    else
  212.       ShellExecute(Handle, 'OPEN', PChar(ExtractFileDir(Application.ExeName) + 'Demo1stClassMDI.exe'), nil, nil, sw_shownormal);
  213. end;
  214. procedure TMainForm.fcShapeBtn1Click(Sender: TObject);
  215. begin
  216.    ExecuteDemo(TMapForm);
  217. end;
  218. procedure TMainForm.DemoButtonImageFormClick(Sender: TObject);
  219. begin
  220.    ExecuteDemo(TOrderForm);
  221. end;
  222. procedure TMainForm.fcShapeBtn4Click(Sender: TObject);
  223. begin
  224.    ExecuteDemo(TPanelDemoForm);
  225. end;
  226. procedure TMainForm.fcShapeBtn5Click(Sender: TObject);
  227. begin
  228.    ExecuteDemo(TButtonGroupDemo2);
  229. end;
  230. procedure TMainForm.fcShapeBtn6Click(Sender: TObject);
  231. begin
  232.    ExecuteDemo(TImagerForm);
  233. end;
  234. procedure TMainForm.fcShapeBtn7Click(Sender: TObject);
  235. begin
  236.    ExecuteDemo(TProportionalDemo);
  237. end;
  238. procedure TMainForm.fcShapeBtn8Click(Sender: TObject);
  239. begin
  240.    ExecuteDemo(TOutlookBarForm);
  241.    
  242. end;
  243. procedure TMainForm.fcImageBtn2Click(Sender: TObject);
  244. begin
  245.    ExecuteDemo(TFrameDemo);
  246. end;
  247. procedure TMainForm.FancyButtonClick(Sender: TObject);
  248. begin
  249.    ExecuteDemo(TSelfDBForm);
  250. end;
  251. procedure TMainForm.fcImageBtn3Click(Sender: TObject);
  252. begin
  253.    ExecuteDemo(TDMTreeViewForm);
  254. end;
  255. procedure TMainForm.DemoButtonTreeViewClick(Sender: TObject);
  256. begin
  257.   ExecuteDemo(TTreeViewDemoForm);
  258. end;
  259. procedure TMainForm.fcShapeBtn9Click(Sender: TObject);
  260. begin
  261.    ExecuteDemo(TDMTreeViewForm);
  262. end;
  263. procedure TMainForm.fcShapeBtn11Click(Sender: TObject);
  264. begin
  265.    ExecuteDemo(TSelfDBForm);
  266. end;
  267. procedure TMainForm.fcShapeBtn12Click(Sender: TObject);
  268. begin
  269.    ExecuteDemo(TColorDemoForm);
  270. end;
  271. procedure TMainForm.fcShapeBtn13Click(Sender: TObject);
  272. begin
  273.    ExecuteDemo(TTreeComboDemoForm);
  274. end;
  275. procedure TMainForm.fcShapeBtn14Click(Sender: TObject);
  276. begin
  277.    ExecuteDemo(TFrameDemo);
  278. end;
  279. procedure TMainForm.fcShapeBtn15Click(Sender: TObject);
  280. begin
  281.    ExecuteDemo(TOrderForm);
  282. end;
  283. procedure TMainForm.fcShapeBtn16Click(Sender: TObject);
  284. begin
  285.    ExecuteDemo(TImageTabForm);
  286. end;
  287. procedure TMainForm.DBImagerDemoButtonClick(Sender: TObject);
  288. begin
  289.    ExecuteDemo(TDBImagerDemoForm);
  290. end;
  291. procedure TMainForm.Label2DemoButtonClick(Sender: TObject);
  292. begin
  293.    ExecuteDemo(TJustifyLabelDemoForm);
  294. end;
  295. procedure TMainForm.Panel2DemoButtonClick(Sender: TObject);
  296. begin
  297.    ExecuteDemo(TPanel2DemoForm);
  298. end;
  299. procedure TMainForm.CalculatorDemoButtonClick(Sender: TObject);
  300. begin
  301.    ExecuteDemo(TCalculatorDemoForm);
  302. end;
  303. procedure TMainForm.fcShapeBtn18Click(Sender: TObject);
  304. begin
  305.    ExecuteDemo(TTrackbarForm)
  306. end;
  307. procedure TMainForm.fcShapeBtn17Click(Sender: TObject);
  308. begin
  309.    ExecuteDemo(TProgressForm)
  310. end;
  311. end.