⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 codepe.cpp

📁 该系统为花店销售管理系统
💻 CPP
字号:
// codepe.cpp : implementation file
//

#include "stdafx.h"
#include "flowerSaleSystem.h"
#include "codepe.h"
#include "deset.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

extern CString m_iden;
/////////////////////////////////////////////////////////////////////////////
// codepe property page

IMPLEMENT_DYNCREATE(codepe, CPropertyPage)

codepe::codepe() : CPropertyPage(codepe::IDD)
{
	//{{AFX_DATA_INIT(codepe)
	m_user = _T("");
	m_psw = _T("");
	m_phn = _T("");
	m_name = _T("");
	m_year = 0;
	//}}AFX_DATA_INIT
}

codepe::~codepe()
{
}

void codepe::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(codepe)
	DDX_Text(pDX, IDC_EDITuser, m_user);
	DDX_Text(pDX, IDC_EDITpsw, m_psw);
	DDX_Text(pDX, IDC_EDITphn, m_phn);
	DDX_Text(pDX, IDC_EDITname, m_name);
	DDX_Text(pDX, IDC_EDITyear, m_year);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(codepe, CPropertyPage)
	//{{AFX_MSG_MAP(codepe)
	ON_BN_CLICKED(IDC_BUTTONmodify, OnBUTTONmodify)
	ON_WM_PAINT()
	ON_WM_CTLCOLOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// codepe message handlers

BOOL codepe::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	// TODO: Add extra initialization here
    deset m_set;
	m_set.m_strFilter.Format("mid='%s'",m_iden);
	if(m_set.Open())
	{
		m_user=m_set.m_mid;
		m_psw=m_set.m_mpassword;
		m_phn=m_set.m_mphone;
		//m_year.Format("%d",m_set.m_myear);
		m_year=m_set.m_myear;
		m_name=m_set.m_mname;
		if(m_set.m_msex=="男") CheckRadioButton(IDC_RADIO,IDC_RADIO3,IDC_RADIO);
		else  CheckRadioButton(IDC_RADIO,IDC_RADIO3,IDC_RADIO3);
	}
	m_set.Close();
    CWnd *wnd1=GetDlgItem(IDC_EDITphn);
	CWnd *wnd2=GetDlgItem(IDC_EDITname);
	CWnd *wnd3=GetDlgItem(IDC_EDITuser);
	CWnd *wnd4=GetDlgItem(IDC_EDITpsw);
	CWnd *wnd5=GetDlgItem(IDC_EDITyear);
	CWnd *wnd6=GetDlgItem(IDC_RADIO);
	CWnd *wnd7=GetDlgItem(IDC_RADIO3);
	wnd1->EnableWindow(FALSE);
	wnd2->EnableWindow(FALSE);
	wnd3->EnableWindow(FALSE);
	wnd4->EnableWindow(FALSE);
	wnd5->EnableWindow(FALSE);
	wnd6->EnableWindow(FALSE);
	wnd7->EnableWindow(FALSE);
	m_brush.CreateSolidBrush(RGB(0,0,0));
	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void codepe::OnBUTTONmodify() 
{
	// TODO: Add your control notification handler code here
		CString bttext;
    CWnd *wnd=GetDlgItem(IDC_BUTTONmodify);
	GetDlgItemText(IDC_BUTTONmodify,bttext);
	if(bttext=="我要修改")
	{
		CWnd *wnd1=GetDlgItem(IDC_EDITphn);
		CWnd *wnd2=GetDlgItem(IDC_EDITname);
		//CWnd *wnd3=GetDlgItem(IDC_EDITuser);
		CWnd *wnd4=GetDlgItem(IDC_EDITpsw);
		CWnd *wnd5=GetDlgItem(IDC_EDITyear);
		CWnd *wnd6=GetDlgItem(IDC_RADIO);
        CWnd *wnd7=GetDlgItem(IDC_RADIO3);
		wnd1->EnableWindow(TRUE);
		wnd2->EnableWindow(TRUE);
		wnd4->EnableWindow(TRUE);
		wnd5->EnableWindow(TRUE);
		wnd6->EnableWindow(TRUE);
		wnd7->EnableWindow(TRUE);
		wnd->SetWindowText("确定修改");
	}
	else 
	{
        UpdateData(TRUE);
		if(m_name.GetLength()>6)
	{
		MessageBox("此系统最多支持3个汉字或6个英语字母!","温馨提示");
		return;
	}
	if(m_psw.GetLength()>6)
	{
		MessageBox("此系统最多支持8位密码!","温馨提示");
	}
	if(m_phn.GetLength()>12)
	{
		MessageBox("此系统最多支持12位电话号码!","温馨提示");
		return;
	}
		deset de;
		de.m_strFilter.Format("mid='%s'",m_iden);
		if(de.Open())
		{
			de.Edit();
			de.m_mid=m_iden;
			de.m_mname=m_name;
			int temp=GetCheckedRadioButton(IDC_RADIO,IDC_RADIO3);
			if(temp==IDC_RADIO) de.m_msex="男";
			else de.m_msex="女";
			de.m_myear=m_year;
			de.m_mphone=m_phn;
			de.m_mpassword=m_psw;
            de.m_mpower="普通";
		}

		de.Update();
		de.Requery();
		de.Close();
		CWnd *wnd1=GetDlgItem(IDC_EDITphn);
		CWnd *wnd2=GetDlgItem(IDC_EDITname);
		CWnd *wnd3=GetDlgItem(IDC_EDITuser);
		CWnd *wnd4=GetDlgItem(IDC_EDITpsw);
		CWnd *wnd5=GetDlgItem(IDC_EDITyear);
        CWnd *wnd6=GetDlgItem(IDC_RADIO);
		wnd1->EnableWindow(FALSE);
		wnd2->EnableWindow(FALSE);
		wnd3->EnableWindow(FALSE);
		wnd4->EnableWindow(FALSE);
	    wnd5->EnableWindow(FALSE);
		wnd6->EnableWindow(FALSE);
		wnd->SetWindowText("我要修改");
	}
}

void codepe::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	CDC     memDC;
	CBitmap	bitmap;
	BITMAP  bmp;
	bitmap.LoadBitmap(IDB_BITMAPc);
	bitmap.GetObject (sizeof(BITMAP),&bmp);
	memDC.CreateCompatibleDC (&dc);
	memDC.SelectObject (bitmap);
		dc.BitBlt (0,0,bmp.bmWidth ,bmp.bmHeight ,&memDC,0,0,SRCCOPY);
	// Do not call CPropertyPage::OnPaint() for painting messages
}

HBRUSH codepe::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	if(nCtlColor==CTLCOLOR_LISTBOX)   
	{   
		pDC->SetBkMode(TRANSPARENT);//   
		pDC->SetTextColor(RGB(255,0,0));   
		return   m_brush;   
	}  
	if(nCtlColor==CTLCOLOR_EDIT)
	{
		
		pDC->SetBkMode(TRANSPARENT);//   
		pDC->SetTextColor(RGB(0,255,0));   
		return m_brush;
	}
	if(nCtlColor==CTLCOLOR_STATIC)
    {
		pDC->SetBkMode(TRANSPARENT);//   
		pDC->SetTextColor(RGB(255,255,0));  
		return   m_brush
			;   
	}
	if(nCtlColor==CTLCOLOR_DLG)   
	{   
		pDC->SetBkMode(TRANSPARENT);//   
		pDC->SetTextColor(RGB(175,216,229));   //浅色字体   
		return   hbr;   
	}
	// TODO: Return a different brush if the default is not desired
	return hbr;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -