#if! defined (afX_EDITEX_H__4B42F103_8BDD_4F39_ABE3_0D96741FAEB3__INCLUDED _) # define afX_EDITEX_H__4B42F103_8BDD_4F39_ABE3_0D96741FAEB3__included_
#iF _MSC_VER> 1000 # pragma overce # endif //_msc_ver> 1000 // Editex.h: Header file //
/// CEDITEX WINDOW
Class CEDITEX: PUBLIC CEDIT {// Constructionpublic: CEDITEX ();
// attributespublic:
// OperationsPublic:
// Overrides // ClassWizard Generated Virtual Function Overrides // {AFX_VIRTUAL (CEDITEX) PUBLIC: Virtual Bool PretranslateMessage (MSG * PMSG); //}} AFX_VIRTUAL
// ImplementationPublic: Virtual ~ CEDITEX ();
// Generated message map functionsprotected: // {{AFX_MSG (CEditEx) afx_msg HBRUSH OnCtlColor (CDC * pDC, CWnd * pWnd, UINT nCtlColor); afx_msg BOOL OnEraseBkgnd (CDC * pDC); afx_msg void OnRButtonDown (UINT nFlags, CPoint point) ; //}} AFX_MSG
DECLARE_MESSAGE_MAP ()};
/
// {{AFX_INSERT_LOCATION}} // Microsoft Visual C Will Insert Additional Declarations Immediately Before The Previous Line.
#ndif //! defined (AFX_EDITEX_H__4B42F103_8BDD_4F39_ABE3_0D96741FAEB3__INCLUDED _) // EditEx.cpp: importation file //
#include "stdafx.h" #include "editex.h"
#ifdef _debug # define new debug_new # undef this_filestatic char this_file [] = __file __; # ENDIF
/// CEDITEX
CEDITEX :: CEDITEX () {}
CEDITEX :: ~ CEDITEX () {}
Begin_MESSAGE_MAP (CEDITEX, CEDIT) / / {{AFX_MSG_MAP (CEDITEX) ON_WM_CTLCOLOR () ON_WM_ERASEBKGND () ON_WM_RBUTTONDOWN () //}} AFX_MSG_MAPEND_MESSAGE_MAP ()
/// CEDITEX MESSAGE HANDLERS
BOOL CEditEx :: PreTranslateMessage (MSG * pMsg) {// TODO: Add your specialized code here and / or call the base class if (pMsg-> message == WM_KEYDOWN) {if (ES_READONLY == (ES_READONLY & GetStyle ()) ) return TRUE;} return CEdit :: PreTranslateMessage (pMsg);} void CEditEx :: OnRButtonDown (UINT nFlags, CPoint point) {// TODO: Add your message handler code here and / or call default if (ES_READONLY == (ES_READONLY & GetStyle ())) Return; Cedit :: OnRButtondown (NFLAGS, POINT);
BOOL CEditEx :: OnEraseBkgnd (CDC * pDC) {// TODO: Add your message handler code here and / or call default CBrush brush; brush.CreateSolidBrush (RGB (255, 255, 255)); CRect rc; GetClientRect (& rc) PDC-> FillRect (RC, & Brush); brush.deleteObject (); return true; // return Cedit :: OneRaseBkGnd (PDC);
// - this is onlineX :: ONCTLCOLOR (CDC * PDC, CWND * PWND, UINT NCTLCOLOR) {Hbrush Hbr = CEDIT: ONCTLCOLOR (PDC, PWND, NCTLCOLOR); // Todo: Change Any Attributes Of the dc here // - Copy this code to pient :: oncTlcolor (...) / * {CWND * PCTRL = this; // - this ctrl (not this) IF (pwnd-> getsafehwnd () == PCTRL-> GetSafehWnd ()) {PDC-> setbkcolor (RGB (255, 255, 255));}} * / // Todo: Return a Different Brush if the default is not desired return hbr;} // Parent window /// - 1. Bind a variable CEDITEX M_CTEDITEX; / / - 2 for the control. It is also a need to add to the parent window OnCtlColor WM_CTLCOLORHBRUSH parent :: OnCtlColor (CDC * pDC, CWnd * pWnd, UINT nCtlColor) {HBRUSH hbr = CDialog :: OnCtlColor (pDC, pWnd, nCtlColor); // TODO: Change any attributes of The DC Here if (pwnd-> getsafehwnd () == m_cteditex.getsafehwnd ()) {PDC-> setbkcolor (RGB (255, 255, 255));} // Todo: Return A Different Brush if The Default is not desired Return Hbr;