📄 userlogin.cpp
字号:
// UserLogin.cpp : implementation file
//
#include "stdafx.h"
#include "Toolmangne.h"
#include "UserLogin.h"
#include "Reg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUserLogin dialog
CUserLogin::CUserLogin(CWnd* pParent /*=NULL*/)
: CDialog(CUserLogin::IDD, pParent)
{
//{{AFX_DATA_INIT(CUserLogin)
m_user = _T("");
m_password = _T("");
m_style = _T("供应商");
//}}AFX_DATA_INIT
}
void CUserLogin::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUserLogin)
DDX_Text(pDX, IDC_EDIT1, m_user);
DDX_Text(pDX, IDC_EDIT2, m_password);
DDX_CBString(pDX, IDC_COMBO1, m_style);
DDX_Control(pDX,IDC_BUTTON1, m_set);
DDX_Control(pDX,IDC_BUTTON2, about);
DDX_Control(pDX,IDOK,Onok);
DDX_Control(pDX,IDCANCEL,Exit);
//}}AFX_DATA_MAP
m_set.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, 30);
m_set.SetBkColor(RGB(162,189,252));
m_set.SetRounded(TRUE);
Onok.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, 30);
Onok.SetBkColor(RGB(162,189,252));
Onok.SetRounded(TRUE);
Exit.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, 30);
Exit.SetBkColor(RGB(162,189,252));
Exit.SetRounded(TRUE);
about.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, 30);
about.SetBkColor(RGB(162,189,252));
about.SetRounded(TRUE);
}
BEGIN_MESSAGE_MAP(CUserLogin, CDialog)
//{{AFX_MSG_MAP(CUserLogin)
ON_BN_CLICKED(IDOK, OnLogin)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//ON_BN_CLICKED(IDC_BUTTON2, OnMore)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUserLogin message handlers
void CUserLogin::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
void CUserLogin::OnLogin()
{
UpdateData(true);
CString user,pass,style;
user = m_user;
pass = m_password;
style= m_style;
// TODO: Add your control notification handler code here
CDialog::OnOK();
}
void CUserLogin::OnButton1()
{
// TODO: Add your control notification handler code here
CReg reg;
reg.DoModal();
}
/*
void CUserLogin::OnMore()
{
m_bVertical = !m_bVertical;
if(m_bVertical == FALSE) //不显示
{
SetDlgItemText(IDC_BUTTON2,_T("关于>>"));
SizeWindow(m_nReducedHeight,true);
}
else //显示
{
SetDlgItemText(IDC_BUTTON2,_T("<<隐藏"));
SizeWindow(m_nReducedHeight,false);
}
UpdateWindow();
}
BOOL CUserLogin::OnInitDialog()
{
*/ /*
CDialog::OnInitDialog();
//对话框居中显示
CRect dlgRect;
GetWindowRect(dlgRect);
CRect desktopRect;
GetDesktopWindow()->GetWindowRect(desktopRect);
MoveWindow(
(desktopRect.Width() - dlgRect.Width()) / 2,
(desktopRect.Height() - dlgRect.Height()) / 2,
0,
0 );
//"关于"对话框中对话框可收缩效果
CRect Rect1,Rect2; //对话框收缩时大小
GetDlgItem(IDC_DYCREDITS)->GetWindowRect(Rect1);
//GetDlgItem(IDC_COPYRIGHT)->GetWindowRect(Rect2);
m_nReducedHeight = Rect1.Height()+(Rect1.top -Rect2.bottom)/2; //收缩后窗体高度
dlgRect.bottom -= (Rect1.Height()+(Rect1.top -Rect2.bottom)/2);
MoveWindow(&dlgRect); //如果要显示对话框起始动态效果的话,不能使用该句
m_bVertical=false;
//加入EMAIL的超连接
//m_Mail.SetURL(_T("mailto:jingzhou_xu@163.net"));
//m_Mail.SetUnderline(FALSE);
//显示动态GIF图像logo
*
/*
if(m_Flag.Load(MAKEINTRESOURCE(IDR_FLAG),_T("GIF")))
{
m_Flag.SetBkColor(RGB(160,180,220));
m_Flag.Draw();
}
//显示荣誉效果框
srand((unsigned)time(NULL));
// 内容
CString s;
s = "<font color='255,255,255' face='宋体' size='12' align='center'><br><p>";
s += "<font color='200,250,100' size='18' face='宋体' style='ui'>直接通过DAO读、写Access文件示例</font><br><br><p>";
s += "<font color='200,250,100' size='14' face='宋体'>作者:徐景周</font><br><br><p>";
s += "<font color='200,250,100' size='14' face='宋体'>未来工作室出品</font><br><p>";
//格式化并加入字符串
m_wndCredits.FormatDataString(s);
// 绘制闪电效果
m_wndCredits.m_pBackgroundPaint = CUserLogin::DrawCreditsBackground;
m_wndCredits.m_dwBackgroundPaintLParam = TRUE;
// 默认背景置黑色
m_wndCredits.m_crInternalTransparentColor = RGB(255,255,255);
//滚动速度
m_wndCredits.m_nTimerSpeed = 40;
//用户拖拉滚动
m_wndCredits.m_bCanScroll = TRUE;
// 创建荣誉框
m_wndCredits.Create(WS_EX_CLIENTEDGE,WS_VISIBLE|WS_CHILD,IDC_DYCREDITS,this,0,0,0);
*/
/*
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CUserLogin::SizeWindow(int ReduceHeight, bool bExtend)
{
CRect rc;
GetWindowRect(&rc);
if(bExtend)
{
for (int i= 0; i < ReduceHeight; i++)
{
rc.bottom--;
MoveWindow(&rc);
}
}
else
{
for (int i= 0; i < ReduceHeight; i++)
{
rc.bottom++;
MoveWindow(&rc);
}
}
}
void CUserLogin::DrawCreditsBackground(CDC *pDC, RECT rect, BOOL bAnimate, DWORD lParam)
{
static int on1,on2,oon1,oon2;
pDC->FillSolidRect(&rect,0x00000000);
if(bAnimate || (!lParam)) // return now if we are not supposed to do the animation
return;
int n1,n2;
n1 = rand()*200/RAND_MAX-100;
n2 = rand()*200/RAND_MAX-100;
// 2/10 chance of (prehaps) making some wild stuff on one of the curves
if(rand() < RAND_MAX/10)
n1 = rand()*400/RAND_MAX-200;
else if(rand() < RAND_MAX/10)
n2 = rand()*400/RAND_MAX-200;
POINT points1[4] = {
rect.right,0,
(rect.right-rect.left)/2+n1,(rect.bottom-rect.top)/2,
(rect.right-rect.left)/2,(rect.bottom-rect.top)/2-n1,
0,rect.bottom
};
POINT points2[4] = {
0,0,
(rect.right-rect.left)/2-n2,(rect.bottom-rect.top)/2,
(rect.right-rect.left)/2,(rect.bottom-rect.top)/2-n2,
rect.right,rect.bottom
};
POINT opoints1[4] = {
rect.right,0,
(rect.right-rect.left)/2+on1,(rect.bottom-rect.top)/2,
(rect.right-rect.left)/2,(rect.bottom-rect.top)/2-on1,
0,rect.bottom
};
POINT opoints2[4] = {
0,0,
(rect.right-rect.left)/2-on2,(rect.bottom-rect.top)/2,
(rect.right-rect.left)/2,(rect.bottom-rect.top)/2-on2,
rect.right,rect.bottom
};
POINT oopoints1[4] = {
rect.right,0,
(rect.right-rect.left)/2+oon1,(rect.bottom-rect.top)/2,
(rect.right-rect.left)/2,(rect.bottom-rect.top)/2-oon1,
0,rect.bottom
};
POINT oopoints2[4] = {
0,0,
(rect.right-rect.left)/2-oon2,(rect.bottom-rect.top)/2,
(rect.right-rect.left)/2,(rect.bottom-rect.top)/2-oon2,
rect.right,rect.bottom
};
CPen wpen(PS_SOLID,1,RGB(150,220,255));
CPen pen(PS_SOLID,2,RGB(50,100,255));
CPen open(PS_SOLID,1,RGB(50,100,255));
CPen oopen(PS_SOLID,1,RGB(0,30,150));
CPen *pOldPen = pDC->SelectObject(&oopen);
pDC->PolyBezier(oopoints1,4);
pDC->PolyBezier(oopoints2,4);
pDC->SelectObject(&open);
pDC->PolyBezier(opoints1,4);
pDC->PolyBezier(opoints2,4);
pDC->SelectObject(&pen);
pDC->PolyBezier(points1,4);
pDC->PolyBezier(points2,4);
pDC->SelectObject(&wpen);
pDC->PolyBezier(points1,4);
pDC->PolyBezier(points2,4);
pDC->SelectObject(pOldPen);
oon1 = on1;
oon2 = on2;
on1 = n1;
on2 = n2;
}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -