CEditEx and CStaticEx - Classes that extend the functionality of the CEdit and CStatic

Both CEditEx and CStaticEx allow for easy customization of text, background, and font attributes.

Using these classes:
See example code provided.


    1. COLORREF bkColor( COLORREF crColor )        COLORREF bkColor() const     2. COLORREF textColor( COLORREF crColor )        COLORREF textColor() const     3. (CEdit Only) void setCustomMask( CEditMask* editMask = 0 /* null == default */ ) - note I have tried using this feature yet.     4. (CEdit Only) void definePopupMenu( UINT uResourceID = 0 /* null == default */ ) - Overide default context menu with new menu resource.     5. void setFont( const LOGFONT* lpLogFont ); - NOTE: See CLogFont included in the CEditEx headers and CStaticEx headers        void setFont( LONG fontHeight = -8,                      LONG fontWeight = FW_NORMAL,                      UCHAR pitchAndFamily = DEFAULT_PITCH | FF_DONTCARE,                      LPCSTR faceName = _T("MS Sans Serif" );
    6. (CStaticEx Only) The following idea came from Paul DiLascia in the December 1997 issue of MSJ.         void onClickDoShellCommand( const CString& linkName ) - Use control as a link to open a link or exe         COLORREF setLinkColorVisited( COLORREF crColor ) - Sets the visit color, returns previous setting         COLORREF setLinkColorUnvisited( COLORREF crColor ) - Sets the unvisited color, returns previous setting         BOOL doCustomCursor( bool custom = true ) - show a custom cursor over the control

Download source code and demo project - 23 KB


  • visual C++ or visual nightmare

    Posted by Legacy on 07/21/2002 12:00am

    Originally posted by: Khalid

    Hello to all...
    I'm very new to Visual C++ but i'm not new to programming. I must say that I find Visual C++ by MS extremely complicated and unneededly confusing. If someone can help me, please give me the steps needed to write a small mfc program that will on a click of a button display a ListBox with the ability to add/delete strings to/from it. I've seen source code but will have to admint that it is a mystery as to be able to recreate the steps.

  • ExEditors Library

    Posted by Legacy on 03/19/2002 12:00am

    Originally posted by: Mike Philips

    A complete collection of editors in a single file:



  • Dynamic create CStaticEx

    Posted by Legacy on 09/15/2000 12:00am

    Originally posted by: Smirnov

    Hi, after analyse this example I try do CMyStatic : public : CStatic. After dynamic create this varibale, on debug work breakpoint in WindowProc (...), but dont work breakpoint in OnLButtonDown(...).
    In downloaded project on debug all breakpoints work.
    May be some different in style ? My first argoment Create:
    Who know why I can not cath breakpoint in CMyStatic::OnLButtonDown?


  • Using with a CFormView

    Posted by Legacy on 10/05/1999 12:00am

    Originally posted by: Matt Rutledge

    This works great with a CDialog but I need to use it with a CFormView class with several edit controls, I keep getting Assertion failures on _ASSERT(::IsWindow(m_hWnd)); becuase CFormView is not using CWnd* pParent;
    What do I need to change to get this to work?


  • Font weight always FW_NORMAL?

    Posted by Legacy on 08/27/1999 12:00am

    Originally posted by: Donald Thomas

    I noticed in your code that in the setFont methos where you can pass the font height and font weight that you don't use the font weight passed in. You always use FW_NORMAL. Why? Can you really not change the font weight with this method?

  • Color does not change if control is disabled !

    Posted by Legacy on 07/19/1999 12:00am

    Originally posted by: Mango

    The color of the text in the CEditEx control does not change
    if the control is disabled, although the font size and the background seems to be correctly updated ?

    Can this situation be taken care of too ?

    Otherwise its great work..

  • "Courier New" and right aligned

    Posted by Legacy on 06/01/1999 12:00am

    Originally posted by: Marcus

    If you use the font "Courier New" and set the alignment of the edit control to "right", then the control acts strange:
    The cursor acts left aligned and the text appears right aligned. With other fonts like "Times New Roman" or "Arial" or "MS Sans Serif" this does not happen. (BTW - I used lfPitchAndFamily = FIXED_PITCH for "Courier New")
    Any hints why this happens??

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As the mobile enterprise marketplace expands and customer needs grow more diverse, Samsung recognizes that solution partners and developers play an essential role by continually innovating to meet their customers' needs. Samsung works to provide these developers and partners with the latest tools and resources needed to create these solutions. Read this program guide to learn how the Samsung Enterprise Alliance Program provides partners and developers with Samsung enterprise software development kits (SDKs) …

  • Moving from an on-premises environment to Office 365 does not remove the need to plan for disruptions or reduce the business risk requirements for protecting email services. If anything, some risks increase with a move to the cloud. Read how to ease the transition every business faces if considering or already migrating to cloud email. This white paper discusses: Setting expectations when migrating to Office 365 Understanding the implications of relying solely on Exchange Online security Necessary archiving …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date