Version: 1.0.0
- Доступ к множеству событий формы и системы
- Взаимодействие с другими окнами
- Возможность блокировать нежелательное вмешательство в форму
- Работа как на современном .NET 10+, так и на устаревшем .NET 4.8
В отличии от многих других библиотек, WFoS не предоставляет никаких новых контролов, а лишь расширяет возможности самой формы. Используйте любые другие библиотеки контролов вместе с WFoS!
- Регистрация и обработка горячих клавиш
- Запрет скриншотов
- Продолжение работы без спящего режима \ выключения дисплея
- Получение данных о заряде и батарее
- Перетаскивание формы мышью
- Мигание иконкой на панели задач
- Принудительная активация окна на первый план
- Прогрессбар в иконке на панели задач
- Запрет перерисовки
- Прозрачность с альфа-ключом по цвету одновременно
- Включение возможностей Windows 10+ (акрилового блюра, тёмной темы для заголовка)
- Обмен текстовыми сообщениями между формами и окнами
- Запрет перетаскивания формы
- Реакция на системные события: изменение времени, настроек, подключение устройств и т.д.
- Проверка запуска от имени админа и перезапуск с ними
Для тех, кто:
- вынужден долго гуглить решение проблем через WinAPI, читать документацию и pinvoke
- по каким-то причинам не хочет или не может использовать WPF\Avalonia\MAUI\Uno
- работает на Windows 10+ и хочет использовать новые возможности
- Поставьте зависимость от библиотеки WFoS
- Унаследуйте формой класс
WFoS.ExtendedForm, вместоSystem.Windows.Form - Теперь вы можете использовать все возможности WFoS!
public partial class Form1 : ExtendedForm
{
protected override void OnHandleCreated(EventArgs e)
{
// ваши подписки на события
base.OnHandleCreated(e);
}
}Обратите внимание, что подписываться из конструктора НЕ нужно!
public partial class Form1 : ExtendedForm
{
protected override bool UseExtendedPaintEvents = true;
protected override void OnHandleCreated(EventArgs e)
{
this.PaintMessageReceived += (_, _) => Debug.WriteLine("WM_PAINT");
this.OnEraseBackground += (_, _) => Debug.WriteLine("WM_ERASEBKGND");
base.OnHandleCreated(e);
}
}События вроде WM_PAINT и WM_ERASEBKGND поступают слишком часто, поэтому их получение нужно предварительно активировать.
_ = Process.Start("calc");
Thread.Sleep(2000);
var calc = NativeWindowMethods.FindWindow("Калькулятор");
var rect = NativeWindowMethods.GetWindowRectangle(calc);
Debug.WriteLine(rect);Вместе с ExtendedForm в библиотеке вам доступны несколько классов-хелперов:
NativeWindowMethods- работа с окнамиNativeSystemMethods- работа с системойNativeDrawingMethods- работа с графикойNativeInputMethods- работа с вводомNativeTextBoxMethods- работа с текстовыми полями
Смотрите проекты
- Simple WFoS app (.NET 10+) - демонстрация всех событий
- Legacy WFoS app (.NET 4.8) - небольшая демонстрация запуска на фреймворке
Убедитесь в том, что вы подписались на событиями не из конструктора. Для специфических свойств нужно активировать свойства. Некоторые WM могут не приходить по не зависящим от библиотеки причинам.
- Access to a variety of form and system events
- Interaction with other windows
- The ability to block unwanted interference in the form
- Work like a modern one.NET 10+, and on legacy .NET 4.8
Unlike many other libraries, WFOs does not provide any new controls, but only expands the capabilities of the form itself. Use any other control libraries with WFOs!
- Registration and processing of hotkeys
- Prohibition of screenshots
- Continued operation without sleep mode / turning off the display
- Receiving data about the charge and battery
- Dragging the shape with the mouse
- Flashing of the icon on the taskbar
- Forced activation of the window to the foreground
- Progress bar in the icon on the taskbar
- Prohibition of redrawing
- Transparency with alpha key by color at the same time
- Enabling Windows 10+ features (acrylic blur, dark title theme)
- Text message exchange between forms and windows
- Prohibition of dragging the form
- Reaction to system events: changing time, settings, connecting devices, etc.
- Check the startup on behalf of the admin and restart with them
For those who:
- have to Google problem solving through WinAPI for a long time, read the documentation and pinvoke
- for some reason, he does not want or cannot use WPF\Avalonia\MAUI\Uno
- Works on Windows 10+ and wants to use new features
- Make a dependency on the WFOs library
- Inherit the form class
WFOs.ExtendedForm, instead ofSystem.Windows.Form - Now you can use all the features of WFOs!
public partial class Form1 : ExtendedForm
{
protected override void OnHandleCreated(EventArgs e)
{
// your event subscriptions
base.OnHandleCreated(e);
}
}Please note that you do NOT *** need to subscribe from the constructor!
public partial class Form1 : ExtendedForm
{
protected override bool UseExtendedPaintEvents = true;
protected override void OnHandleCreated(EventArgs e)
{
this.PaintMessageReceived += (_, _) => Debug.WriteLine("WM_PAINT");
this.OnEraseBackground += (_, _) => Debug.WriteLine("WM_ERASEBKGND");
base.OnHandleCreated(e);
}
}Events like WM_PAINT and WM_ERASEBKGND are received too often, so they must be activated beforehand.
_ = Process.Start("calc");
Thread.Sleep(2000);
var calc = NativeWindowMethods.FindWindow("Calculator");
var rect = NativeWindowMethods.GetWindowRectangle(calc);
Debug.WriteLine(rect);Along with the ExtendedForm, several helper classes are available in the library.:
NativeWindowMethods- working with windowsNativeSystemMethods- working with the systemNativeDrawingMethods- working with graphicsNativeInputMethods- working with inputNativeTextBoxMethods- working with text fields
See the projects
- Simple WFoS app (.NET 10+) - demonstration of all events
- Legacy WFOs app (.NET 4.8) - a small demo of running on the framework
Make sure that you have subscribed to events that are not from the constructor. For specific properties, you need to activate the properties. Some WMS may not arrive for reasons beyond the control of the library.