CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2001
    Location
    Mumbai,India
    Posts
    159

    HyperLink in Dialog Box

    Hi,
    I want to provide a hyperlink on a dialog box in my application. Is there any ActiveX control for that ? Or How else could I provide a functionality similiar to a Hyperlink on a dialog Box. Please suggest a solution.
    Regards,
    Nitin
    Nitin S. Jadhav

  2. #2
    Join Date
    May 2002
    Posts
    5

    Cool

    There are sevrel HyperLink controls here at CodeGuru, look in the controls page and you will find all that you need.

  3. #3
    Join Date
    May 2002
    Location
    Poland
    Posts
    48
    I use an owner-drawn button and the following code:

    Code:
    void CAboutDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) 
    {
    	if (nIDCtl==IDC_LINK)
    	{
    		CString strURL;
    		GetDlgItem(IDC_LINK)->GetWindowText(strURL);
    
    		COLORREF cr = lpDrawItemStruct->itemState & ODS_SELECTED
    			? RGB(255,0,0) : RGB(0,0,255);
    		CRect rcItem = lpDrawItemStruct->rcItem;
    		rcItem.top += 2;
    
    		CDC dc;
    		dc.Attach(lpDrawItemStruct->hDC);
    
    		CPen pen(PS_SOLID, 1, cr);
    		CPen* pOld = dc.SelectObject(&pen);
    		dc.SetTextColor(cr);
    
    		dc.DrawText(strURL, &rcItem, DT_CALCRECT | DT_SINGLELINE);
    		dc.DrawText(strURL, &rcItem, DT_SINGLELINE);
    		dc.MoveTo(rcItem.left, rcItem.bottom);
    		dc.LineTo(rcItem.right, rcItem.bottom);
    
    		dc.SelectObject(pOld);
    		dc.Detach();
    	}
    }
    
    BOOL CAboutDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
    {
    	if (pWnd->GetDlgCtrlID()==IDC_LINK)
    	{
    		if (HCURSOR hCurs = LoadCursor(NULL, MAKEINTRESOURCE(32649)))
    		{
    			SetCursor(hCurs);
    			return TRUE;
    		}
    	}
    	return CDialog::OnSetCursor(pWnd, nHitTest, message);
    }
    regards,
    MiMec

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured