15 ON_WM_CTLCOLOR_REFLECT()
16 ON_CONTROL_REFLECT( STN_CLICKED, OnClicked )
24 CStaticLink::CStaticLink()
26 mUnvisitedColor = RGB( 0, 0, 255 );
27 mVisitedColor = RGB( 128, 0, 128 );
50 ASSERT( aCtlColor == CTLCOLOR_STATIC );
52 DWORD dwStyle = GetStyle();
53 if( !( dwStyle & SS_NOTIFY ) )
57 ::SetWindowLong( m_hWnd, GWL_STYLE, dwStyle | SS_NOTIFY ) ;
61 if( ( dwStyle & 0xFF ) <= SS_RIGHT )
68 GetFont()->GetObject(
sizeof( lf ), &lf );
69 lf.lfUnderline =
TRUE;
70 mFont.CreateFontIndirect( &lf );
74 aDC->SelectObject( &mFont );
75 aDC->SetTextColor( mIsVisited ? mVisitedColor : mUnvisitedColor );
76 aDC->SetBkMode( TRANSPARENT );
79 hbr = (HBRUSH)::GetStockObject( HOLLOW_BRUSH );
96 ShellExecute( NULL, _T(
"open"),
mLinkText, NULL, NULL, SW_SHOWNORMAL );
CString mLinkText
URL/filename for non-text controls (e.g., icon, bitmap)
afx_msg void OnClicked()
Handle mouse click; open the link.
afx_msg HBRUSH CtlColor(CDC *aDC, UINT aCtlColor)
Handle reflected WM_CTLCOLOR to set custom control color.
BOOL mIsVisited
whether visited or not
Static hyperlink control.