本文整理汇总了C++中CEdit::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ CEdit::Create方法的具体用法?C++ CEdit::Create怎么用?C++ CEdit::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEdit
的用法示例。
在下文中一共展示了CEdit::Create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnOpen
void CDrawText::OnOpen(CDrawView* pView)
{
ASSERT_VALID(this);
// get rect in device coord.
CClientDC dc(pView);
pView->OnPrepareDC(&dc,NULL);
CRect rect(m_position);
dc.LPtoDP(rect);
rect.NormalizeRect();
// create device font
LOGFONT lf = m_lf;
lf.lfHeight = MulDiv(lf.lfHeight,GetDeviceCaps(dc.m_hDC, LOGPIXELSY),100); //====
lf.lfWidth = 0;
pView->m_peditfont = new CFont;
pView->m_peditfont->CreateFontIndirect(&lf); // create font
pView->m_peditbrush = new CBrush;
pView->m_peditbrush->CreateSolidBrush(m_pDocument->GetPaperColor());
// create edit window to edit text
CEdit *pEdit = new CEdit;
pView->m_pedit=pEdit;
pView->m_ptext=this;
pEdit->Create(WS_CHILD|WS_VISIBLE|WS_BORDER|ES_MULTILINE|
AlignTable[m_align].editstyle, rect, pView, 1);
pEdit->SetFont(pView->m_peditfont);
pEdit->SetWindowText(m_text);
pEdit->SetFocus();
m_pDocument->SetModifiedFlag();
// load open-state accelerator
pView->ReplaceAccelTable(IDR_SEPEDTTYPE_CNTR_IP);
}
示例2: PyCEdit_create_window
// @pymethod |PyCEdit|CreateWindow|Creates the window for a new Edit object.
static PyObject *
PyCEdit_create_window(PyObject *self, PyObject *args)
{
int style, id;
PyObject *obParent;
RECT rect;
if (!PyArg_ParseTuple(args, "i(iiii)Oi:CreateWindow",
&style, // @pyparm int|style||The style for the Edit. Use any of the win32con.BS_* constants.
&rect.left,&rect.top,&rect.right,&rect.bottom,
// @pyparm (left, top, right, bottom)|rect||The size and position of the Edit.
&obParent, // @pyparm <o PyCWnd>|parent||The parent window of the Edit. Usually a <o PyCDialog>.
&id )) // @pyparm int|id||The Edits control ID.
return NULL;
if (!ui_base_class::is_uiobject(obParent, &PyCWnd::type))
RETURN_TYPE_ERR("parent argument must be a window object");
CWnd *pParent = GetWndPtr( obParent );
if (pParent==NULL)
return NULL;
CEdit *pEdit = GetEditCtrl(self);
if (!pEdit)
return NULL;
BOOL ok;
GUI_BGN_SAVE;
ok = pEdit->Create(style, rect, pParent, id );
GUI_END_SAVE;
if (!ok)
RETURN_ERR("CEdit::Create");
RETURN_NONE;
}
示例3: GetDlgItem
LRESULT
CDeviceAddWriteKeyDlg::OnInitDialog(HWND hwndFocus, LPARAM lParam)
{
CWindow wndDeviceName = GetDlgItem(IDC_DEVICE_NAME);
CWindow wndDeviceId = GetDlgItem(IDC_DEVICE_ID);
CEdit wndWriteKey = GetDlgItem(IDC_DEVICE_WRITE_KEY);
TCHAR chPassword = _T('*');
// Temporary edit control to get an effective password character
{
CEdit wndPassword;
wndPassword.Create(m_hWnd, NULL, NULL, WS_CHILD | ES_PASSWORD);
chPassword = wndPassword.GetPasswordChar();
wndPassword.DestroyWindow();
}
CString strFmtDeviceId;
pDelimitedDeviceIdString(strFmtDeviceId, m_strDeviceId, chPassword);
wndDeviceName.SetWindowText(m_strDeviceName);
wndDeviceId.SetWindowText(strFmtDeviceId);
wndWriteKey.SetLimitText(NDAS_DEVICE_WRITE_KEY_LEN);
m_butOK.Attach(GetDlgItem(IDOK));
m_butOK.EnableWindow(FALSE);
return TRUE;
}
示例4: AllocMemory
/*!
@brief 領域を確保します。
@param [in] nSize サイズ
@param [in] nUnit 単位
*/
long long CMemLeakUserObjDlg::AllocMemory(long long nSize, int nUnit)
{
// 単位分計算
long long nReqAllocSize = nSize * (long long) max(pow(1024.0, (double) nUnit), 1);
long long nResultAllocSize = 0;
CRect rect;
try {
for (int nIndex = 0; nIndex < nReqAllocSize; nIndex++) {
CEdit *pWnd = new CEdit();
pWnd->Create(0, rect, this, (UINT) IDC_STATIC);
m_aryMemLeak.Add(pWnd);
nResultAllocSize++;
}
}
catch(CException *pE)
{
TCHAR* pszErrorMsg = new TCHAR[1024];
pE->GetErrorMessage(pszErrorMsg, 1024);
MEMORYSTATUS stat;
::GlobalMemoryStatus (&stat);
CString strErrorMessage;
strErrorMessage.Format(_T("%s"), pszErrorMsg);
AfxMessageBox(strErrorMessage, MB_TASKMODAL);
pE->Delete();
}
return nResultAllocSize;
}
示例5: CreateEdit
//------------------------------------------------------------------------
//! Create a CEdit as cell value editor
//!
//! @param owner The list control starting a cell edit
//! @param nRow The index of the row
//! @param nCol The index of the column
//! @param rect The rectangle where the inplace cell value editor should be placed
//! @return Pointer to the cell editor to use
//------------------------------------------------------------------------
CEdit* CGridColumnTraitEdit::CreateEdit(CGridListCtrlEx& owner, int nRow, int nCol, const CRect& rect)
{
// Get the text-style of the cell to edit
DWORD dwStyle = m_EditStyle;
HDITEM hd = {0};
hd.mask = HDI_FORMAT;
VERIFY( owner.GetHeaderCtrl()->GetItem(nCol, &hd) );
if (hd.fmt & HDF_CENTER)
dwStyle |= ES_CENTER;
else if (hd.fmt & HDF_RIGHT)
dwStyle |= ES_RIGHT;
else
dwStyle |= ES_LEFT;
CEdit* pEdit = new CGridEditorText(nRow, nCol);
VERIFY( pEdit->Create( WS_CHILD | dwStyle, rect, &owner, 0) );
// Configure font
pEdit->SetFont(owner.GetCellFont());
// First item (Label) doesn't have a margin (Subitems does)
if (nCol==0)
pEdit->SetMargins(0, 0);
else
pEdit->SetMargins(4, 0);
return pEdit;
}
示例6: CreateSpeedBundle
void CdynControlDlg::CreateSpeedBundle(cJSON *json, int x, int y, int w, int h)
{
int idx = cJSON_GetObjectItem(json, "id")->valueint;
int speed = cJSON_GetObjectItem(json, "speed")->valueint;
int ptx = x;
int width = w - SPEEDBTN_WIDTH - LOCKBTN_WIDTH;
CString str;
CEdit *edit = new CEdit();
edit->Create(WS_CHILD | WS_VISIBLE | BS_TOP,
CRect(ptx, y, ptx + width, y + h),
this,
SPEED_ID_OFFSET + idx);
str.Format(_T("%d"), speed);
edit->SetWindowText(str);
ptx += width;
width = SPEEDBTN_WIDTH;
CButton *btn = new CButton();
btn->Create(_T("set"), WS_CHILD | WS_VISIBLE | BS_TOP,
CRect(ptx, y, ptx + width, y + h),
this,
SPEEDBTN_ID_OFFSET + idx);
ptx += width;
width = LOCKBTN_WIDTH;
btn = new CButton();
btn->Create(_T("lock"), WS_CHILD | WS_VISIBLE | BS_TOP,
CRect(ptx, y, ptx + width, y + h),
this,
LOCKBTN_ID_OFFSET + idx);
}
示例7: InitLogViewer
void MainWindow::InitLogViewer(CEdit &logViewer)
{
logViewer.Create(m_splitter, rcDefault, NULL,
WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_WANTRETURN | ES_MULTILINE | ES_AUTOVSCROLL,
WS_EX_CLIENTEDGE);
logViewer.SetFont(m_logViewerFont);
logViewer.SetLimitText(-1);
}
示例8: EditSubLabel
// EditSubLabel - Start edit of a sub item label
// Returns - Temporary pointer to the new edit control
// nItem - The row index of the item to edit
// nCol - The column of the sub item.
CEdit* CVarListCtrl::EditSubLabel( int nItem, int nCol )
{
// The returned pointer should not be saved
// Make sure that the item is visible
//if( !EnsureVisible( nItem, TRUE ) ) return NULL;
// Make sure that nCol is valid
CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
int nColumnCount = pHeader->GetItemCount();
if( nCol >= nColumnCount || GetColumnWidth(nCol) < 5 )
return NULL;
// Get the column offset
int offset = 0;
for( int i = 0; i < nCol; i++ )
offset += GetColumnWidth( i );
CRect rect;
GetItemRect( nItem, &rect, LVIR_BOUNDS );
// Now scroll if we need to expose the column
CRect rcClient;
GetClientRect( &rcClient );
if( offset + rect.left < 0 || offset + rect.left > rcClient.right )
{
CSize size;
size.cx = offset + rect.left;
size.cy = 0;
Scroll( size );
rect.left -= size.cx;
}
// Get Column alignment
LV_COLUMN lvcol;
lvcol.mask = LVCF_FMT;
GetColumn( nCol, &lvcol );
DWORD dwStyle ;
if((lvcol.fmt&LVCFMT_JUSTIFYMASK) == LVCFMT_LEFT)
dwStyle = ES_LEFT;
else if((lvcol.fmt&LVCFMT_JUSTIFYMASK) == LVCFMT_RIGHT)
dwStyle = ES_RIGHT;
else dwStyle = ES_CENTER;
rect.left += offset+4;
rect.right = rect.left + GetColumnWidth( nCol ) - 3 ;
if( rect.right > rcClient.right) rect.right = rcClient.right;
dwStyle |= WS_BORDER|WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL;
CEdit *pEdit = new CVarListEdit(nItem, nCol, GetItemText( nItem, nCol ));
pEdit->Create( dwStyle, rect, this, 2020 );
return pEdit;
}
示例9: CPopupEdit
CEdit *CClickList::ShowInPlaceMemory(int Row, int Col)
{
CEdit *pMemoryEdit = new CPopupEdit(Row, Col, GetItemText(Row, Col));
ASSERT_VALID(pMemoryEdit);
pMemoryEdit->Create(WS_BORDER | WS_CHILD | WS_VISIBLE, GetInPlaceRect(Row, Col),
this, IDL_INPLACE_MEMORY);
pMemoryEdit->SetFocus();
return pMemoryEdit;
}
示例10: ShowInPlaceFloatEdit
CEdit* CPlayerListCtrl::ShowInPlaceFloatEdit(int nItem, int nCol)
{
CRect rect;
if (!PrepareInPlaceControl(nItem, nCol, rect)) {
return nullptr;
}
DWORD dwStyle = /*WS_BORDER|*/WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | ES_RIGHT;
CEdit* pFloatEdit = DEBUG_NEW CInPlaceFloatEdit(nItem, nCol, GetItemText(nItem, nCol));
pFloatEdit->Create(dwStyle, rect, this, IDC_EDIT1);
m_fInPlaceDirty = false;
return pFloatEdit;
}
示例11:
LRESULT
CNBTreeListView::OnCreate(LPCREATESTRUCT lpcs)
{
//
// Cache the password character
//
CEdit wnd;
HWND hWnd = wnd.Create(m_hWnd, NULL, NULL, ES_PASSWORD);
ATLASSERT(NULL != hWnd);
m_chHidden = wnd.GetPasswordChar();
BOOL fSuccess = wnd.DestroyWindow();
ATLASSERT(fSuccess);
// To call WM_CREATE message handler for CTreeListViewImpl
SetMsgHandled(FALSE);
return TRUE;
}
示例12: CreateInPlaceEdit
//******************************************************************************
CWnd* CPasswordItem::CreateInPlaceEdit (CRect rectEdit, BOOL& bDefaultFormat)
{
CEdit* pWndEdit = new CEdit;
DWORD dwStyle = WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL | ES_PASSWORD;
if (!m_bEnabled || !m_bAllowEdit)
{
dwStyle |= ES_READONLY;
}
pWndEdit->Create (dwStyle, rectEdit, GetOwnerList(), BCGPROPLIST_ID_INPLACE);
pWndEdit->SetPasswordChar (cPassword);
bDefaultFormat = TRUE;
return pWndEdit;
}
示例13: CreatePositionBundle
void CdynControlDlg::CreatePositionBundle(cJSON *json, int x, int y, int w, int h)
{
int idx = cJSON_GetObjectItem(json, "id")->valueint;
ids.push_back(idx);
CString str;
char *name = cJSON_GetObjectItem(json, "name")->valuestring;
int min = cJSON_GetObjectItem(json, "min")->valueint;
int max = cJSON_GetObjectItem(json, "max")->valueint;
str.Format(_T("0x%x: %s\n [%d, %d]"), idx, charTotchar(name), min, max);
CButton *checkBox = new CButton();
checkBox->Create(str,
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE,
CRect(x, y, x + CHECK_WIDTH, y + h),
this,
CHECK_ID_OFFSET + idx);
checkBox->SetCheck(BST_CHECKED);
CSliderCtrl *slider = new CSliderCtrl();
int width = w - (CHECK_WIDTH + VIEW_WIDTH);
int ptx = x + CHECK_WIDTH;
slider->Create(WS_CHILD | WS_VISIBLE | BS_TOP,
CRect(ptx, y, ptx + width, y + h),
this,
SLIDER_ID_OFFSET + idx);
slider->SetRange(min, max);
slider->SetTicFreq(1);
int initPos = cJSON_GetObjectItem(json, "init")->valueint;
slider->SetPos(initPos);
CEdit *edit = new CEdit();
ptx += width;
width = VIEW_WIDTH;
edit->Create(WS_CHILD | WS_VISIBLE | BS_TOP,
CRect(ptx, y, ptx + width, y + 30),
this,
VIEW_ID_OFFSET + idx);
str.Format(_T("%d"), initPos);
edit->SetWindowText(str);
}
示例14: CreatePropertyEdit
HRESULT CPropertyEditWindow::CreatePropertyEdit(DWORD dwPropertyInfoIndex, CAtlStringW strInitialText, RECT& rectLabel, bool fReadOnly)
{
HRESULT hr = S_OK;
CEdit* pEdit = new CEdit();
CHECK_ALLOC( pEdit );
DWORD dwStyle = WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL;
if(fReadOnly)
{
dwStyle |= ES_READONLY;
}
pEdit->Create(m_hWnd, &rectLabel, strInitialText, dwStyle);
pEdit->SetFont(m_hLabelFont);
m_arrPropertyInfoDisplay[dwPropertyInfoIndex]->m_arrEdits.Add(pEdit);
Cleanup:
return hr;
}
示例15: CreateCtrl
void CModifyDlg::CreateCtrl()
{
CRect rcClient;
GetClientRect(&rcClient);
int top = rcClient.top + TOPINCREMENT;
int Left = rcClient.left + LEFTINCREMENT;
CRect CTRRECT;
if (PUBLIC == m_tableType || INCODE == m_tableType){
for (int i = 0;i < m_vHead.size();i++){
CStatic *Static = new CStatic;
CTRRECT = SetCtrlPos(Left,top,88,CTRLHEIGHT);
Static->Create(m_vHead[i],WS_CHILD|WS_VISIBLE,CTRRECT,this);
Static->SetFont(GetFont());
Left += 88 + HINCREMENT;
CEdit *Edit = new CEdit;
CTRRECT = SetCtrlPos(Left,top - 3,380,EDITHEIGHT);
Edit->Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER|ES_MULTILINE|ES_AUTOVSCROLL,CTRRECT,this,IDC_MODIFY_EDIT);
Edit->SetFont(GetFont());
Edit->SetWindowText(m_vData[i]);
top += VINCREMENT + CTRLHEIGHT ;
Left = rcClient.left + LEFTINCREMENT;
if (i == 0){
Static->EnableWindow(FALSE);
Edit->EnableWindow(FALSE);
}
if (i == m_vHead.size()-1 && INCODE == m_tableType)
{
CStatic *Static1 = new CStatic;
CTRRECT = SetCtrlPos(Left,top,450,CTRLHEIGHT);
Static1->Create("调度规则 1:最大空闲时间调度 2:最短会话时间调度 3:最高优先级调度",WS_CHILD|WS_VISIBLE,CTRRECT,this);
Static1->SetFont(GetFont());
m_StaticObject.push_back(Static1);
}
m_StaticObject.push_back(Static);
m_EidtObject.push_back(Edit);
}
}
if (TP == m_tableType) SetTPRuleCtrl();
}