Edit

Share via


CMFCRibbonLinkCtrl Class

Implements a hyperlink that is positioned on a ribbon. The hyperlink opens a Web page when you click it. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

Syntax

class CMFCRibbonLinkCtrl : public CMFCRibbonButton

Members

Public Constructors

Name Description
CMFCRibbonLinkCtrl::CMFCRibbonLinkCtrl Constructs and initializes a CMFCRibbonLinkCtrl object.

Public Methods

Name Description
CMFCRibbonLinkCtrl::CopyFrom (Overrides CMFCRibbonButton::CopyFrom.)
CMFCRibbonLinkCtrl::GetCompactSize (Overrides CMFCRibbonButton::GetCompactSize.)
CMFCRibbonLinkCtrl::GetLink Returns the value of the hyperlink.
CMFCRibbonLinkCtrl::GetRegularSize (Overrides CMFCRibbonButton::GetRegularSize.)
CMFCRibbonLinkCtrl::GetToolTipText (Overrides CMFCRibbonButton::GetToolTipText.)
CMFCRibbonLinkCtrl::IsDrawTooltipImage (Overrides CMFCRibbonButton::IsDrawTooltipImage.)
CMFCRibbonLinkCtrl::OnDraw (Overrides CMFCRibbonButton::OnDraw.)
CMFCRibbonLinkCtrl::OnDrawMenuImage (Overrides CMFCRibbonBaseElement::OnDrawMenuImage.)
CMFCRibbonLinkCtrl::OnMouseMove (Overrides CMFCRibbonButton::OnMouseMove.)
CMFCRibbonLinkCtrl::OnSetIcon
CMFCRibbonLinkCtrl::OpenLink Opens the Web page specified in the hyperlink.
CMFCRibbonLinkCtrl::SetLink Sets the value of the hyperlink.

Remarks

After you create a hyperlink, add it to a panel by calling CMFCRibbonPanel::Add.

Inheritance Hierarchy

CObject
└ CMFCRibbonBaseElement
 └ CMFCRibbonButton
  └ CMFCRibbonLinkCtrl

Requirements

Header: afxRibbonLinkCtrl.h

CMFCRibbonLinkCtrl::CMFCRibbonLinkCtrl

Constructs and initializes a CMFCRibbonLinkCtrl object.

CMFCRibbonLinkCtrl(
    UINT nID,
    LPCTSTR lpszText,
    LPCTSTR lpszLink);

Parameters

nID
[in] Specifies the command ID of the command that executes when the link control is clicked.

lpszText
[in] Specifies the label to display on the link control.

lpszLink
[in] Specifies the hyperlink associated with the link control.

Example

The following example demonstrates how to use the constructor of the CMFCRibbonLinkCtrl class. This code snippet is part of the Ribbon Gadgets sample.

// CMFCRibbonPanel* pPanel3
pPanel3->Add(new CMFCRibbonLinkCtrl(ID_RIBBON_OBTN_2, _T("Send e-mail"), _T("mailto:info@microsoft.com")));

CMFCRibbonLinkCtrl::CopyFrom

virtual void CopyFrom(const CMFCRibbonBaseElement& src);

Parameters

[in] src

Remarks

CMFCRibbonLinkCtrl::GetCompactSize

virtual CSize GetCompactSize(CDC* pDC);

Parameters

[in] pDC

Return Value

Remarks

Returns the value of the hyperlink.

LPCTSTR GetLink() const;

Return Value

The current value of the hyperlink.

Remarks

CMFCRibbonLinkCtrl::GetRegularSize

virtual CSize GetRegularSize(CDC* pDC);

Parameters

[in] pDC

Return Value

Remarks

CMFCRibbonLinkCtrl::GetToolTipText

virtual CString GetToolTipText() const;

Return Value

Remarks

CMFCRibbonLinkCtrl::OnDrawMenuImage

virtual BOOL OnDrawMenuImage(CDC*, CRect);

Parameters

[in] CDC*
[in] CRect

Return Value

Remarks

CMFCRibbonLinkCtrl::IsDrawTooltipImage

virtual BOOL IsDrawTooltipImage() const;

Return Value

Remarks

CMFCRibbonLinkCtrl::OnDraw

virtual void OnDraw(CDC* pDC);

Parameters

[in] pDC

Remarks

CMFCRibbonLinkCtrl::OnMouseMove

virtual void OnMouseMove(CPoint point);

Parameters

[in] point

Remarks

CMFCRibbonLinkCtrl::OnSetIcon

virtual void OnSetIcon();

Remarks

Opens the Web page specified in the hyperlink.

BOOL OpenLink();

Return Value

TRUE if the associated webpage was opened successfully; otherwise, FALSE.

Remarks

Opens a webpage using the hyperlink associated with the CMFCRibbonLinkCtrl object.

Sets the value of the hyperlink.

void SetLink(LPCTSTR lpszLink);

Parameters

lpszLink
[in] Specifies the hyperlink text.

See also

Hierarchy Chart
Classes
CMFCRibbonButton Class