C++ LinkLabel Control.
The C++ LinkLabel control is similiar to the label control, with the exception of hyperlinks. The LinkLabel control can display single or multiple hyperlinks. When the user clicks a hyperlink, the process can be started in th event.
Namespace: System::Windows::Forms
System.Windows.Forms (in system.windows.forms.dll)
Creating an new C++ Windows forms LinkLabel.
LinkLabel^ linklabel = gcnew LinkLabel;
Assigning a AutoSize Value to the LinkLabel Control.
linklabel->AutoSize = false;
Docking the C++ LinkLabel Control.
linklabel->Dock = System::Windows::Forms::DockStyle::Top;
Assigning a text value to the C++ LinkLabel control.
linklabel->Text = "Link to Web Site";
Adding a C++ LinkLabel control to the form.
Controls->Add(linklabel);
Creating a LinkClicked Event for the C++ LinkLabel control.
this->linklabel->LinkClicked += gcnew System::Windows::Forms::LinkLabelLinkClickedEventHandler(this, &Form1::linklabel_LinkClicked);
Responding to the C++ LinkLabel LinkClicked event.
private: System::Void linkLabel1_LinkClicked(System::Object^ sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^ e)
{
MessageBox::Show("Link Clicked");
}
|