- runtime:仿真 WinForms 子集(Form、Button、Label、TextBox、ComboBox、 GroupBox、Timer、MessageBox、界面线程消息循环、跨线程检查)、 教材设备类库(DeviceCtrlHelper、LED 控件)、运行器(常驻编译服务 + 运行模式) - server:Bun + Hono,WebSocket 会话,每次运行一个进程,消息转发 - web:Vue + Naive UI,WinForms 风格窗体渲染、MessageBox、实训台 LED 屏 - 端到端测试与 100 个程序并发的压力测试 - 教材逐任务摘要(docs/教材摘要) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
1.4 KiB
C#
62 lines
1.4 KiB
C#
using System.Drawing;
|
|
using System.Text.Json.Nodes;
|
|
|
|
namespace System.Windows.Forms;
|
|
|
|
public class ScrollableControl : Control
|
|
{
|
|
public bool AutoScroll { get; set; }
|
|
}
|
|
|
|
public class ContainerControl : ScrollableControl
|
|
{
|
|
public SizeF AutoScaleDimensions { get; set; }
|
|
public AutoScaleMode AutoScaleMode { get; set; } = AutoScaleMode.Inherit;
|
|
public Control? ActiveControl { get; set; }
|
|
}
|
|
|
|
public class UserControl : ContainerControl
|
|
{
|
|
protected override Size DefaultSize => new(150, 150);
|
|
|
|
public event EventHandler? Load;
|
|
|
|
protected virtual void OnLoad(EventArgs e) => Load?.Invoke(this, e);
|
|
|
|
private bool _loaded;
|
|
|
|
/// <summary>UserControl 的 Load 在第一次随窗体显示时触发</summary>
|
|
internal void RaiseLoadOnce()
|
|
{
|
|
if (_loaded) return;
|
|
_loaded = true;
|
|
OnLoad(EventArgs.Empty);
|
|
}
|
|
}
|
|
|
|
public class Panel : ScrollableControl
|
|
{
|
|
private BorderStyle _borderStyle;
|
|
|
|
protected override Size DefaultSize => new(200, 100);
|
|
|
|
public BorderStyle BorderStyle
|
|
{
|
|
get => _borderStyle;
|
|
set => SetProp(ref _borderStyle, value, nameof(BorderStyle));
|
|
}
|
|
|
|
protected override void WriteProps(JsonObject props)
|
|
{
|
|
base.WriteProps(props);
|
|
props["BorderStyle"] = _borderStyle.ToString();
|
|
}
|
|
}
|
|
|
|
public class GroupBox : Control
|
|
{
|
|
protected override Size DefaultSize => new(200, 100);
|
|
|
|
public FlatStyle FlatStyle { get; set; } = FlatStyle.Standard;
|
|
}
|