本文整理汇总了C#中System.Windows.Forms.LinkLabel类的典型用法代码示例。如果您正苦于以下问题:C# LinkLabel类的具体用法?C# LinkLabel怎么用?C# LinkLabel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinkLabel类属于System.Windows.Forms命名空间,在下文中一共展示了LinkLabel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartPage
public StartPage()
{
InitializeComponent();
Dock = DockStyle.Fill;
//Recent projects
Ogmo.CheckRecentProjects();
for (int i = 0; i < Properties.Settings.Default.RecentProjects.Count; i++)
{
LinkLabel link = new LinkLabel();
link.Location = new Point(4, 24 + (i * 20));
link.LinkColor = Color.Red;
link.Font = new Font(FontFamily.GenericMonospace, 10);
link.Size = new Size(172, 16);
link.Text = Properties.Settings.Default.RecentProjectNames[i];
link.Name = Properties.Settings.Default.RecentProjects[i];
link.Click += delegate(object sender, EventArgs e) { Ogmo.LoadProject(link.Name); };
recentPanel.Controls.Add(link);
}
//Twitter feed
WebClient twitter = new WebClient();
twitter.DownloadStringCompleted += new DownloadStringCompletedEventHandler(twitter_DownloadStringCompleted);
twitter.DownloadStringAsync(new Uri(@"http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=OgmoEditor"));
}
示例2: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.SuspendLayout();
//
// linkLabel1
//
this.linkLabel1.Location = new System.Drawing.Point(92, 87);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(122, 13);
this.linkLabel1.TabIndex = 0;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "DotNetBar Home Page";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// frmAbout
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(323, 217);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.linkLabel1});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmAbout";
this.ShowInTaskbar = false;
this.Text = "About DotNetBar Notepad Sample";
this.ResumeLayout(false);
}
示例3: ReportDependency
private void ReportDependency(string name, string downloadUrl)
{
if (InvokeRequired)
{
Invoke(new ReportDependencyDelegare(ReportDependency), name, downloadUrl);
}
else
{
Label label = new Label();
label.AutoSize = true;
label.Text = "Missing: " + name;
label.Location = new Point(10, lastDependencyY);
LinkLabel linkLabel = new LinkLabel();
linkLabel.AutoSize = true;
linkLabel.Text = downloadUrl;
linkLabel.Location = new Point(label.Location.X + label.Width + 10, lastDependencyY);
this.Controls.Add(label);
this.Controls.Add(linkLabel);
int maxHeight = System.Math.Max(label.Height, linkLabel.Height);
this.Height += maxHeight;
lastDependencyY += System.Math.Max(label.Height, linkLabel.Height) + 10;
}
}
示例4: rebuildItemsList
private void rebuildItemsList()
{
resultsPanel.Controls.Clear();
int x = 24;
int y = 8;
int numItems = 0;
foreach (object item in items)
{
numItems++;
LinkLabel linkLabel = new LinkLabel();
linkLabel.Location = new System.Drawing.Point(x, y);
linkLabel.Name = item.ToString();
linkLabel.Text = item.ToString();
linkLabel.Tag = item;
linkLabel.Size = new Size(224, 23);
linkLabel.FlatStyle = FlatStyle.System;
linkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.item_LinkClicked);
this.resultsPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
linkLabel.AutoSize = true;
resultsPanel.Controls.Add(linkLabel);
y += 24;
}
lblMessage.Text = numItems + " results found. Please select one";
}
示例5: AlterColor
private void AlterColor(LinkLabel link)
{
Produtolink.LinkColor = Color.Black;
Receitalink.LinkColor = Color.Black;
Despesalink.LinkColor = Color.Black;
Funcionariolink.LinkColor = Color.Black;
Clientelink.LinkColor = Color.Black;
Fornecedorlink.LinkColor = Color.Black;
if (link.Name == Produtolink.Name)
{
Produtolink.LinkColor = Color.LightSeaGreen;
}
if (link.Name == Receitalink.Name)
{
Receitalink.LinkColor = Color.LightSeaGreen;
}
if (link.Name == Despesalink.Name)
{
Despesalink.LinkColor = Color.LightSeaGreen;
}
if (link.Name == Funcionariolink.Name)
{
Funcionariolink.LinkColor = Color.LightSeaGreen;
}
if (link.Name == Clientelink.Name)
{
Clientelink.LinkColor = Color.LightSeaGreen;
}
if (link.Name == Fornecedorlink.Name)
{
Fornecedorlink.LinkColor = Color.LightSeaGreen;
}
}
示例6: TreeGridDesignerToolWindowContainer
internal TreeGridDesignerToolWindowContainer(Control mainControl)
{
// Set this control to some arbitrary size.
// Without a defined size, the anchored child controls don't anchor correctly.
Left = 0;
Top = 0;
Width = 200;
Height = 200;
// add main control hosted in the tool window
_mainControl = mainControl;
mainControl.Bounds = new Rectangle(1, 1, 198, 198);
mainControl.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
Controls.Add(mainControl);
// Label used when the tool window is irrelevant.
_watermark = new LinkLabel();
_watermark.Location = new Point(BORDER + 2, BORDER + 1);
_watermark.Size = new Size(Width - 2 * BORDER - 2, Height - 2 * BORDER - 1);
_watermark.Text = String.Empty;
_watermark.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
_watermark.TextAlign = ContentAlignment.MiddleCenter;
_watermark.ForeColor = SystemColors.GrayText;
_watermark.BackColor = SystemColors.Window;
_watermark.Visible = false;
_watermark.LinkClicked += watermarkLabel_LinkClicked;
Controls.Add(_watermark);
}
示例7: initialize
private void initialize()
{
content.AutoScroll = false;
// title
this.titleBar.Text = poi.getName();
int moreLinkHeight = 15;
// description
this.descr = new TextBox();
this.descr.AcceptsReturn = true;
this.descr.AcceptsTab = true;
this.descr.Multiline = true;
this.descr.ReadOnly = true;
this.descr.ScrollBars = ScrollBars.Vertical;
this.descr.Location = new Point(MARGIN, MARGIN);
this.descr.Width = this.Width - 2 * MARGIN;
this.descr.Height = this.Height - this.closeButton.Height - 3 * MARGIN - moreLinkHeight;
this.descr.Text = poi.getDescr();
this.content.Controls.Add(this.descr);
this.moreLink = new LinkLabel();
this.moreLink.Text = "more";
this.moreLink.Height = moreLinkHeight;
this.moreLink.Width = 50;
this.moreLink.Location = new Point(MARGIN, 2 * MARGIN + this.descr.Height);
this.moreLink.Click += new EventHandler(gotoPoiBrowser);
this.content.Controls.Add(this.moreLink);
}
示例8: CreateRecentProjectsList
private void CreateRecentProjectsList()
{
bool haveProcessedTopMostProject = false;
foreach (string path in Settings.Default.MruConfigFilePaths.Paths)
{
LinkLabel recentProjectLabel = new LinkLabel();
recentProjectLabel.Text = Path.GetFileNameWithoutExtension(path);
recentProjectLabel.AutoSize = true;
recentProjectLabel.LinkColor = Color.Black;
recentProjectLabel.LinkBehavior = LinkBehavior.HoverUnderline;
if (!haveProcessedTopMostProject)
{
recentProjectLabel.Font = new Font("Microsoft Sans Serif",
12F,
FontStyle.Bold,
GraphicsUnit.Point,
0);
haveProcessedTopMostProject = true;
}
else
{
recentProjectLabel.Font = new Font("Microsoft Sans Serif",
12F,
FontStyle.Regular,
GraphicsUnit.Point,
0);
}
recentProjectLabel.Tag = path;
recentProjectLabel.LinkClicked += openRecentProject_LinkClicked;
flowLayoutPanel2.Controls.Add(recentProjectLabel);
}
}
示例9: attach
private byte[] attach(LinkLabel l1)
{
byte[] temp = null;
try
{
openFileDialog1.Multiselect = false;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
Invoke(new Action(() => l1.Text = "Attaching..."));
var stream = new FileStream(Path.Combine(Path.GetDirectoryName(openFileDialog1.FileName.ToString()), openFileDialog1.FileName.ToString()), FileMode.Open, FileAccess.Read);
var reader = new BinaryReader(stream);
temp = reader.ReadBytes((int)stream.Length);
Thread.Sleep(1000);
Invoke(new Action(() => l1.Text = "Copy Attached"));
return temp;
}
return temp;
}
catch (Exception e1)
{
MessageBox.Show(e1.ToString());
return temp;
}
}
示例10: TSSetLinks
public void TSSetLinks(SCLink[] aLinks)
{
if (pnlLinks.InvokeRequired) pnlLinks.Invoke(new Action<SCLink[]>(TSSetLinks), new Object[] { aLinks });
else
{
List<LinkLabel> removeList = new List<LinkLabel>();
foreach (Control c in pnlLinks.Controls)
{
if (c.GetType().ToString().Equals("System.Windows.Forms.LinkLabel")) removeList.Add((LinkLabel)c);
}
foreach (Control c in removeList)
{
pnlLinks.Controls.Remove(c);
}
// loop through each link
int i = 0;
foreach (SCLink item in aLinks)
{
//create a new label for the link
LinkLabel ll = new LinkLabel();
// text is the name or message that will be displayed
ll.Text = item.Text;
// this adds the url data to the message that will open the browser page when clicked
ll.Links.Add(new LinkLabel.Link(0, ll.Text.Length, item.Link));
// this adds a handler to the LinkLabel to run the URL just like opening something thru explorer
ll.LinkClicked += new LinkLabelLinkClickedEventHandler(eventHandlerLinkLabelClicked);
// each label needs a unique name
ll.Name = "llbl" + i++;
// sets the width to the max length, otherwise the label will be locked at the short default width
ll.Width = 300;
// add the new link label to the appropriate FlowLayoutPanel
pnlLinks.Controls.Add(ll);
}
}
}
示例11: UnavaMgr
public UnavaMgr(Postava pos, Label muL, NumericUpDown unN, FlowLayoutPanel bars, Panel labels, LinkLabel postihULink, Label postihUL)
{
postava = pos;
unavaPanel = bars;
mezUnavyL = muL;
unavaLabels = labels;
unavaN = unN;
postihLink = postihULink;
postihL = postihUL;
int mez = postava.getVlastnostO("Mez únavy");
boxes = new List<CheckBox>();
for (int i = 0; i < mez * 3; i++)
{
CheckBox box = new CheckBox();
//box.ThreeState = true;
box.Checked = false;
box.Margin = new Padding(0);
box.Parent = unavaPanel;
box.Width = box.Height = 15;
box.Click += new EventHandler(changeCheck);
box.Tag = i+1;
boxes.Add(box);
}
}
示例12: FrmCategoryProducts_LinkLabel_Load
private void FrmCategoryProducts_LinkLabel_Load(object sender, EventArgs e)
{
try
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = Settings.Default.northwindConnectionString;
SqlDataAdapter dataadapter = new SqlDataAdapter("select * from Products", conn);
DataSet dataset = new DataSet();
dataadapter.Fill(dataset);
this.dataGridView1.DataSource = dataset.Tables[0];
for (int i = 0; i < dataset.Tables[0].Columns.Count; i++)
{
LinkLabel newlable = new LinkLabel();
newlable.Text = dataset.Tables[0].Columns[i].ColumnName;
this.flowLayoutPanel1.Controls.Add(newlable);
newlable.Click += newlable_Click;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例13: CreateLinkLabel
private LinkLabel CreateLinkLabel(string text)
{
LinkLabel ll = new LinkLabel();
ll.BackColor = Color.Transparent;
ll.Text = text;
return ll;
}
示例14: ShowExam
private void ShowExam()
{
string userid = MainHelper.User.UserID;
string datatimestr = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
string sqlwhere = " where StartTime<'" + datatimestr + "' and EndTime>'" + datatimestr + "' and UserIDS like '%," + userid + ",%' and id not in( select E_ID from dbo.E_ExamResult where IsExamed=1 and UserID='" + userid + "' ) order by StartTime asc";
IList<E_Examination> list = Client.ClientHelper.PlatformSqlMap.GetList<E_Examination>(sqlwhere);
if (list.Count==0)
{
label1.Text = "您最近不需要考试";
linkLabel1.Show();
}
int index = 0;
foreach (E_Examination item in list)
{
index++;
Point lpoint = new Point();
lpoint.X = 30;
lpoint.Y = 10 + index * 25;
LinkLabel ll = new LinkLabel();
ll.Text = index+"、 "+ item.E_Name + " " + item.StartTime.ToShortDateString() + " --" + item.EndTime.ToShortDateString(); ;
ll.Tag = item;
ll.Location = lpoint;
ll.LinkClicked += new LinkLabelLinkClickedEventHandler(ll_LinkClicked);
ll.AutoSize = true;
panel1.Controls.Add(ll);
}
}
示例15: GetTextControlToAdd
protected override Control GetTextControlToAdd(int xPos, int yPos, int iconWidth, int iconPadding)
{
if (this._linkLabel == null)
{
this._linkLabel = new LinkLabel();
this._linkLabel.Location = new Point(xPos + iconWidth + iconPadding, yPos);
this._linkLabel.AutoSize = true;
this._linkLabel.Font = this.Font;
this._linkLabel.TabStop = true;
this._linkLabel.TabIndex = 0;
this._linkLabel.Text = this.InsertNewLines(this._parentDialog.Message, ((ClickableCustomMessageBox) this._parentDialog).FirstLinkText, ((ClickableCustomMessageBox) this._parentDialog).SecondLinkText);
this._linkLabel.AutoSize = false;
this._linkLabel.Size = SizeHelper.GetRequiredSizeForText((Control) this._linkLabel);
this._linkLabel.LinkClicked -= ((ClickableCustomMessageBox) this._parentDialog).LinkHandler;
this._linkLabel.LinkClicked += ((ClickableCustomMessageBox) this._parentDialog).LinkHandler;
if (this._linkLabel.Links.Count > 0)
this._linkLabel.Links.Clear();
if (!string.IsNullOrEmpty(((ClickableCustomMessageBox) this._parentDialog).FirstLinkText))
{
string firstLinkText = ((ClickableCustomMessageBox) this._parentDialog).FirstLinkText;
if (this._linkLabel.Text.IndexOf(firstLinkText) >= 0)
this._linkLabel.Links.Add(this._linkLabel.Text.IndexOf(firstLinkText), firstLinkText.Length, (object) WhichLinkClicked.FirstLink);
}
if (!string.IsNullOrEmpty(((ClickableCustomMessageBox) this._parentDialog).SecondLinkText))
{
string firstLinkText = ((ClickableCustomMessageBox) this._parentDialog).FirstLinkText;
string secondLinkText = ((ClickableCustomMessageBox) this._parentDialog).SecondLinkText;
if (this._linkLabel.Text.IndexOf(secondLinkText, this._linkLabel.Text.IndexOf(firstLinkText) + firstLinkText.Length) >= 0)
this._linkLabel.Links.Add(this._linkLabel.Text.IndexOf(secondLinkText, this._linkLabel.Text.IndexOf(firstLinkText) + firstLinkText.Length), secondLinkText.Length, (object) WhichLinkClicked.SecondLink);
}
}
return (Control) this._linkLabel;
}