- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个非常长时间运行的任务在我的程序后台异步运行。
在这样做的同时,有各种事件负责更新 GUI,利用 MethodInvoker
确保这些 GUI 更新始终在主线程上运行。
然而,尽管只有 ToolStripProgressBar
和 ToolStripLabel
被更改,但我的表单上的两个 ListBox
似乎经常被重绘以及导致它们闪烁。
知道为什么会这样吗?我没有在我的表单中的任何地方使用 Update()
,所以我没有理由知道为什么非无效控件会闪烁。
我还验证了更新 ListBox
的事件不是被错误触发的。
进度步骤的 EventHandler
设置为以下函数:
private void UpdateProgress()
{
if (InvokeRequired)
{
Invoke((MethodInvoker) UpdateProgress);
return;
}
_lblProgress.Text = $"{_currentRow}/{_totalRows}";
_pbarProgress.Increment(1);
}
这是不言自明的,如果它需要被调用
,那么它会在更新toolStripStatusLabel
和toolStripProgressBar
之前这样做。
整个布局已经生成并由 WinForms
设计器处理,但这是相关代码:
namespace Stability_Report_Generator
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this._tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this._lstMontrose = new System.Windows.Forms.ListBox();
this._lstBLP = new System.Windows.Forms.ListBox();
this._tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this._groupBox1 = new System.Windows.Forms.GroupBox();
this._rdoAllData = new System.Windows.Forms.RadioButton();
this._rdoLastShift = new System.Windows.Forms.RadioButton();
this._rdoLastDay = new System.Windows.Forms.RadioButton();
this._tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this._btnGenerate = new System.Windows.Forms.Button();
this._btnView = new System.Windows.Forms.Button();
this._btnClear = new System.Windows.Forms.Button();
this._label1 = new System.Windows.Forms.Label();
this._label2 = new System.Windows.Forms.Label();
this._statusStrip1 = new System.Windows.Forms.StatusStrip();
this._lblStatus = new System.Windows.Forms.ToolStripStatusLabel();
this._lblProgress = new System.Windows.Forms.ToolStripStatusLabel();
this._pbarProgress = new System.Windows.Forms.ToolStripProgressBar();
this._menuStrip1 = new System.Windows.Forms.MenuStrip();
this._fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._addFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._bLpsoeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._montroseSOEToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._removeFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._bLpOnlyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._montroseOnlyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._preferencesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._viewGraphsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._tableLayoutPanel1.SuspendLayout();
this._tableLayoutPanel2.SuspendLayout();
this._groupBox1.SuspendLayout();
this._tableLayoutPanel3.SuspendLayout();
this._statusStrip1.SuspendLayout();
this._menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// _tableLayoutPanel1
//
this._tableLayoutPanel1.ColumnCount = 3;
this._tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this._tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
this._tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
this._tableLayoutPanel1.Controls.Add(this._lstMontrose, 0, 1);
this._tableLayoutPanel1.Controls.Add(this._lstBLP, 1, 1);
this._tableLayoutPanel1.Controls.Add(this._tableLayoutPanel2, 2, 1);
this._tableLayoutPanel1.Controls.Add(this._label1, 0, 0);
this._tableLayoutPanel1.Controls.Add(this._label2, 1, 0);
this._tableLayoutPanel1.Controls.Add(this._statusStrip1, 2, 2);
this._tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this._tableLayoutPanel1.Location = new System.Drawing.Point(20, 84);
this._tableLayoutPanel1.Name = "_tableLayoutPanel1";
this._tableLayoutPanel1.RowCount = 3;
this._tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this._tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this._tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this._tableLayoutPanel1.Size = new System.Drawing.Size(1090, 420);
this._tableLayoutPanel1.TabIndex = 0;
//
// _lstMontrose
//
this._lstMontrose.Dock = System.Windows.Forms.DockStyle.Fill;
this._lstMontrose.FormattingEnabled = true;
this._lstMontrose.Location = new System.Drawing.Point(3, 23);
this._lstMontrose.Name = "_lstMontrose";
this._lstMontrose.Size = new System.Drawing.Size(357, 374);
this._lstMontrose.TabIndex = 0;
//
// _lstBLP
//
this._lstBLP.Dock = System.Windows.Forms.DockStyle.Fill;
this._lstBLP.FormattingEnabled = true;
this._lstBLP.Location = new System.Drawing.Point(366, 23);
this._lstBLP.Name = "_lstBLP";
this._lstBLP.Size = new System.Drawing.Size(357, 374);
this._lstBLP.TabIndex = 1;
//
// _tableLayoutPanel2
//
this._tableLayoutPanel2.ColumnCount = 1;
this._tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this._tableLayoutPanel2.Controls.Add(this._groupBox1, 0, 1);
this._tableLayoutPanel2.Controls.Add(this._tableLayoutPanel3, 0, 0);
this._tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this._tableLayoutPanel2.Location = new System.Drawing.Point(729, 23);
this._tableLayoutPanel2.Name = "_tableLayoutPanel2";
this._tableLayoutPanel2.RowCount = 2;
this._tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this._tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this._tableLayoutPanel2.Size = new System.Drawing.Size(358, 374);
this._tableLayoutPanel2.TabIndex = 2;
//
// _groupBox1
//
this._groupBox1.Controls.Add(this._rdoAllData);
this._groupBox1.Controls.Add(this._rdoLastShift);
this._groupBox1.Controls.Add(this._rdoLastDay);
this._groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this._groupBox1.Location = new System.Drawing.Point(3, 190);
this._groupBox1.Name = "_groupBox1";
this._groupBox1.Size = new System.Drawing.Size(352, 181);
this._groupBox1.TabIndex = 0;
this._groupBox1.TabStop = false;
this._groupBox1.Text = "Time Period";
//
// _rdoAllData
//
this._rdoAllData.AutoSize = true;
this._rdoAllData.Location = new System.Drawing.Point(16, 68);
this._rdoAllData.Name = "_rdoAllData";
this._rdoAllData.Size = new System.Drawing.Size(62, 17);
this._rdoAllData.TabIndex = 2;
this._rdoAllData.TabStop = true;
this._rdoAllData.Text = "All Data";
this._rdoAllData.UseVisualStyleBackColor = true;
//
// _rdoLastShift
//
this._rdoLastShift.AutoSize = true;
this._rdoLastShift.Location = new System.Drawing.Point(16, 44);
this._rdoLastShift.Name = "_rdoLastShift";
this._rdoLastShift.Size = new System.Drawing.Size(69, 17);
this._rdoLastShift.TabIndex = 1;
this._rdoLastShift.TabStop = true;
this._rdoLastShift.Text = "Last Shift";
this._rdoLastShift.UseVisualStyleBackColor = true;
//
// _rdoLastDay
//
this._rdoLastDay.AutoSize = true;
this._rdoLastDay.Location = new System.Drawing.Point(16, 20);
this._rdoLastDay.Name = "_rdoLastDay";
this._rdoLastDay.Size = new System.Drawing.Size(67, 17);
this._rdoLastDay.TabIndex = 0;
this._rdoLastDay.TabStop = true;
this._rdoLastDay.Text = "Last Day";
this._rdoLastDay.UseVisualStyleBackColor = true;
//
// _tableLayoutPanel3
//
this._tableLayoutPanel3.ColumnCount = 1;
this._tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this._tableLayoutPanel3.Controls.Add(this._btnGenerate, 0, 0);
this._tableLayoutPanel3.Controls.Add(this._btnView, 0, 1);
this._tableLayoutPanel3.Controls.Add(this._btnClear, 0, 2);
this._tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this._tableLayoutPanel3.Location = new System.Drawing.Point(3, 3);
this._tableLayoutPanel3.Name = "_tableLayoutPanel3";
this._tableLayoutPanel3.RowCount = 3;
this._tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this._tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this._tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this._tableLayoutPanel3.Size = new System.Drawing.Size(352, 181);
this._tableLayoutPanel3.TabIndex = 1;
//
// _btnGenerate
//
this._btnGenerate.Dock = System.Windows.Forms.DockStyle.Fill;
this._btnGenerate.Enabled = false;
this._btnGenerate.Location = new System.Drawing.Point(3, 3);
this._btnGenerate.Name = "_btnGenerate";
this._btnGenerate.Size = new System.Drawing.Size(346, 54);
this._btnGenerate.TabIndex = 0;
this._btnGenerate.Text = "Generate Report";
this._btnGenerate.UseVisualStyleBackColor = true;
this._btnGenerate.Click += new System.EventHandler(this.btnGenerate_Click);
//
// _btnView
//
this._btnView.Dock = System.Windows.Forms.DockStyle.Fill;
this._btnView.Enabled = false;
this._btnView.Location = new System.Drawing.Point(3, 63);
this._btnView.Name = "_btnView";
this._btnView.Size = new System.Drawing.Size(346, 54);
this._btnView.TabIndex = 1;
this._btnView.Text = "View Details";
this._btnView.UseVisualStyleBackColor = true;
//
// _btnClear
//
this._btnClear.Dock = System.Windows.Forms.DockStyle.Fill;
this._btnClear.Enabled = false;
this._btnClear.Location = new System.Drawing.Point(3, 123);
this._btnClear.Name = "_btnClear";
this._btnClear.Size = new System.Drawing.Size(346, 55);
this._btnClear.TabIndex = 2;
this._btnClear.Text = "Reset";
this._btnClear.UseVisualStyleBackColor = true;
//
// _label1
//
this._label1.AutoSize = true;
this._label1.Dock = System.Windows.Forms.DockStyle.Fill;
this._label1.Location = new System.Drawing.Point(3, 0);
this._label1.Name = "_label1";
this._label1.Size = new System.Drawing.Size(357, 20);
this._label1.TabIndex = 3;
this._label1.Text = "Montrose SOE Files";
//
// _label2
//
this._label2.AutoSize = true;
this._label2.Dock = System.Windows.Forms.DockStyle.Fill;
this._label2.Location = new System.Drawing.Point(366, 0);
this._label2.Name = "_label2";
this._label2.Size = new System.Drawing.Size(357, 20);
this._label2.TabIndex = 4;
this._label2.Text = "BLP SOE Files";
//
// _statusStrip1
//
this._statusStrip1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this._statusStrip1.BackColor = System.Drawing.Color.White;
this._statusStrip1.Dock = System.Windows.Forms.DockStyle.None;
this._statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this._lblStatus,
this._lblProgress,
this._pbarProgress});
this._statusStrip1.Location = new System.Drawing.Point(936, 400);
this._statusStrip1.Name = "_statusStrip1";
this._statusStrip1.RightToLeft = System.Windows.Forms.RightToLeft.No;
this._statusStrip1.Size = new System.Drawing.Size(154, 20);
this._statusStrip1.SizingGrip = false;
this._statusStrip1.Stretch = false;
this._statusStrip1.TabIndex = 5;
this._statusStrip1.Text = "statusStrip1";
//
// _lblStatus
//
this._lblStatus.Name = "_lblStatus";
this._lblStatus.Size = new System.Drawing.Size(35, 15);
this._lblStatus.Text = "Idle...";
//
// _lblProgress
//
this._lblProgress.Name = "_lblProgress";
this._lblProgress.Size = new System.Drawing.Size(0, 15);
//
// _pbarProgress
//
this._pbarProgress.Name = "_pbarProgress";
this._pbarProgress.Size = new System.Drawing.Size(100, 14);
//
// _menuStrip1
//
this._menuStrip1.BackColor = System.Drawing.Color.White;
this._menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this._fileToolStripMenuItem,
this._editToolStripMenuItem,
this._toolsToolStripMenuItem});
this._menuStrip1.Location = new System.Drawing.Point(20, 60);
this._menuStrip1.Name = "_menuStrip1";
this._menuStrip1.Size = new System.Drawing.Size(1090, 24);
this._menuStrip1.TabIndex = 1;
this._menuStrip1.Text = "menuStrip1";
//
// _fileToolStripMenuItem
//
this._fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this._addFilesToolStripMenuItem});
this._fileToolStripMenuItem.Name = "_fileToolStripMenuItem";
this._fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this._fileToolStripMenuItem.Text = "File";
//
// _addFilesToolStripMenuItem
//
this._addFilesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this._bLpsoeToolStripMenuItem,
this._montroseSOEToolStripMenuItem});
this._addFilesToolStripMenuItem.Name = "_addFilesToolStripMenuItem";
this._addFilesToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
this._addFilesToolStripMenuItem.Text = "Add Files";
//
// _bLpsoeToolStripMenuItem
//
this._bLpsoeToolStripMenuItem.Name = "_bLpsoeToolStripMenuItem";
this._bLpsoeToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this._bLpsoeToolStripMenuItem.Text = "BLP SOE";
//
// _montroseSOEToolStripMenuItem
//
this._montroseSOEToolStripMenuItem.Name = "_montroseSOEToolStripMenuItem";
this._montroseSOEToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this._montroseSOEToolStripMenuItem.Text = "Montrose SOE";
//
// _editToolStripMenuItem
//
this._editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this._removeFilesToolStripMenuItem,
this._preferencesToolStripMenuItem});
this._editToolStripMenuItem.Name = "_editToolStripMenuItem";
this._editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
this._editToolStripMenuItem.Text = "Edit";
//
// _removeFilesToolStripMenuItem
//
this._removeFilesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this._bLpOnlyToolStripMenuItem,
this._montroseOnlyToolStripMenuItem});
this._removeFilesToolStripMenuItem.Name = "_removeFilesToolStripMenuItem";
this._removeFilesToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this._removeFilesToolStripMenuItem.Text = "Remove Files";
//
// _bLpOnlyToolStripMenuItem
//
this._bLpOnlyToolStripMenuItem.Name = "_bLpOnlyToolStripMenuItem";
this._bLpOnlyToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
this._bLpOnlyToolStripMenuItem.Text = "BLP Only";
//
// _montroseOnlyToolStripMenuItem
//
this._montroseOnlyToolStripMenuItem.Name = "_montroseOnlyToolStripMenuItem";
this._montroseOnlyToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
this._montroseOnlyToolStripMenuItem.Text = "Montrose Only";
//
// _preferencesToolStripMenuItem
//
this._preferencesToolStripMenuItem.Name = "_preferencesToolStripMenuItem";
this._preferencesToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this._preferencesToolStripMenuItem.Text = "Preferences";
//
// _toolsToolStripMenuItem
//
this._toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this._viewGraphsToolStripMenuItem});
this._toolsToolStripMenuItem.Name = "_toolsToolStripMenuItem";
this._toolsToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
this._toolsToolStripMenuItem.Text = "Tools";
//
// _viewGraphsToolStripMenuItem
//
this._viewGraphsToolStripMenuItem.Name = "_viewGraphsToolStripMenuItem";
this._viewGraphsToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
this._viewGraphsToolStripMenuItem.Text = "View Graphs";
//
// MainForm
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1130, 524);
this.Controls.Add(this._tableLayoutPanel1);
this.Controls.Add(this._menuStrip1);
this.MainMenuStrip = this._menuStrip1;
this.Name = "MainForm";
this.Text = "Stability Report Generator";
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.MainForm_DragDrop);
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.MainForm_DragEnter);
this._tableLayoutPanel1.ResumeLayout(false);
this._tableLayoutPanel1.PerformLayout();
this._tableLayoutPanel2.ResumeLayout(false);
this._groupBox1.ResumeLayout(false);
this._groupBox1.PerformLayout();
this._tableLayoutPanel3.ResumeLayout(false);
this._statusStrip1.ResumeLayout(false);
this._statusStrip1.PerformLayout();
this._menuStrip1.ResumeLayout(false);
this._menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TableLayoutPanel _tableLayoutPanel1;
private System.Windows.Forms.TableLayoutPanel _tableLayoutPanel2;
private System.Windows.Forms.GroupBox _groupBox1;
private System.Windows.Forms.RadioButton _rdoAllData;
private System.Windows.Forms.RadioButton _rdoLastShift;
private System.Windows.Forms.RadioButton _rdoLastDay;
private System.Windows.Forms.TableLayoutPanel _tableLayoutPanel3;
private System.Windows.Forms.Button _btnGenerate;
private System.Windows.Forms.Button _btnView;
private System.Windows.Forms.Button _btnClear;
private System.Windows.Forms.MenuStrip _menuStrip1;
private System.Windows.Forms.ToolStripMenuItem _fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem _addFilesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem _bLpsoeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem _montroseSOEToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem _editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem _removeFilesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem _bLpOnlyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem _montroseOnlyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem _preferencesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem _toolsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem _viewGraphsToolStripMenuItem;
private System.Windows.Forms.ListBox _lstMontrose;
private System.Windows.Forms.ListBox _lstBLP;
private System.Windows.Forms.Label _label1;
private System.Windows.Forms.Label _label2;
private System.Windows.Forms.StatusStrip _statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel _lblStatus;
private System.Windows.Forms.ToolStripProgressBar _pbarProgress;
private System.Windows.Forms.ToolStripStatusLabel _lblProgress;
}
最佳答案
您看到闪烁的原因是 ListBox.IntegralHeight
的副作用默认情况下为 true
,这会触发调整大小算法,该算法会根据内容更改控件的大小,这显然会导致副作用。
当您更新进度条的速度快于每 100 毫秒一次时,就会出现此问题。更新速度快于立即导致闪烁,这可能与调用 SendMessage(NativeMethods.PBM_SETPOS, value, 0)
的进度条控件的渲染循环的内部实现有关或窗口消息循环本身的内部结构以及在幕后实现渲染的方式,很难说。
您可以选择通过将进度条增量与 _currentRow
增量分开来减慢进度条的更新,例如通过将进度条增量放入每 100 毫秒或什至更慢触发的其他定时器滴答处理程序中。
或者将 IntegralHeight
属性设置为 false
,见下文。
this._lstMontrose.IntegralHeight = false;
this._lstBLP.IntegralHeight = false;
希望它能解决您的问题!
关于c# - 尽管未更新,但 Winforms 控件闪烁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43679181/
我有一个 winform 应用程序和一个可观察的设置,如下所示: Form form = new Form(); Label lb = new Label(); form.Controls.Add(l
在 Windows 窗体中实现多项选择选项的最佳方法是什么?我想从列表中强制执行单个选择,从默认值开始。 看起来 ComboBox 是一个不错的选择,但是有没有办法指定一个非空白的默认值? 我可以在代
如何在 WinForm 应用程序中保护我的 ConnectionString? 最佳答案 你不能。尽管您可以在 app.config 文件中加密连接字符串,但应用程序需要能够解密它,因此,始终可以检索
有谁知道像 DotNetBar 那样的 Winforms 面包屑样式导航。 http://www.devcomponents.com/dotnetbar/BreadCrumbHorizontalTre
我正在寻找在 Windows 窗体 C# 中实现多选启用列表框的方法。 有什么建议? 谢谢。 最佳答案 只需添加一个 ListBox控制和设置属性:SelectionMode = SelectionM
我有一个简单的 WinForms 应用程序,用于输入测试用例。自从我将此应用程序升级到 .NET 4.0 并将新的标签页添加到标签页控件以根据 XSD 架构验证 XML 以来,该应用程序一直随机崩溃。
在老式的 MFC 中,DDX 例程内置了表单条目的验证。例如,可以自动检查用户是否在用于数字输入的文本框中输入了字符串。 Winforms中有这样的机制吗?显然,可以为“onChange”等类型的事件
我主要具有 ASP.Net 背景,并具有一些 MVC 知识。我也做了一些 Silverlight 和 MVVM,但是我现在即将转向 Winforms,我对它的经验很少,所以我想知道如何处理 MVP。
简单的问题,虽然办公室里似乎没有人知道,而且我找不到一个好的方法来问谷歌这个问题。在 winforms 中,如果您有一个处理事件的函数(在本例中是在 focusLost 上),那么该函数是否与触发该事
在 Winform 中,我有一个组框,其中有几个文本框控件。如果我删除组框,文本框也会被删除。它们以某种方式与 Groupbox 联系在一起,尽管我没有故意做任何事情来实现这种情况。问题 - 如何删除
我可以在哈希表中设置表单元素: $Hash = @{} $Hash.Main = New-Object System.Windows.Forms.Form $Hash.Main.Left = 0 $H
我是 Windows 开发新手。我开发了一个 WinForm 应用程序,它与串行设备通信并在图表上绘制数据。该应用程序应每天 7/7 24 小时运行。代码执行正确,但执行几个小时后,UI 卡住,操作系
有没有办法记录 Win Forms 应用程序中的所有点击?我想拦截点击并记录该操作以及导致该操作的控件的名称。 这可能吗? 提前致谢。 更新:我正在寻找一个应用程序范围的解决方案,是否没有办法将监听器
我不知道这是否会影响其他控件,但对于列表框和选中列表框,列表框的底部仅以一定的间隔随表单调整大小。 假设我有一个表单和一个列表框,该列表框与表单边缘的所有边都有 2px 间隙,并锚定在所有四个边上。现
我在大多数 WinForms 控件的设计 View 中看到“Tag”属性。我从未使用过此标签,并且想知道为什么我要使用它。 最佳答案 它允许您使用控件存储一些自己的数据。它在树控件中最有用,您可能希望
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
如果有,有人吗?鱼眼 (菜单/ Pane )窗体在 Ajax 应用程序中常见的控件: 例如:http://interface.eyecon.ro/demos/fisheye.html 用 google
这是 Determine Label Size based upon amount of text and font size in Winforms/C# 的倒数. 给定一个高度固定但宽度可变的矩形
我们公司正在研究为我们的开发团队采购 22"显示器。当前唯一的问题是我们的用户将使用较小的屏幕。 我们尝试使用屏幕网格工具(gridmove 和 nvidia 的 utils),但它们并不完全现实。
我有一个 winforms 应用程序,它在网络服务请求期间被锁定 我已经尝试使用 doEvents 来保持应用程序解锁,但它仍然不够响应, 我怎样才能绕过这个锁定,让应用程序始终响应? 最佳答案 最好
我是一名优秀的程序员,十分优秀!