- 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/
我找到了 this excellent question and answer它以 x/y(加上 center x/y 和 degrees/radians)开始并计算旋转- 到 x'/y'。这个计算很
全部: 我已经创建了一个 Windows 窗体和一个按钮。在另一个线程中,我试图更改按钮的文本,但它崩溃了;但是如果我尝试更改按钮的颜色,它肯定会成功。我认为如果您更改任何 Windows 窗体控件属
本网站的另一个问题已证实,C 中没有缩写的字面后缀,并且可以执行以下操作: short Number = (short)1; 但是转换它和不这样做有什么区别: short Number = 1; 您使
我有下表: ID (int) EMAIL (varchar(50)) CAMPAIGNID (int) isSubscribe (bit) isActionByUser (bit) 此表存储了用户对事
也就是说,无需触发Javascript事件即可改变的属性,如何保留我手动选中或取消选中的复选框的状态,然后复制到另一个地方? 运行下面的代码片段并选中或取消选中其中的一些,然后点击“复制”: $('#
我在网上找到的所有关于递增指针导致段错误的示例都涉及指针的取消引用 - 如果我只想递增它(例如在 for 循环的末尾)并且我不在乎它是否最终进入无效内存,因为我不会再使用它。例如,在这个程序中,每次迭
我有一个 Spring MVC REST 服务,它使用 XStream 将消息与 XML 相互转换。 有什么方法可以将请求和响应中的 xml(即正文)打印到普通的 log4j 记录器? 在 Contr
做我的任务有一个很大的挑战,那就是做相互依赖的任务我在这张照片中说的。假设我们有两个任务 A 和 B,执行子任务 A1、A2 和 B1、B2,假设任务 B 依赖于 A。 要理想地执行任务 B,您应该执
通过阅读该网站上的几个答案,我了解到 CoInitialize(Ex) should be called by the creator of a thread 。然后,在该线程中运行的任何代码都可以使
这个问题已经困扰我一段时间了。我以前从未真正使用过 ListViews,也没有使用过 FirebaseListAdapters。我想做的就是通过显示 id 和用户位置来启动列表的基础,但由于某种原因,
我很难解释这两个(看似简单)句子的含义: “受检异常由编译器在编译时检查” 这是什么意思?编译器检查是否捕获了所有已检查的异常(在代码中抛出)? “未经检查的异常在运行时检查,而不是编译时” 这句话中
我有一个包含排除子字符串的文本文件,我想迭代该文件以检查并返回不带排除子字符串的输入项。 这里我使用 python 2.4,因此下面的代码可以实现此目的,因为 with open 和 any 不起作用
Spring 的缓存框架能否了解请求上下文的身份验证状态,或者更容易推出自己的缓存解决方案? 最佳答案 尽管我发现这个用例 super 奇怪,但您可以为几乎任何与 SpEL 配合使用的内容设置缓存条件
我有以下函数模板: template HeldAs* duplicate(MostDerived *original, HeldAs *held) { // error checking omi
如果我的应用程序具有设备管理员/设备所有者权限(未获得 root 权限),我如何才能从我的应用程序中终止(或阻止启动)另一个应用程序? 最佳答案 设备所有者可以阻止应用程序: DevicePolicy
非常简单的问题,但我似乎无法让它正常工作。 我有一个组件,其中有一些 XSLT(用于导航)。它通过 XSLT TBB 使用 XSLT Mediator 发布。 发布后
我正在将一个对象拖动到一个可拖放的对象内,该对象也是可拖动的。放置对象后,它会嵌套在可放置对象内。同样,如果我将对象拖到可放置的外部,它就不再嵌套。 但是,如果我经常拖入和拖出可放置对象,则可拖动对象
我正在尝试为按钮和弹出窗口等多个指令实现“取消选择”功能。也就是说,我希望当用户单击不属于指令模板一部分的元素时触发我的函数。目前,我正在使用以下 JQuery 代码: $('body').click
我从 this question 得到了下面的代码,该脚本用于在 Google tasks 上更改 iframe[src="about:blank"] 内的 CSS使用 Chrome 扩展 Tempe
我有一些 @Mock 对象,但没有指定在该对象上调用方法的返回值。该方法返回 int (不是 Integer)。我很惊讶地发现 Mockito 没有抛出 NPE 并返回 0。这是预期的行为吗? 例如:
我是一名优秀的程序员,十分优秀!