StatusStrip控件
2024-08-22 20:24:49
态栏用于显示用户状态的简短信息。
StatusStrip控件是由system.windows.forms.statusStrip类提供,作用是在应用程序中标识对话框底部的一栏,通常用于显示应用程序当前状态的简短信息。
在StatusStrip中可以使用toolstrip中介绍的控件中的三个----Toolstripdropdownbutton、toolstripprogressbar、toolstripSplitbutton
还有一个控件就是StatusStrip专用的,即StatusStripStatuslabel,作用就是使用文本和图像用户显示应用程序当前状态的信息。
namespace StatusStrip状态栏控件
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = DateTime.Now.ToString();
} private void timer1_Tick(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = DateTime.Now.ToString();
}
//鼠标点击事件
private void textBox1_Click(object sender, EventArgs e)
{
//获取当前行第一个字符所在的索引值
int index = textBox1.GetFirstCharIndexOfCurrentLine(); //计算行号
int line = textBox1.GetFirstCharIndexFromLine(index); //计算列数 int column = textBox1.SelectionStart - index + 1;
//如 textbox索引为 10 11 12 13 14 15 16 比如鼠标选择的是16 怎么计算是多少列呢
//那index=10 column=selectionstart(当前选择起点16)-index(第一个索引值)+1=第7列 toolStripStatusLabel3.Text = "第"+line+"行,第"+column+"列";
}
//键盘弹起事件
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
//获取当前行第一个字符所在的索引值
int index = textBox1.GetFirstCharIndexOfCurrentLine(); //计算行号
int line = textBox1.GetFirstCharIndexFromLine(index); //计算列数 int column = textBox1.SelectionStart - index + 1;
//如 textbox索引为 10 11 12 13 14 15 16 比如鼠标选择的是16 怎么计算是多少列呢
//那index=10 column=selectionstart(当前选择起点16)-index(第一个索引值)+1=第7列 toolStripStatusLabel3.Text = "第" + line+1 + "行" + "," + "第" + column + "列";
}
最新文章
- js get browser vertion (js获取浏览器信息版本)
- Unity贴图锯齿
- 【密码】Oracle用户密码系列
- 关于QT写注册表开机自启动
- 【阿里云产品公测】OTS使用之简单线上产品实践基于PythonSDK
- 本篇文章主要是对jquery+ajax+C#实现无刷新操作数据库数据的简单实例进行了介绍,需要的朋友可以过来参考下,希望对大家有所帮助
- Geodatabase - 打开要素类
- iOS通用链接(Universal Links)突然点击无效的解决方案
- Centos运行Mysql因为内存不足进程被杀
- js算法初窥04(算法模式01-递归)
- JAVA写接口傻瓜($)教程(三)
- git查看某个文件的提交记录
- Sanic
- [笔记] SQL性能优化 - 避免使用 IN 和 NOT IN
- ionic入门
- Javascript实现对象的创建
- SSH服务知识
- 惠普开源的通信测试工具Seagull的安装体会
- eclipse 大小写转换
- 使用sigaction函数
热门文章
- @Configurable
- JVM垃圾收集器(1)
- 关于mysql中[Err] 1451 -Cannot delete or update a parent row: a foreign key constraint fails
- python网络编程--协程
- Docker的安装与启动教程
- 机器学习笔记(四)--sklearn数据集
- HDU-1260-Tickets(线性DP,DP入门)
- 47.ActiveMQ集群
- 安装配置python、beautifulsoup4、pip的心酸总结
- canvas+js画饼状图