📄 selwin.cpp
字号:
// SelWin.cpp : implementation file
//
#include "stdafx.h"
#include "hanzi.h"
#include "SelWin.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSelWin dialog
CSelWin::CSelWin(CWnd* pParent /*=NULL*/)
: CDialog(CSelWin::IDD, pParent)
{
//{{AFX_DATA_INIT(CSelWin)
m_hztext = _T("");
//}}AFX_DATA_INIT
}
void CSelWin::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSelWin)
DDX_Text(pDX, IDC_HZTEXT, m_hztext);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSelWin, CDialog)
//{{AFX_MSG_MAP(CSelWin)
ON_WM_LBUTTONDOWN()
ON_COMMAND(IDM_BEXIT, OnBexit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSelWin message handlers
void CSelWin::SetTextv(CString strValue)
{
if(strValue.IsEmpty())
return;
int i;
CString strOne,strTwo;
m_hztext.Empty();
m_strBak=strValue;
m_curpage=0;
for(i=0;i<20&&i<strValue.GetLength();i+=2)
{
strOne=strValue.Mid(i,2);
strTwo.Format("%d.%s ",i/2,strOne);
m_hztext+=strTwo;
}
m_chtcnts=i/2;
UpdateData(false);
}
//DEL void CSelWin::OnNcLButtonDown(UINT nHitTest, CPoint point)
//DEL {
//DEL // TODO: Add your message handler code here and/or call default
//DEL
//DEL CDialog::OnNcLButtonDown(nHitTest, point);
//DEL }
//DEL void CSelWin::OnMButtonDown(UINT nFlags, CPoint point)
//DEL {
//DEL // TODO: Add your message handler code here and/or call default
//DEL
//DEL CDialog::OnMButtonDown(nFlags, point);
//DEL }
BOOL CSelWin::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::PreTranslateMessage(pMsg);
}
LRESULT CSelWin::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::WindowProc(message, wParam, lParam);
}
void CSelWin::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
PostMessage (
WM_NCLBUTTONDOWN,
HTCAPTION , MAKELPARAM (point .x , point .y) );
}
void CSelWin::NextPage()
{
int i,sta;
sta=++m_curpage*20;
if(sta>(m_strBak.GetLength()-2))
{
m_curpage--;
return;
}
CString strOne,strTwo;
m_hztext.Empty();
for(i=0;i<20&&(sta+i)<m_strBak.GetLength();i+=2)
{
strOne=m_strBak.Mid(sta+i,2);
strTwo.Format("%d.%s ",i/2,strOne);
m_hztext+=strTwo;
}
m_chtcnts=i/2;
UpdateData(false);
}
void CSelWin::PrevPage()
{
int i,sta;
sta=--m_curpage*20;
if(sta<0)
{
m_curpage++;
return;
}
CString strOne,strTwo;
m_hztext.Empty();
for(i=0;i<20&&(sta+i)<m_strBak.GetLength();i+=2)
{
strOne=m_strBak.Mid(sta+i,2);
strTwo.Format("%d.%s ",i/2,strOne);
m_hztext+=strTwo;
}
m_chtcnts=i/2;
UpdateData(false);
}
void CSelWin::OnBexit()
{
// TODO: Add your command handler code here
ShowWindow(SW_HIDE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -