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

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

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

Using these classes:
See example code provided.

Attributes:

    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

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read