winform中制作滚动消息的问题 我想在winform中实现滚动消息,并且在单击消息内容时连接到相应的页面,现在实现了消息滚动,但不知道怎么在StatusBar控件中添加linklabel 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 怎么没人帮忙啊,我只想在winform中制作个可以连接的滚动消息啊 设置鼠标经过StatusBar时候的光标捕获点击事件 private void statusBar1_PanelClick(object sender, System.Windows.Forms.StatusBarPanelClickEventArgs e) { System.Diagnostics.Process.Start("explorer.exe",e.StatusBarPanel.ToolTipText); } private void Form1_Load(object sender, System.EventArgs e) { statusBar1.Cursor = Cursors.Hand; statusBar1.Panels[0].Text = "CSDN"; statusBar1.Panels[0].ToolTipText = "http://www.csdn.net"; statusBar1.Panels[1].Text = "SINA"; statusBar1.Panels[1].ToolTipText = "http://www.sina.com.cn"; statusBar1.Panels[0].Width = 200; statusBar1.Panels[1].Width = 200; } 谢谢oolongTea(乌龙茶) ,但panel不能滚动啊 现在我只能实现在一个panel里实现字体滚动,有没有办法让状态栏的都实现滚动 yistudio(阳光灿烂的日子) ,能具体给点代码提示吗,谢谢 我现有的代码是这样的,但只能实现panel内滚动statusBar1.Cursor = Cursors.Hand;StatusBarPanel panel1 = new StatusBarPanel();StatusBarPanel panel2 = new StatusBarPanel();panel1.Text = this.news;panel1.ToolTipText = "http://www.csdn.net";panel1.BorderStyle = StatusBarPanelBorderStyle.Sunken;panel2.ToolTipText = "http://www.sina.com.cn";panel2.BorderStyle = StatusBarPanelBorderStyle.Sunken;panel2.Text = "";panel2.Width = 20;statusBar1.ShowPanels = true;statusBar1.Panels.Add(panel2);statusBar1.Panels.Add(panel1);while(true){ panel1.Text = this.news; this.data = panel1.Text; while(!data.Equals("")) { Thread.Sleep(500); panel1.Text = panel1.Text.Substring(1) + data[0]; data = data.Substring(1); }} using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;namespace test{ /// <summary> /// Form1 的摘要说明。 /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.LinkLabel linkLabel1; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.StatusBar statusBar1; private System.Windows.Forms.StatusBarPanel statusBarPanel1; private System.Windows.Forms.StatusBarPanel statusBarPanel2; private System.Windows.Forms.StatusBarPanel statusBarPanel3; private System.Windows.Forms.Panel panel1; private System.ComponentModel.IContainer components; public Form1() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.statusBar1 = new System.Windows.Forms.StatusBar(); this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel(); this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel(); this.statusBarPanel3 = new System.Windows.Forms.StatusBarPanel(); this.panel1 = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).BeginInit(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // linkLabel1 // this.linkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.linkLabel1.Location = new System.Drawing.Point(8, -2); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(376, 14); this.linkLabel1.TabIndex = 0; this.linkLabel1.TabStop = true; this.linkLabel1.Text = "意甲-克雷斯波助国米4-3胜切沃跃居榜首 罗马大胜 西甲巴萨主场6年不胜瓦伦 邵佳一首发科特布斯战平"; // // timer1 // this.timer1.Enabled = true; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // statusBar1 // this.statusBar1.Location = new System.Drawing.Point(0, 447); this.statusBar1.Name = "statusBar1"; this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { this.statusBarPanel1, this.statusBarPanel2, this.statusBarPanel3}); this.statusBar1.ShowPanels = true; this.statusBar1.Size = new System.Drawing.Size(664, 22); this.statusBar1.TabIndex = 2; this.statusBar1.Text = "statusBar1"; // // statusBarPanel1 // this.statusBarPanel1.BorderStyle = System.Windows.Forms.StatusBarPanelBorderStyle.Raised; this.statusBarPanel1.Text = "这里是中国"; // // statusBarPanel2 // this.statusBarPanel2.Text = "这里是我国"; // // statusBarPanel3 // this.statusBarPanel3.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; this.statusBarPanel3.BorderStyle = System.Windows.Forms.StatusBarPanelBorderStyle.Raised; this.statusBarPanel3.Width = 448; // // panel1 // this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.Controls.Add(this.linkLabel1); this.panel1.Location = new System.Drawing.Point(240, 454); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(400, 14); this.panel1.TabIndex = 3; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(664, 469); this.Controls.Add(this.panel1); this.Controls.Add(this.statusBar1); this.Name = "Form1"; this.Text = "Form1"; ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).EndInit(); this.panel1.ResumeLayout(false); this.ResumeLayout(false); } #endregion /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void Form1_Load(object sender, System.EventArgs e) { this.timer1.Enabled = true; } int location = 0; int lableLenth = 100; private void timer1_Tick(object sender, System.EventArgs e) { if(location > this.panel1.Width) { location = 0 - lableLenth; } this.linkLabel1.Location = new System.Drawing.Point(location, 0); location += 5; } }} dgv控件怎么能新加一行空白的时候自动加上时间 c#调用c编写的dll问题,char* 如何實現c++裡的 cout<<fixed<<setpresicion(2)<<good...... 怎样将IDictionary, IEnumerable,这一类的数据用xml来存储和读取? C#返回不了API中的结构,在线等 如何转为byte[]字节数组? 如何获取ftp站点目录的绝对路径 haiwangstar(南河三(天狼星上有没有普及C#)) 请进来接分 C#实现打印PDF文档 一个实现接口的类必须要全部实现这个接口的所有方法吗? DateTimePicker 问题 pc和服务器的差别??
捕获点击事件
{
System.Diagnostics.Process.Start("explorer.exe",e.StatusBarPanel.ToolTipText);
} private void Form1_Load(object sender, System.EventArgs e)
{
statusBar1.Cursor = Cursors.Hand; statusBar1.Panels[0].Text = "CSDN";
statusBar1.Panels[0].ToolTipText = "http://www.csdn.net";
statusBar1.Panels[1].Text = "SINA";
statusBar1.Panels[1].ToolTipText = "http://www.sina.com.cn"; statusBar1.Panels[0].Width = 200;
statusBar1.Panels[1].Width = 200;
}
statusBar1.Cursor = Cursors.Hand;
StatusBarPanel panel1 = new StatusBarPanel();
StatusBarPanel panel2 = new StatusBarPanel();
panel1.Text = this.news;
panel1.ToolTipText = "http://www.csdn.net";
panel1.BorderStyle = StatusBarPanelBorderStyle.Sunken;
panel2.ToolTipText = "http://www.sina.com.cn";
panel2.BorderStyle = StatusBarPanelBorderStyle.Sunken;
panel2.Text = "";
panel2.Width = 20;
statusBar1.ShowPanels = true;
statusBar1.Panels.Add(panel2);
statusBar1.Panels.Add(panel1);
while(true)
{
panel1.Text = this.news;
this.data = panel1.Text;
while(!data.Equals(""))
{
Thread.Sleep(500);
panel1.Text = panel1.Text.Substring(1) + data[0];
data = data.Substring(1);
}
}
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace test
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.StatusBarPanel statusBarPanel1;
private System.Windows.Forms.StatusBarPanel statusBarPanel2;
private System.Windows.Forms.StatusBarPanel statusBarPanel3;
private System.Windows.Forms.Panel panel1;
private System.ComponentModel.IContainer components; public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanel3 = new System.Windows.Forms.StatusBarPanel();
this.panel1 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// linkLabel1
//
this.linkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.linkLabel1.Location = new System.Drawing.Point(8, -2);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(376, 14);
this.linkLabel1.TabIndex = 0;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "意甲-克雷斯波助国米4-3胜切沃跃居榜首 罗马大胜 西甲巴萨主场6年不胜瓦伦 邵佳一首发科特布斯战平";
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 447);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.statusBarPanel1,
this.statusBarPanel2,
this.statusBarPanel3});
this.statusBar1.ShowPanels = true;
this.statusBar1.Size = new System.Drawing.Size(664, 22);
this.statusBar1.TabIndex = 2;
this.statusBar1.Text = "statusBar1";
//
// statusBarPanel1
//
this.statusBarPanel1.BorderStyle = System.Windows.Forms.StatusBarPanelBorderStyle.Raised;
this.statusBarPanel1.Text = "这里是中国";
//
// statusBarPanel2
//
this.statusBarPanel2.Text = "这里是我国";
//
// statusBarPanel3
//
this.statusBarPanel3.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
this.statusBarPanel3.BorderStyle = System.Windows.Forms.StatusBarPanelBorderStyle.Raised;
this.statusBarPanel3.Width = 448;
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.linkLabel1);
this.panel1.Location = new System.Drawing.Point(240, 454);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(400, 14);
this.panel1.TabIndex = 3;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(664, 469);
this.Controls.Add(this.panel1);
this.Controls.Add(this.statusBar1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).EndInit();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
this.timer1.Enabled = true;
} int location = 0;
int lableLenth = 100;
private void timer1_Tick(object sender, System.EventArgs e)
{ if(location > this.panel1.Width)
{
location = 0 - lableLenth;
} this.linkLabel1.Location = new System.Drawing.Point(location, 0);
location += 5; }
}
}