WinForm 中 ISupportInitialize 的用处。

简介: WinForm 中 ISupportInitialize 的用处。

ISupportInitialize

使用 其BeginInit 和 EndInit 方法,防止控件在完全初始化之前被使用。


private void InitializeComponent()


{

((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();

((System.ComponentModel.ISupportInitialize)(this.trackBar3)).BeginInit();

this.SuspendLayout();

//

// trackBar1

//

this.trackBar1.Location = new System.Drawing.Point(160, 400);

this.trackBar1.Name = "trackBar1";

this.trackBar1.TabIndex = 1;

this.trackBar1.Scroll += new System.EventHandler(this.trackBar_Scroll);

//

// trackBar2

//

this.trackBar2.Location = new System.Drawing.Point(608, 40);

this.trackBar2.Name = "trackBar2";

this.trackBar2.TabIndex = 2;

this.trackBar2.Scroll += new System.EventHandler(this.trackBar_Scroll);

//

// trackBar3

//

this.trackBar3.Location = new System.Drawing.Point(56, 40);

this.trackBar3.Name = "trackBar3";

this.trackBar3.TabIndex = 3;

this.trackBar3.Scroll += new System.EventHandler(this.trackBar_Scroll);

((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();

((System.ComponentModel.ISupportInitialize)(this.trackBar3)).EndInit();



目录
相关文章
|
3月前
C#WinForm基础编程(二)
C#WinForm基础编程
62 0
|
3月前
|
C# 数据安全/隐私保护
C#WinForm基础编程(一)
C#WinForm基础编程
63 0
|
11月前
|
SQL 小程序 关系型数据库
使用C#写winform小程序入门
使用C#写winform小程序入门
128 0
|
C# 数据安全/隐私保护
C# 编写 WinForm 窗体应用程序(第三期)
文本框 (TextBox) 是在窗体中输入信息时最常用的控件,通过设置文本框属性可以实现多行文本框、密码框等。
C# 编写 WinForm 窗体应用程序(第三期)
WinForm操作隐藏的小知识点
WinForm操作隐藏的小知识点
170 0
WinForm操作隐藏的小知识点
|
C# 前端开发 设计模式
WPF设计界面不执行代码
原文:WPF设计界面不执行代码 一般在我们在设计WPF XAML界面时,XAML 引用一些后端的类。比如UserControl、Converter、MVVM,引用 xmlns:ALLUserControl="clr-namespace:程序集名.ALLUserControl;assembly=程序集名"。
1034 0
|
C# 算法
【WPF】SnapsToDevicePixels与UseLayoutRounding二者到底有什么区别?供参考
原文:【WPF】SnapsToDevicePixels与UseLayoutRounding二者到底有什么区别?供参考 MSDN上解释了一大堆,二者对比来看,并不能发现什么明显的区别,微软爸爸也不知道多给写图文实例。
1295 0
|
JavaScript 前端开发 C++
COM组件开发实践(七)---多线程ActiveX控件和自动调整ActiveX控件大小(上)
声明:本文代码基于CodeProject的文章《A Complete ActiveX Web Control Tutorial》修改而来,因此同样遵循Code Project Open License (CPOL)。
842 0