C#winform实现跑马灯
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; namespace WindowsFormsApplication1 { public partial class Form3 : Form { public Form3() { InitializeComponent(); } delegate void show(); Thread t= null ; private void Form3_Load( object sender, EventArgs e) { t = new Thread( new ThreadStart(ShowLbl)); t.Start(); } public void ShowLbl() { while ( true ) { if (panel1.InvokeRequired) { panel1.Invoke( new show(GetConfig)); } Thread.Sleep(200); } } private void GetConfig() { try { this .label2.Text = "中国传统文化博大精深,学习和掌握其中的各种思想精华,对树立正确的世界观、人生观、价值观很有益处。" ; this .label1.Text = "中国传统文化博大精深,学习和掌握其中的各种思想精华,对树立正确的世界观、人生观、价值观很有益处。" ; this .label1.Left = label1.Left - 10; this .label2.Left = label1.Left + this .label1.Size.Width; if (label1.Left + label1.Size.Width <= 0) { label1.Left = label2.Left; label2.Left = label1.Left + this .label1.Size.Width; } } catch (Exception ex) { } } private void Form3_FormClosing( object sender, FormClosingEventArgs e) { if (t != null ) { t.Abort(); } } } } |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· 2 本地部署DeepSeek模型构建本地知识库+联网搜索详细步骤