• 大小: 5.09MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-15
  • 语言: C/C++
  • 标签: CEdit  keyboard  MFC  

资源简介

mfc按CEdit编辑框弹出自定义键盘

资源截图

代码片段和文件信息

// MyButton.cpp : implementation file
//

#include “stdafx.h“
#include “TestBitmap.h“
#include “MyButton.h“

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

/////////////////////////////////////////////////////////////////////////////
// CMyButton

CMyButton::CMyButton()
{
}

CMyButton::~CMyButton()
{
}


BEGIN_MESSAGE_MAP(CMyButton CButton)
//{{AFX_MSG_MAP(CMyButton)
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyButton message handlers

void CMyButton::OnLButtonUp(UINT nFlags CPoint point) 
{
// TODO: Add your message handler code here and/or call default
HWND hwnd=::GetFocus();
int iID=::GetDlgCtrlID(hwnd);

CWnd *pwnd =GetParent()->GetParent();
CMyKeyBoard *pmyKeyBoard = (CMyKeyBoard*)GetParent();
CEdit *pEdit = pmyKeyBoard->pEdit;
if(pEdit == NULL)
{
return;
}

CString strButton = ““;
CString strEdit = ““;
this->GetWindowText(strButton);
pEdit->GetWindowText(strEdit);
switch(iID)
{
case IDC_BUTTON_NUM0:
case IDC_BUTTON_NUM1:
case IDC_BUTTON_NUM2:
case IDC_BUTTON_NUM3:
case IDC_BUTTON_NUM4:
case IDC_BUTTON_NUM5:
case IDC_BUTTON_NUM6:
case IDC_BUTTON_NUM7:
case IDC_BUTTON_NUM8:
case IDC_BUTTON_NUM9:
pEdit->SetWindowText(strEdit+strButton);
break;
case IDC_BUTTON_DOT:
if(strEdit == ““)
{
break;
}
else if(strEdit.Find(‘.‘) != -1)
{
break;
}
pEdit->SetWindowText(strEdit+“.“);
break;
case IDC_BUTTON_ENTER:
pmyKeyBoard->Close();
break;
case IDC_BUTTON_SIG:
if(strEdit == ““)
{
strEdit = ‘-‘;
}
else if(strEdit.GetAt(0) == ‘-‘)
{
strEdit = strEdit.Mid(1 strEdit.GetLength() - 1);
}
else
{
strEdit = “-“ + strEdit;
}
pEdit->SetWindowText(strEdit);
break;
case IDC_BUTTON_CLEAR:
pEdit->SetWindowText(““);
break;
case IDC_BUTTON_DEL:
strEdit = strEdit.Mid(0 strEdit.GetLength() - 1);
pEdit->SetWindowText(strEdit);
break;
}

CButton::OnLButtonUp(nFlags point);
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2572  2014-04-01 16:51  TestBitmap_keyboard\TestBitmap\Compute.h

     文件      15926  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\MyButton.obj

     文件          0  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\MyButton.sbr

     文件      16255  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\MyEdit.obj

     文件          0  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\MyEdit.sbr

     文件      21185  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\MyKeyBoard.obj

     文件          0  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\MyKeyBoard.sbr

     文件     106078  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\StdAfx.obj

     文件    1377582  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\StdAfx.sbr

     文件    3146752  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\TestBitmap.bsc

     文件     172128  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\TestBitmap.exe

     文件     241916  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\TestBitmap.ilk

     文件      14936  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\TestBitmap.obj

     文件    6888020  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\TestBitmap.pch

     文件     312320  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\TestBitmap.pdb

     文件      49684  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\TestBitmap.res

     文件          0  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\TestBitmap.sbr

     文件      34562  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\TestBitmapDlg.obj

     文件          0  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\TestBitmapDlg.sbr

     文件     214016  2014-08-25 17:08  TestBitmap_keyboard\TestBitmap\Debug\vc60.idb

     文件     364544  2014-08-25 17:07  TestBitmap_keyboard\TestBitmap\Debug\vc60.pdb

     文件        194  2014-04-01 09:34  TestBitmap_keyboard\TestBitmap\ExportFunc.h

     文件       5200  2014-04-01 17:06  TestBitmap_keyboard\TestBitmap\ExtDll.lib

     文件       2138  2014-03-31 21:43  TestBitmap_keyboard\TestBitmap\MyButton.cpp

     文件       1125  2014-03-31 14:21  TestBitmap_keyboard\TestBitmap\MyButton.h

     文件       1086  2014-08-25 17:05  TestBitmap_keyboard\TestBitmap\MyEdit.cpp

     文件       1130  2014-03-31 20:26  TestBitmap_keyboard\TestBitmap\MyEdit.h

     文件       2253  2014-04-01 14:20  TestBitmap_keyboard\TestBitmap\MyKeyBoard.cpp

     文件       1632  2014-03-31 21:26  TestBitmap_keyboard\TestBitmap\MyKeyBoard.h

     文件       2128  2014-04-01 09:38  TestBitmap_keyboard\TestBitmap\MyKeyBoard.lib

............此处省略38个文件信息

评论

共有 条评论