Marco Web Center |
Home: Code Repository: Mastering Delphi 5Project SPLITH
Project StructureSPLITH.DPRprogram SplitH; uses Forms, SplitHF in 'SplitHF.pas' {Form1}; {$R *.RES} begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. SPLITHF.PASunit SplitHF; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, ComCtrls; type TForm1 = class(TForm) MemoUp: TMemo; Splitter1: TSplitter; MemoDown: TMemo; OpenDialog1: TOpenDialog; StatusBar1: TStatusBar; procedure Splitter1Moved(Sender: TObject); procedure MemoDblClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.Splitter1Moved(Sender: TObject); begin StatusBar1.Panels[0].Text := Format ( 'Upper Memo: %d - Lower Memo: %d', [MemoUp.Height, MemoDown.Height]); end; procedure TForm1.MemoDblClick(Sender: TObject); begin with Sender as TMemo, OpenDialog1 do if Execute then Lines.LoadFromFile (FileName); end; end. SPLITHF.DFMobject Form1: TForm1 Left = 114 Top = 102 Width = 613 Height = 387 Caption = 'Horizontal Splitter' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = True OnResize = Splitter1Moved PixelsPerInch = 96 TextHeight = 13 object Splitter1: TSplitter Left = 0 Top = 177 Width = 605 Height = 5 Cursor = crVSplit Align = alTop OnMoved = Splitter1Moved end object MemoUp: TMemo Left = 0 Top = 0 Width = 605 Height = 177 Align = alTop Constraints.MinHeight = 50 ScrollBars = ssVertical TabOrder = 0 OnDblClick = MemoDblClick end object MemoDown: TMemo Left = 0 Top = 182 Width = 605 Height = 159 Align = alClient Constraints.MinHeight = 50 ScrollBars = ssVertical TabOrder = 1 OnDblClick = MemoDblClick end object StatusBar1: TStatusBar Left = 0 Top = 341 Width = 605 Height = 19 Panels = < item Width = 50 end> SimplePanel = False end object OpenDialog1: TOpenDialog Filter = 'Text file (*.txt)|*.txt|Any file (*.*)|*.*' Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist] Left = 40 Top = 32 end end
|
||
© Copyright Marco Cantù, 1995-2020, All rights reserved |