为什么我的表格闪烁

编程入门 行业动态 更新时间:2024-10-25 00:24:18
本文介绍了为什么我的表格闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

为什么我的表格在眨眼. 当我按下表单内的按钮时,表单将闪烁并且不会消失,然后按下按钮,表单将消失. 这是表单代码.

Why is my form blinking. when i press a button inside the form,the form will blink and not disappear, and then press the button the form will disappear . this the form code.

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Company_Accounts { public partial class MyMessageBox : Form { static MyMessageBox newMessageBox; static string Button_id; public static DataGridViewRow dr; public Timer msgTimer; int disposeFormTimer; public MyMessageBox() { InitializeComponent(); } private void MyMessageBox_Load(object sender, EventArgs e) { ControlBox = false; disposeFormTimer = 30; newMessageBox.lblTimer.Text = disposeFormTimer.ToString(); msgTimer = new Timer(); msgTimer.Interval = 1000; msgTimer.Enabled = true; msgTimer.Start(); msgTimer.Tick += new System.EventHandler(this.timer1_Tick ); } public static string ShowBox(string txtMessage, string txtTitle) { newMessageBox = new MyMessageBox(); newMessageBox.label3.Text = txtTitle; newMessageBox.label1.Text = txtMessage; newMessageBox.ShowDialog(); return Button_id; } private void btnlist_Click(object sender, EventArgs e) { newMessageBox.msgTimer.Stop(); Button_id = "3"; this.Hide(); this.Close(); } private void btnrenter_Click(object sender, EventArgs e) { newMessageBox.msgTimer.Stop(); Button_id = "1"; this.Close(); } private void btnadd_Click(object sender, EventArgs e) { newMessageBox.msgTimer.Stop(); Button_id = "2"; this.Close(); } private void timer1_Tick(object sender, EventArgs e) { disposeFormTimer--; if (disposeFormTimer >= 0) { newMessageBox.lblTimer.Text = disposeFormTimer.ToString(); } else { newMessageBox.msgTimer.Stop(); newMessageBox.msgTimer.Dispose(); newMessageBox.Dispose(); } } } }

plz,plz,任何人都可以帮助我

plz,plz, Anyone Can Help Me

推荐答案

private void btnlist_Click(object sender, EventArgs e) { newMessageBox.msgTimer.Stop(); Button_id = "3"; this.Hide(); this.Close(); }

对于上层事件,仅执行此操作. Close()hide应该不存在..您还必须提到要单击的按钮事件,这样才能真正帮助您了解该事件代码中的问题

for upper event do only this. Close() hide should not be there..also you have to mention which button event you are clicking so it would really help to understand what is the problem in that event code

更多推荐

为什么我的表格闪烁

本文发布于:2023-11-26 17:45:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634558.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表格

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!