SQL 21日自学通(V3.0)(PDF格式)-第95部分
按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!
…………………………………………………………Page 517……………………………………………………………
SQL 21 日自学通(V1。0) 翻译人 笨猪
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App mand to run the dialog
void CTyssqlApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg。DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CTyssqlApp mands
// tyssqdoc。cpp : implementation of the CTyssqlDoc class
//
#include 〃stdafx。h〃
#include 〃tyssql。h〃
#include 〃tyssqset。h〃
#include 〃tyssqdoc。h〃
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE'' = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTyssqlDoc
IMPLEMENT_DYNCREATE(CTyssqlDoc; CDocument)
BEGIN_MESSAGE_MAP(CTyssqlDoc; CDocument)
//{{AFX_MSG_MAP(CTyssqlDoc)
// NOTE the ClassWizard will add and remove mapping macros here。
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
517
…………………………………………………………Page 518……………………………………………………………
SQL 21 日自学通(V1。0) 翻译人 笨猪
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTyssqlDoc construction/destruction
CTyssqlDoc::CTyssqlDoc()
{
// TODO: add one…time construction code here
}
CTyssqlDoc::~CTyssqlDoc()
{
}
BOOL CTyssqlDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CTyssqlDoc diagnostics
#ifdef _DEBUG
void CTyssqlDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CTyssqlDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
518
…………………………………………………………Page 519……………………………………………………………
SQL 21 日自学通(V1。0) 翻译人 笨猪
/////////////////////////////////////////////////////////////////////////////
// CTyssqlDoc mands
// stdafx。cpp : source file that includes just the standard includes
// stdafx。pch will be the pre…piled header
// stdafx。obj will contain the pre…piled type information
#include 〃stdafx。h〃
// mainfrm。cpp : implementation of the CMainFrame class
//
#include 〃stdafx。h〃
#include 〃tyssql。h〃
#include 〃mainfrm。h〃
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE'' = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame; CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame; CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
// NOTE the ClassWizard will add and remove mapping macros here。
// DO NOT EDIT what you see in these blocks of generated code !
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// arrays of IDs used to initialize control bars
// toolbar buttons IDs are mand buttons
static UINT BASED_CODE buttons'' =
{
519
…………………………………………………………Page 520……………………………………………………………
SQL 21 日自学通(V1。0) 翻译人 笨猪
// same order as in the bitmap 'toolbar。bmp'
ID_EDIT_CUT;
ID_EDIT_COPY;
ID_EDIT_PASTE;
ID_SEPARATOR;
ID_FILE_PRINT;
ID_SEPARATOR;
ID_RECORD_FIRST;
ID_RECORD_PREV;
ID_RECORD_NEXT;
ID_RECORD_LAST;
ID_SEPARATOR;
ID_APP_ABOUT;
};
static UINT BASED_CODE indicators'' =
{
ID_SEPARATOR; // status line indicator
ID_INDICATOR_CAPS;
ID_INDICATOR_NUM;
ID_INDICATOR_SCRL;
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
520
…………………………………………………………Page 521……………………………………………………………
SQL 21 日自学通(V1。0) 翻译人 笨猪
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == …1)
return …1;
if (!m_wndToolBar。Create(this) ||
!m_wndToolBar。LoadBitmap(IDR_MAINFRAME) ||
!m_wndToolBar。SetButtons(buttons;
sizeof(buttons)/sizeof(UINT)))
{
TRACE(〃Failed to create toolbarn〃);
return …1; // fail to create
}
if (!m_wndStatusBar。Create(this) ||
!m_wndStatusBar。SetIndicators(indicators;
sizeof(indicators)/sizeof(UINT)))
{
TRACE(〃Failed to create status barn〃);
return …1; // fail to create
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
521
…………………………………………………………Page 522……………………………………………………………
SQL 21 日自学通(V1。0) 翻译人 笨猪
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
522
…………………………………………………………Page 523……………………………………………………………
SQL 21 日自学通(V1。0) 翻译人 笨猪
附件 C 第 14 天中的 Delphi 源代码清单
program Tyssql;
uses
Forms;
Unit1 in 'UNIT1。PAS' {Form1};
Unit2 in 'UNIT2。PAS' {Form2};
{R *。RES}
begin
Application。CreateForm(TForm2; Form2);
Application。CreateForm(TForm1; Form1);
Application。Run;
end。
unit Unit1;
interface
uses
SysUtils; WinTypes; WinProcs; Messages; Classes; Graphics; Controls;
Forms; Dialogs;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{R *。DFM}
523
…………………………………………………………Page 524……………………………………………………………
SQL 21 日自学通(V1。0) 翻译人 笨猪
end。
unit Unit2;
interface
uses
SysUtils; WinTypes; WinProcs; Messages; Classes; Graphics; Controls;
StdCtrls; Forms; DBCtrls; DB; DBGrids; DBTables; Grids; Mask; ExtCtrls;
type
TForm2 = class(TForm)
ScrollBox: TScrollBox;
Label1: TLabel;
EditPARTNUM: TDBEdit;
Label2: TLabel;
EditDESCRIPTION: TDBEdit;
Label3: TLabel;
EditPRICE: 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;