|
|||||||
АвтоАвтоматизацияАрхитектураАстрономияАудитБиологияБухгалтерияВоенное делоГенетикаГеографияГеологияГосударствоДомДругоеЖурналистика и СМИИзобретательствоИностранные языкиИнформатикаИскусствоИсторияКомпьютерыКулинарияКультураЛексикологияЛитератураЛогикаМаркетингМатематикаМашиностроениеМедицинаМенеджментМеталлы и СваркаМеханикаМузыкаНаселениеОбразованиеОхрана безопасности жизниОхрана ТрудаПедагогикаПолитикаПравоПриборостроениеПрограммированиеПроизводствоПромышленностьПсихологияРадиоРегилияСвязьСоциологияСпортСтандартизацияСтроительствоТехнологииТорговляТуризмФизикаФизиологияФилософияФинансыХимияХозяйствоЦеннообразованиеЧерчениеЭкологияЭконометрикаЭкономикаЭлектроникаЮриспунденкция |
Б2. Пример №2Progect2.dpr: program Project2; uses Forms, Unit1 in 'Unit1.pas' {Form1}, Unit2 in 'Unit2.pas' {Form2}; {$R *.res} begin Application.Initialize; Application.CreateForm(TForm2, Form2); Application.CreateForm(TForm1, Form1); Application.Run; end.
Unit1.pas: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} end.
Unit1.dfm: object Form1: TForm1 Left = 528 Top = 417 Width = 928 Height = 480 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 End
Unit2.dfm: object Form2: TForm2 Left = 203 Top = 118 Width = 487 Height = 376 ActiveControl = Panel1 Caption = 'Form2' Color = clBtnFace ParentFont = True OldCreateOrder = True Position = poScreenCenter OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object Panel1: TPanel Left = 0 Top = 0 Width = 471 Height = 33 Align = alTop BevelOuter = bvNone TabOrder = 0 object DBNavigator: TDBNavigator Left = 8 Top = 4 Width = 240 Height = 25 DataSource = DataSource1 Flat = True Ctl3D = False ParentCtl3D = False TabOrder = 0 end end object Panel2: TPanel Left = 0 Top = 33 Width = 471 Height = 152 Align = alTop BevelOuter = bvNone BorderWidth = 4 Caption = 'Panel2' TabOrder = 1 object ScrollBox: TScrollBox Left = 4 Top = 4 Width = 463 Height = 144 HorzScrollBar.Margin = 6 HorzScrollBar.Range = 376 VertScrollBar.Margin = 6 VertScrollBar.Range = 126 Align = alClient AutoScroll = False BorderStyle = bsNone TabOrder = 0 object Label1: TLabel Left = 6 Top = 6 Width = 42 Height = 13 Caption = 'EventNo' FocusControl = EditEventNo end object Label2: TLabel Left = 67 Top = 6 Width = 45 Height = 13 Caption = 'VenueNo' FocusControl = EditVenueNo end object Label3: TLabel Left = 128 Top = 6 Width = 62 Height = 13 Caption = 'Event_Name' FocusControl = EditEvent_Name end object Label4: TLabel Left = 299 Top = 6 Width = 57 Height = 13 Caption = 'Event_Date' FocusControl = EditEvent_Date end object Label5: TLabel Left = 6 Top = 44 Width = 57 Height = 13 Caption = 'Event_Time' FocusControl = EditEvent_Time end object Label6: TLabel Left = 82 Top = 44 Width = 87 Height = 13 Caption = 'Event_Description' FocusControl = EditEvent_Description end object Label7: TLabel Left = 6 Top = 82 Width = 59 Height = 13 Caption = 'Ticket_price' FocusControl = EditTicket_price end object Label8: TLabel Left = 77 Top = 82 Width = 62 Height = 13 Caption = 'Event_Photo' FocusControl = EditEvent_Photo end object EditEventNo: TDBEdit Left = 6 Top = 21 Width = 55 Height = 21 DataField = 'EventNo' DataSource = DataSource1 TabOrder = 0 end object EditVenueNo: TDBEdit Left = 67 Top = 21 Width = 55 Height = 21 DataField = 'VenueNo' DataSource = DataSource1 TabOrder = 1 end object EditEvent_Name: TDBEdit Left = 128 Top = 21 Width = 165 Height = 21 DataField = 'Event_Name' DataSource = DataSource1 TabOrder = 2 end object EditEvent_Date: TDBEdit Left = 299 Top = 21 Width = 65 Height = 21 DataField = 'Event_Date' DataSource = DataSource1 TabOrder = 3 end object EditEvent_Time: TDBEdit Left = 6 Top = 59 Width = 70 Height = 21 DataField = 'Event_Time' DataSource = DataSource1 TabOrder = 4 end object EditEvent_Description: TDBEdit Left = 82 Top = 59 Width = 288 Height = 21 DataField = 'Event_Description' DataSource = DataSource1 TabOrder = 5 end object EditTicket_price: TDBEdit Left = 6 Top = 97 Width = 65 Height = 21 DataField = 'Ticket_price' DataSource = DataSource1 TabOrder = 6 end object EditEvent_Photo: TDBEdit Left = 77 Top = 97 Width = 20 Height = 21 DataField = 'Event_Photo' DataSource = DataSource1 TabOrder = 7 end end end object Panel3: TPanel Left = 0 Top = 185 Width = 471 Height = 153 Align = alClient BevelOuter = bvNone Caption = 'Panel3' TabOrder = 2 object DBGrid1: TDBGrid Left = 0 Top = 0 Width = 471 Height = 153 Align = alClient DataSource = DataSource2 TabOrder = 0 TitleFont.Charset = DEFAULT_CHARSET TitleFont.Color = clWindowText TitleFont.Height = -11 TitleFont.Name = 'MS Sans Serif' TitleFont.Style = [] end end object Query1: TQuery DatabaseName = 'DBDEMOS' SQL.Strings = ( 'Select' ' events."EventNo",' ' events."VenueNo",' ' events."Event_Name",' ' events."Event_Date",' ' events."Event_Time",' ' events."Event_Description",' ' events."Ticket_price",' ' events."Event_Photo"' 'From "events.db"' 'As events') Left = 361 Top = 3 object Query1EventNo: TIntegerField FieldName = 'EventNo' end object Query1VenueNo: TIntegerField FieldName = 'VenueNo' end object Query1Event_Name: TStringField FieldName = 'Event_Name' Size = 30 end object Query1Event_Date: TDateField FieldName = 'Event_Date' end object Query1Event_Time: TTimeField FieldName = 'Event_Time' end object Query1Event_Description: TMemoField FieldName = 'Event_Description' BlobType = ftMemo Size = 100 end object Query1Ticket_price: TCurrencyField FieldName = 'Ticket_price' end object Query1Event_Photo: TGraphicField FieldName = 'Event_Photo' BlobType = ftGraphic end end object Query2: TQuery DatabaseName = 'DBDEMOS' DataSource = DataSource1 SQL.Strings = ( 'Select' ' venues."VenueNo",' ' venues."Venue",' ' venues."Capacity",' ' venues."Venue_Map",' ' venues."Remarks"' 'From "venues.db"' 'As venues' 'Where' ' "venues"."VenueNo" =:"VenueNo"') Left = 417 Top = 3 ParamData = < item DataType = ftInteger Name = 'VenueNo' ParamType = ptUnknown Size = 4 end> object Query2VenueNo: TIntegerField FieldName = 'VenueNo' end object Query2Venue: TStringField FieldName = 'Venue' Size = 30 end object Query2Capacity: TIntegerField FieldName = 'Capacity' end object Query2Venue_Map: TGraphicField FieldName = 'Venue_Map' BlobType = ftGraphic end object Query2Remarks: TMemoField FieldName = 'Remarks' BlobType = ftMemo Size = 80 end end object DataSource1: TDataSource DataSet = Query1 Left = 389 Top = 3 end object DataSource2: TDataSource DataSet = Query2 Left = 445 Top = 3 end
Unit2.pas unit Unit2; interface uses Windows, Messages, Classes, SysUtils, Graphics, Controls, StdCtrls, Forms, Dialogs, DBCtrls, DB, DBGrids, DBTables, Grids, Mask, ExtCtrls; type TForm2 = class(TForm) Query1EventNo: TIntegerField; Query1VenueNo: TIntegerField; Query1Event_Name: TStringField; Query1Event_Date: TDateField; Query1Event_Time: TTimeField; Query1Event_Description: TMemoField; Query1Ticket_price: TCurrencyField; Query1Event_Photo: TGraphicField; Query2VenueNo: TIntegerField; Query2Venue: TStringField; Query2Capacity: TIntegerField; Query2Venue_Map: TGraphicField; Query2Remarks: TMemoField; ScrollBox: TScrollBox; Label1: TLabel; EditEventNo: TDBEdit; Label2: TLabel; EditVenueNo: TDBEdit; Label3: TLabel; EditEvent_Name: TDBEdit; Label4: TLabel; EditEvent_Date: TDBEdit; Label5: TLabel; EditEvent_Time: TDBEdit; Label6: TLabel; EditEvent_Description: TDBEdit; Label7: TLabel; EditTicket_price: TDBEdit; Label8: TLabel; EditEvent_Photo: TDBEdit; DBGrid1: TDBGrid; DBNavigator: TDBNavigator; Panel1: TPanel; DataSource1: TDataSource; Panel2: TPanel; Panel3: TPanel; Query1: TQuery; Query2: TQuery; DataSource2: TDataSource; procedure FormCreate(Sender: TObject); private { private declarations } public { public declarations } end; var Form2: TForm2; implementation {$R *.DFM} procedure TForm2.FormCreate(Sender: TObject); begin Query1.Open; Query2.Open; end; end.
Поиск по сайту: |
Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав. Студалл.Орг (0.026 сек.) |