Command Palette

Search for a command to run...

Назад к скиллам
скилл № 13003

desktop-winforms

Use when the user asks about Windows Forms (WinForms), WinForms controls and designer, GDI+ drawing, high-DPI in WinForms, data binding or migrating .NET…

БесплатноБез исполняемых скриптов
j4flmaoот j4flmao★ 47 звёзд на GitHub

Установить desktop-winforms в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Windows Forms (WinForms)

Purpose

Build and maintain Windows desktop applications using Windows Forms — .NET's mature, rapid-application-development UI framework with designer-driven development, rich control set, and direct GDI+ drawing capabilities.

Agent Protocol

Trigger

Exact user phrases: "WinForms", "Windows Forms", "Windows Forms app", "winforms", "Form designer", "GDI+", "System.Windows.Forms", "WinForms designer", "Button Click", "DataGridView".

Input Context

  • .NET version (modern .NET 8+ LTS, or .NET Framework 4.8.x for legacy)
  • Visual Studio version (2022 recommended)
  • App type (line-of-business, data-entry, utility, legacy migration)
  • UI control needs (DataGridView, ListView, TreeView, custom painting, charts)
  • Data source (SQL Server, Entity Framework, XML, JSON, web service)
  • Deployment (ClickOnce, MSI, XCOPY, MSIX)

Output Artifact

WinForms application architecture with form hierarchy, event wiring, data binding, and custom drawing strategy.

Response Format

Target: {.NET version}  Layout: {TableLayoutPanel/FlowLayoutPanel, DPI mode}
Data: {BindingSource -> DataGridView columns}
Async: {async event handlers, IProgress, CancellationToken}
Validation: {ErrorProvider rules}
Code: {files}

Completion Criteria

  • Form hierarchy designed (MDI parent, child forms, dialog forms)
  • Control layout strategy (TableLayoutPanel, FlowLayoutPanel, anchors/docks)
  • Event wiring pattern established (designer vs programmatic)
  • Data binding configuration (BindingSource, BindingNavigator, DataGridView)
  • Data access layer defined (Entity Framework, ADO.NET, Dapper)
  • Custom painting implemented (if needed: OnPaint, GDI+)
  • Validation strategy (ErrorProvider, Validating event, CausesValidation)
  • UI threading (Control.Invoke, BackgroundWorker, async/await)
  • Application settings (Settings.settings, .config file)
  • Deployment method selected (ClickOnce, MSI, MSIX)

Max Response Length

250 lines.

Framework/Methodology

WinForms Architecture Decision Tree

What is the app complexity?
├── Simple data entry (CRUD, forms-over-data)
│   → Data-bound controls with BindingSource
│   → TableLayoutPanel for layout, ErrorProvider for validation
├── Moderate complexity (multi-form, reports, printing)
│   → MDI parent with child forms
│   → DataSet/DataTable for offline data, PrintDocument for reports
├── Complex LOB (dashboards, charts, real-time updates)
│   → Custom user controls, UserControl composition
│   → BackgroundWorker for async, Chart control or custom GDI+
└── Legacy migration target (modernizing WinForms)
    → Gradual migration to WinUI 3 via hosting
    → WebView2 for modern UI sections

WinForms Event-Driven Architecture

User Action (Click, KeyPress, TextChanged)
   ↓
Event Handler (Form_ButtonClick, TextBox_TextChanged)
   ↓
Business Logic Layer (validate, process, save)
   ↓
Data Access Layer (Entity Framework, ADO.NET, Dapper)
   ↓
UI Update (data binding refresh, status bar, validation results)

Workflow

Step 1: Set Up .NET WinForms Project

// Program.cs (.NET 6+ with top-level statements)
using MyApp;
using MyApp.Data;

ApplicationConfiguration.Initialize();
Application.Run(new MainForm());
// MainForm.cs
public partial class MainForm : Form
{
    private readonly IDataService _dataService;
    private readonly BindingSource _itemsBindingSource = new();

    public MainForm()
    {
        InitializeComponent();
        _dataService = new DataService();
        SetupDataBinding();
        SetupEventHandlers();
    }

    private void SetupDataBinding()
    {
        _itemsBindingSource.DataSource = typeof(List<Item>);
        dataGridView1.DataSource = _itemsBindingSource;
        bindingNavigator1.BindingSource = _itemsBindingSource;
    }

    private async void SetupEventHandlers()
    {
        Load += async (s, e) => await LoadDataAsync();
        saveButton.Click += SaveButton_Click;
    }

    private async Task LoadDataAsync()
    {
        var items = await _dataService.GetItemsAsync();
        _itemsBindingSource.DataSource = items;
    }
}

Step 2: Layout Management

// TableLayoutPanel for form layout
private void InitializeComponent()
{
    var mainLayout = new TableLayoutPanel
    {
        Dock = DockStyle.Fill,
        ColumnCount = 2,
        RowCount = 3,
        Padding = new Padding(12),
        CellBorderStyle = TableLayoutPanelCellBorderStyle.None
    };

    mainLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 30F));
    mainLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 70F));

    // Labels column (col 0)
    mainLayout.Controls.Add(new Label { Text = "Name:", TextAlign = ContentAlignment.MiddleRight }, 0, 0);
    mainLayout.Controls.Add(new Label { Text = "Description:", TextAlign = ContentAlignment.MiddleRight }, 0, 1);

    // Inputs column (col 1)
    var nameTextBox = new TextBox { Dock = Doc
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/winforms-advanced.md
  • references/winforms-architecture.md
  • references/winforms-controls.md
  • references/winforms-fundamentals.md
  • references/winforms-modernization.md
  • references/winforms-setup.md

FAQ

Что делает скилл desktop-winforms?

Use when the user asks about Windows Forms (WinForms), WinForms controls and designer, GDI+ drawing, high-DPI in WinForms, data binding or migrating .NET Framework WinForms to modern .NET. Produces WinForms app code and migration steps. Not for XAML apps (use desktop-wpf) or UWP/WinUI (use desktop-uwp).

Как установить скилл desktop-winforms?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл desktop-winforms запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить desktop-winforms с