一个图书管理系统,利用计算机系统实现了图书的信息化管理

源代码在线查看: dlgquerym.cpp

软件大小: 3284 K
上传用户: woshishenb
关键词: 图书管理 图书 信息化管理
下载地址: 免注册下载 普通下载 VIP

相关代码

				// DlgQueryM.cpp : implementation file
				//
				
				#include "stdafx.h"
				#include "bbb.h"
				#include "DlgQueryM.h"
				
				#ifdef _DEBUG
				#define new DEBUG_NEW
				#undef THIS_FILE
				static char THIS_FILE[] = __FILE__;
				#endif
				
				/////////////////////////////////////////////////////////////////////////////
				// CDlgQueryM dialog
				extern CBbbApp theApp;
				
				CDlgQueryM::CDlgQueryM(CWnd* pParent /*=NULL*/)
					: CDialog(CDlgQueryM::IDD, pParent)
				{
					//{{AFX_DATA_INIT(CDlgQueryM)
						// NOTE: the ClassWizard will add member initialization here
					//}}AFX_DATA_INIT
					nSelect = -1;
				}
				
				CDlgQueryM::CDlgQueryM(int iSelect, CWnd* pParent /*=NULL*/)
					: CDialog(CDlgQueryM::IDD, pParent)
				{
					nSelect = iSelect;
				}
				
				
				void CDlgQueryM::DoDataExchange(CDataExchange* pDX)
				{
					CDialog::DoDataExchange(pDX);
					//{{AFX_DATA_MAP(CDlgQueryM)
					DDX_Control(pDX, IDC_TAB1, m_tab);
					//}}AFX_DATA_MAP
				}
				
				
				BEGIN_MESSAGE_MAP(CDlgQueryM, CDialog)
					//{{AFX_MSG_MAP(CDlgQueryM)
					ON_COMMAND(IDC_ADD, OnAdd)
					ON_COMMAND(IDC_MODIFY, OnModify)
					ON_COMMAND(IDC_QUERY, OnQuery)
					ON_COMMAND(IDC_SHUTDOWN, OnShut)
					ON_COMMAND(IDC_PRINT, OnPrint)
					ON_WM_CLOSE()
					//}}AFX_MSG_MAP
				END_MESSAGE_MAP()
				
				/////////////////////////////////////////////////////////////////////////////
				// CDlgQueryM message handlers
				
				BOOL CDlgQueryM::OnInitDialog() 
				{
					CDialog::OnInitDialog();
					
					// TODO: Add extra initialization here
					if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP   
						| CBRS_TOOLTIPS |CBRS_FLYBY | CBRS_SIZE_DYNAMIC))
					{
						return FALSE;      
					}
					
					if(!m_wndReBar.Create(this,TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP|RBS_VERTICALGRIPPER
						| CBRS_TOOLTIPS | CBRS_FLYBY| CBRS_SIZE_DYNAMIC))
					{
						return FALSE;
					}
				
					m_wndToolBar.GetToolBarCtrl().SetButtonWidth(40, 80);  //设置按钮的宽度和长度
					
					CImageList img;	
					//设置图标
					img.Create(22, 22, ILC_COLOR24|ILC_MASK,2,2);
					img.SetBkColor(::GetSysColor(COLOR_BTNFACE));
					img.Add(AfxGetApp()->LoadIcon(IDI_ICON13)); 
				    img.Add(AfxGetApp()->LoadIcon(IDI_ICON12));  	
				    img.Add(AfxGetApp()->LoadIcon(IDI_ICON3));     
					img.Add(AfxGetApp()->LoadIcon(IDI_ICON19));  	
					m_wndToolBar.GetToolBarCtrl().SetImageList(&img);
					img.Detach();
				
					m_wndToolBar.ModifyStyle(0, TBSTYLE_FLAT |CBRS_TOOLTIPS | TBSTYLE_TRANSPARENT|TBBS_CHECKBOX);
				
					m_wndToolBar.SetButtons(NULL, 4); //共九个按钮
					
					// 设置每个工具按钮文字
					m_wndToolBar.SetButtonInfo(0, IDC_QUERY, TBSTYLE_BUTTON, 0);
					m_wndToolBar.SetButtonText(0, "查询");
				
					m_wndToolBar.SetButtonInfo(1, IDC_MODIFY, TBSTYLE_BUTTON , 1);
					m_wndToolBar.SetButtonText(1, "取消");
					
					m_wndToolBar.SetButtonInfo(2, IDC_PRINT, TBSTYLE_BUTTON, 2);
					m_wndToolBar.SetButtonText(2, "打印");
				
				
					m_wndToolBar.SetButtonInfo(3, IDC_SHUTDOWN, TBSTYLE_BUTTON , 3);
					m_wndToolBar.SetButtonText(3, "退出");
				
					CRect rectToolBar;
					m_wndToolBar.GetItemRect(0, &rectToolBar);  //得到按钮的大小	
					rectToolBar.right = 55;
					rectToolBar.bottom= 42;
					m_wndToolBar.SetSizes(rectToolBar.Size(), CSize(20,20)); //设置按钮的大小
					
					//在Rebar中加入ToolBar	
					m_wndReBar.AddBar(&m_wndToolBar);
					RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
				
					m_tab.AddPage("入库查询",     &m_dlg1, IDD_INPUT_QUERY3);
					m_tab.AddPage("入库退货查询", &m_dlg2, IDD_INPUT_BACK_QUERY3);
					m_tab.AddPage("销售查询",     &m_dlg3, IDD_SALE_QUERY3);
					m_tab.AddPage("销售退货查询", &m_dlg4, IDD_SALE_BACK_QUERY3);
				
					if (nSelect >= 0)
					{
						m_tab.Show(nSelect);
					}
					else
					{
						m_tab.Show();
					}	
							
					return TRUE;  
				}
				
				void CDlgQueryM::OnAdd()
				{
				}
				
				void CDlgQueryM::OnModify()
				{
					int cur = m_tab.GetCurSel();
					switch (cur)
					{
					case 0:
						{
							m_dlg1.CancelQuery();
							break;
						}
					case 1:
						{
							m_dlg2.CancelQuery();
							break;
						}
					case 2:
						{
							
							m_dlg3.CancelQuery();
							break;
						}
					case 4:
						{
							
							m_dlg4.CancelQuery();
							break;
						}	
					}
				
				}
				
				void CDlgQueryM::OnQuery()
				{
					int cur = m_tab.GetCurSel();
					switch (cur)
					{
					case 0:
						{
							m_dlg1.Query();
							break;
						}
					case 1:
						{
							m_dlg2.Query();
							break;
						}
					case 2:
						{
							
							m_dlg3.Query();
							break;
						}
					case 3:
						{
							
							m_dlg4.Query();
							break;
						}
					}
				}
				
				
				void CDlgQueryM::OnShut()
				{
				
					CDlgQueryM::OnCancel();
				}
				
				
				void CDlgQueryM::OnClose() 
				{
					CDialog::OnClose();
				}
				
				void CDlgQueryM::OnCancel()
				{
					if (theApp.m_mainfram != NULL)
						theApp.m_mainfram->DestroyWindow();	
					m_tab.DestroyWindow();
					CDialog::OnCancel();
				}
				
				void CDlgQueryM::OnPrint()
				{
					int cur = m_tab.GetCurSel();
					switch (cur)
					{
					case 0:
						{
							m_dlg1.Print();
							break;
						}
					case 1:
						{
							m_dlg2.Print();
							break;
						}
					case 2:
						{
							
							m_dlg3.Print();
							break;
						}
					case 3:
						{
							
							m_dlg4.Print();
							break;
						}
					}
				}
							

相关资源