Edit Control with Icon and Background Text
来源:互联网 发布:破解单位网络限制 编辑:程序博客网 时间:2024/04/29 04:05
The same controls look like the following when text is entered.
代码:
#pragma once
// CSymbolEdit
class CSymbolEdit : public CEdit
{
public:
protected:
public:
};
// AeroEdit.cpp : implementation file
//
#include "stdafx.h"
#include "SymbolEdit.h"
// CSymbolEdit
IMPLEMENT_DYNAMIC(CSymbolEdit, CEdit)
CSymbolEdit::CSymbolEdit():
m_hSymbolIcon(NULL),
m_bInternalIcon(false),
m_colorPromptText(RGB(127,127,127))
{
}
CSymbolEdit::~CSymbolEdit()
{
}
BEGIN_MESSAGE_MAP(CSymbolEdit, CEdit)
END_MESSAGE_MAP()
void CSymbolEdit::DestroyIcon()
{
}
void CSymbolEdit::PreSubclassWindow()
{
}
void CSymbolEdit::SetSymbolIcon(HICON hIcon, BOOL redraw)
{
}
void CSymbolEdit::SetSymbolIcon(UINT id, BOOL redraw)
{
}
void CSymbolEdit::SetPromptText(CString text, BOOL redraw)
{
}
void CSymbolEdit::SetPromptText(LPCTSTR szText, BOOL redraw)
{
}
void CSymbolEdit::SetPromptTextColor(COLORREF color, BOOL redraw)
{
}
void CSymbolEdit::SetPromptFont(CFont& font, BOOL redraw)
{
}
void CSymbolEdit::SetPromptFont(const LOGFONT* lpLogFont, BOOL redraw)
{
}
void CSymbolEdit::RecalcLayout()
{
}
// CSymbolEdit message handlers
void CSymbolEdit::OnPaint()
{
}
void CSymbolEdit::OnSize(UINT nType, int cx, int cy)
{
}
LRESULT CSymbolEdit::OnSetFont(WPARAM wParam, LPARAM lParam)
{
}
How to Use It in Your Code
In your dialog class header, include "SymbolEdit.h".
Declare a variable of type CSymbolEdit.
CSymbolEdit m_edit;
Map it to the control in DoDataExchange:
void CEditDemoDlg::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_EDIT, m_edit);}
Set the icon, text, color, or font (in OnInitDialog, for example).
m_edit.SetSymbolIcon(IDI_SEARCH, FALSE);m_edit.SetPromptText(_T("Find "), FALSE);m_edit.SetPromptTextColor(RGB(192, 192, 192));
转自http://jianhai1229.blog.163.com/blog/static/3488700020086814315279/
- Edit Control with Icon and Background Text
- Edit Control with Icon and Background Text
- Edit Control with Icon and Background Text
- Text Edit control - Usage and Demo
- text edit control using function
- Edit Control: How to append text to an edit control?
- Progress Control with Text
- Set terminal text color and transparent background
- Changing Status pane text and icon
- Changing Status pane text and icon
- CRichEditControl50W - A VC++ Rich Text Edit 4.1 MFC Control
- MFC中设置Edit Control 和 Static Text控件学习
- Notification Bubble with Text Input Control.(MFC)
- edit control
- Edit control
- Edit Control
- edit control
- HTML syntax highlighting with the Rich Edit control
- 从0开始学习 GitHub 系列之「02.加入 GitHub」
- MyEclipse10 使用JRebl实现热部署
- 表单验证
- Android ViewPager横向多页显示效果实现
- 猎国X计划隐私政策
- Edit Control with Icon and Background Text
- 图算法-Dijkstra算法
- java引用类型的强制类型转换
- 使用OAuth打造webapi认证服务供自己的客户端使用
- QComboBox下拉列表自动填充
- 欢迎使用CSDN-markdown编辑器
- Angular 监听路由变化事件
- mysql事物处理
- JSON 驼峰转下划线