https://github.com/alexmollard/csx-forms
A WinForms utility script for csx files to build windowed applications.
https://github.com/alexmollard/csx-forms
csharp csx script winforms
Last synced: 7 months ago
JSON representation
A WinForms utility script for csx files to build windowed applications.
- Host: GitHub
- URL: https://github.com/alexmollard/csx-forms
- Owner: AlexMollard
- Created: 2025-02-19T03:03:31.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-02-19T03:46:14.000Z (12 months ago)
- Last Synced: 2025-02-19T04:21:51.688Z (12 months ago)
- Topics: csharp, csx, script, winforms
- Language: C#
- Homepage:
- Size: 1.96 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CSX-Forms
CSX-Forms is a WinForms utility script for CSX files to build windowed applications using C# scripting. It provides a set of utilities to create and manage Windows Forms with modern features like dark mode, rounded corners, and custom themes.
## Features
- **DPI Scaling**: Automatically scales forms based on the system DPI.
- **Dark Mode**: Automatically detects and applies dark mode based on the Windows theme.
- **Rounded Corners**: Enables rounded corners for Windows 10 and above.
- **Custom Themes**: Easily switch between light and dark themes with customizable colors.
- **Keyboard Shortcuts**: Add keyboard event handlers to forms.
- **WinForms Controls**: Use standard WinForms controls like buttons, labels, and textboxes.
## Getting Started
### Prerequisites
- .NET Framework
- [CSX](https://github.com/dotnet-script/dotnet-script) (C# scripting)
### Installation
1. Clone the repository:
```sh
git clone https://github.com/AlexMollard/CSX-Forms.git
cd CSX-Forms
```
2. Ensure you have the required dependencies:
```sh
dotnet tool install -g dotnet-script
```
### Usage
1. Create a new CSX script or use one of the examples provided in the `examples` directory.
2. Load the `Window.csx` script in your CSX file:
```csharp
#load "Window.csx"
```
3. Use the `WindowManager` class to create and manage your forms. For example:
```csharp
using System;
using System.Windows.Forms;
using System.Drawing;
WindowManager windowManager = new WindowManager();
Form form = new Form
{
Text = "My App",
Size = new Size(800, 600),
Font = new Font("Segoe UI", 16F),
Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath) // Set the window icon (optional)
};
windowManager.CreateForm(form); // All done here!
```
### Examples
- **Calculator Window**: A simple calculator application.
```sh
dotnet script examples/calculatorWindow.csx
```
- **Basic Window**: A basic window with a button and status strip.
```sh
dotnet script examples/basicWindow.csx
```
### Screenshots
