i am not able to figure this error out:
"SizeChangedEventArgs could not be found are you missing a using directive…"
Here my setup and code:
-
using visual studio 2019
-
Csharp
-
Build .Net Framework 4.8
-
using System.Windows
private void Form1_SizeChanged(object sender, SizeChangedEventArgs e) { // Retrieve the old size from the event arguments var newSize = ((Form)sender).Size; var oldWidth = e.PreviousSize.Width; var oldHeight = e.PreviousSize.Height; var oldSize = new Size(oldWidth, oldHeight); // Do something with the old size Console.WriteLine("Old size: {0}", oldSize); }
2
Answers
Thanks to your responses, it seems i have to go educate myself about forms...So i am using winforms but not WPF.. from what i gathered from initial reading.
below is just for the record on how i solved my immediate problem.
-Calling the form:
Form Class:
Form Resize handler declaration:
Resize Event handlers definition:
For WinForms, the
SizeChanged
event gets written like this on my system: