CDoubleButton::CDoubleButton(CWnd *pParentWnd, int nLeft, int nTop, int nWidth, int nHeight, LPCSTR lpString1, LPCSTR lpString2) { m_nLeft = nLeft; m_nTop = nTop; m_nRight = nLeft + nWidth; m_nBottom = nTop + nHeight; CRect rectStatic1(m_nLeft, m_nTop, m_nLeft + nWidth/4, m_nTop + 18); m_ctrlStringBefore.Create(lpString1, WS_CHILD | WS_VISIBLE, rectStatic1, pParentWnd); CRect rectEdit(m_nLeft + nWidth/4, m_nTop - 2, m_nLeft + 3*nWidth/4, m_nTop + 22); m_ctrlEdit.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER | ES_RIGHT | ES_NUMBER, rectEdit, pParentWnd, 1001); CRect rectStatic2(m_nLeft + 3*nWidth/4 + 5, m_nTop, m_nLeft + nWidth, m_nTop + 18); m_ctrlStringAfter.Create(lpString2, WS_CHILD | WS_VISIBLE, rectStatic2, pParentWnd); }
void CLineNumberEdit::Prepare() /* ============================================================ Function : CLineNumberEdit::Prepare Description : Setting the edit rect for the control and either create or move the line number control. Also sets the top- and bottom line numbers. Return : void Parameters : none Usage : Must be called to (re)establish the edit rect, must also be called as soon as the control changes size. ============================================================*/ { // Calc sizes int width = CalcLineNumberWidth(); CRect rect; GetClientRect( &rect ); CRect rectEdit( rect ); rect.right = width; rectEdit.left = rect.right + 1; // Setting the edit rect and // creating or moving child control SetRect( &rectEdit ); if( m_line.m_hWnd ) m_line.MoveWindow( 0, 0, width, rect.Height() ); else m_line.Create(NULL,WS_CHILD | WS_VISIBLE | SS_NOTIFY, rect, this, 1 ); GetRect( &rectEdit ); // Update line number control data m_line.SetTopMargin( rectEdit.top ); UpdateTopAndBottom(); }
void CLineNumberEdit::Prepare() { // Calc sizes int width = CalcLineNumberWidth(); CRect rect; GetClientRect( &rect ); CRect rectEdit( rect ); rect.right = width; rectEdit.left = rect.right + 3; // Setting the edit rect and // creating or moving child control SetRect( &rectEdit ); if( m_line.m_hWnd ) m_line.MoveWindow( 0, 0, width, rect.Height() ); else m_line.Create(NULL,WS_CHILD | WS_VISIBLE | SS_NOTIFY, rect, this, 1 ); GetRect( &rectEdit ); // Update line number control data m_line.SetTopMargin( rectEdit.top ); UpdateTopAndBottom(); }