Difference between Resize and SizeChanged events(Resize 和 SizeChanged 事件之间的区别)
问题描述
在 Winforms 中的 C# .Net 中,我在几乎所有组件中都发现了两个事件,Resize() 和 SizeChanged().它们之间有什么区别吗?如果两个事件相同,那为什么 C# 提供了两个不同的事件?
In C# .Net in Winforms, I found two events in almost all components, Resize() and SizeChanged(). Is there any difference between them? If both events are the same then why has C# provided two different events?
我正在用 C# 创建一个用户控件.此控件包含一个文本框.当用户更改控件的大小时,我想调整文本框的大小.我不知道应该使用哪个事件以及为什么?
I am creating a user control in C#. This control contains a text box. I want to resize the textbox when the user changes the control's size. I am confused about which event I should use and why?
推荐答案
Resize 事件发生在控件调整大小时,
SizeChanged
事件发生在>尺寸
属性变化.
The Resize
event occurs when the control is resized, while the SizeChanged
event occurs when the Size
property changes.
您可以使用任何一种,因为调整大小会导致 Size
属性发生变化.但是,您应该按照 Layout 事件.forms.control.resize.aspx" rel="noreferrer">调整大小 和 SizeChanged 事件.
You could use either, as a resize will cause the Size
property to change. However, you should rather use the Layout
event, as recommended both in the documentation for the Resize and SizeChanged events.
这篇关于Resize 和 SizeChanged 事件之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Resize 和 SizeChanged 事件之间的区别


基础教程推荐
- 全局 ASAX - 获取服务器名称 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01