CMFCLinkCtrl Class
The CMFCLinkCtrl class displays a button as a hyperlink and invokes the link's target when the button is clicked.
class CMFCLinkCtrl : public CMFCButton
Members
Public Methods
Name |
Description |
---|---|
Displays a specified URL as the button text. |
|
Sets the implicit protocol (for example, "http:") of the URL. |
|
Resizes the button to contain the button text or bitmap. |
Protected Methods
Name |
Description |
---|---|
Called by the framework before the focus rectangle of the button is drawn. |
Remarks
When you click a button that is derived from the CMFCLinkCtrl class, the framework passes the URL of the button as a parameter to the ShellExecute method. Then the ShellExecute method opens the target of the URL.
Example
The following example demonstrates how to set the size of a CMFCLinkCtrl object, and how to set a url and a tooltip in a CMFCLinkCtrl object. This example is part of the NewControls Sample: MFC Controls Demonstration Application.
CMFCLinkCtrl m_btnLink;
...
m_btnLink.SetURL(_T("https://www.microsoft.com"));
m_btnLink.SetTooltip(_T("Visit Microsoft site"));
// resize the button to contain the button text or bitmap
m_btnLink.SizeToContent();
Inheritance Hierarchy
Requirements
Header: afxlinkctrl.h