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 事件之间的区别
基础教程推荐
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- WPF 模态进度窗口 2022-01-01
