当前位置:网站首页>C listbox usage
C listbox usage
2022-06-09 14:31:00 【Xiongsiyu】
stay Winform in ,ListBox It's good to display logs , Pictured :

usage :
/// <summary>
/// Add normal log
/// </summary>
/// <param name="content"> Content </param>
public void AddOrdinaryLog(string content)
{
if (this.InvokeRequired)
{
// Switch to UI Threads
this.Invoke(new MethodInvoker(delegate
{
AddOrdinaryLog_UI(content);
}));
}
else
{
AddOrdinaryLog_UI(content);
}
}
private void AddOrdinaryLog_UI(string content)
{
// Read the current ListBox List length
int len = ListBox_OrdinaryLogList.Items.Count;
// Insert a new line
ListBox_OrdinaryLogList.Items.Insert(len, content);
// The list length is greater than 30, Then delete No 1 Row data
if (len > 30)
ListBox_OrdinaryLogList.Items.RemoveAt(0);
// After inserting new data , Move the scroll bar to the bottom
int visibleItems = ListBox_OrdinaryLogList.ClientSize.Height / ListBox_OrdinaryLogList.ItemHeight;
ListBox_OrdinaryLogList.TopIndex = Math.Max(ListBox_OrdinaryLogList.Items.Count - visibleItems + 1, 0);
}Here I add a thread judgment , No need to copy directly AddOrdinaryLog_UI This method can .
end
边栏推荐
- 代码实现WordPress编写文章可以调整字体字号
- The golden band is the fourth largest operator's mace, and farmers will get low-cost 5g services
- [leetcode question brushing record] sorting
- The Embassy in the United States reminds Chinese citizens in the United States to pay attention to summer travel safety
- Specification for outdoor pest control of wheat in smart agriculture, Beidou agriculture
- Leetcode longest sequence
- C语言————贪心法
- 【tgcalls】跟踪调试calls的manager们 3: cricket::Candidate> 的回传上层
- 发邮件:错排问题的分析
- C language -- greedy method
猜你喜欢

发牌三年 5G网络深度覆盖 应用融入千行百业

TCP(滑动窗口,流量控制)

【深度优先搜索】玩具蛇:迷宫问题

Like the brain, the nano magnet network can be used to perform AI like computing processing, which can reduce energy consumption

Best practices for WSL installation

Common image segmentation methods

#云原生征文#Kubernetes工作负载

4427 node sum in tree (greedy)

Win11 enable multi-user remote desktop simultaneous login

占位智能家居市场,施耐德电气仅靠一个Wiser系统?
随机推荐
C# 计算两个时间间隔
网络摄像头RTSP视频流WEB端实时播放实现方案
#yyds干货盘点# 解决剑指offer:矩形覆盖
QUIC和互联网传输的未来
软件配置项变更与基线变更
【云原生 | Kubernetes篇】深入了解Pod(六)
Mba-day20 indefinite equation problems - exercises
UniswapV2周边合约学习(八)-- ExampleSwapToPrice.sol
ERC721非同质代币(NFT)介绍
5 minutes to learn about nfv
Dr. Stanford put forward the idea of ultra fast and saving memory attention. The gpt-2 training speed was increased by 3.5 times, and the Bert speed reached a record
WSL 安装的最佳实践
C# ListBox用法
Selenium-- display waiting (upper)
使用 KubeKey 搭建 Kubernetes/KubeSphere 环境的'心路(累)历程'
输入一行字符(最多80个),从第location个位置开始,截取number个字符并将其输出。
黄金频段乃第四大运营商杀手锏,农民将获得低价5G服务
Three years of licensing, 5g network in-depth coverage application is integrated into thousands of industries
简单说说路由器和交换机的区别
Wincc中,如何利用C脚本对变量进行置位+复位+取反操作?