【WinForm UI控件系列】Blower 鼓风机控件

前言:c# winform UI控件系列,做不到最好用,但愿是更好用!

一、效果图 (七种样式)

支持叶片数3-5-7,支持顺时针、逆时针旋转,支持流动动画,支持铭牌...

二、使用说明

Blower 鼓风机控件

控件名称

Blower

中文名称

鼓风机控件

控件优点

Blower 是一个鼓风机/风机控件,支持多种朝向、叶轮旋转动画和颜色自定义。适用于工业通风系统、风机控制等场景。

主要特性

  • 多种朝向:支持双口朝左、双口朝右、双口朝上、左进右出、右进左出、左进上出、右进上出
  • 叶轮旋转:支持叶轮旋转动画效果
  • 叶片数量:支持3、5、7叶片设置
  • 颜色自定义:支持机身、叶轮、管道等颜色设置
  • 旋转方向:支持顺时针和逆时针旋转

重要参数说明

基本属性

属性名 类型 默认值 说明
Direction BlowerDirection DoubleLeft 鼓风机朝向
BladeCount BladeCountEnum Five 叶轮叶片数量
RotationDirection RotationDirection Clockwise 旋转方向
IsRunning bool false 是否运行
AnimationSpeed int 5 动画速度

鼓风机朝向(BlowerDirection)

朝向值 说明
DoubleLeft 双口朝左
DoubleRight 双口朝右
DoubleUp 双口朝上
LeftInRightOut 左进右出
RightInLeftOut 右进左出
LeftInUpOut 左进上出
RightInUpOut 右进上出

叶片数量(BladeCountEnum)

数量值 说明
Three 3叶片
Five 5叶片
Seven 7叶片

外观属性

属性名 类型 默认值 说明
BodyColor Color 220, 80, 60 机身颜色
BladeColor Color 255, 128, 0 叶轮颜色
PipeColor Color 255, 128, 0 管道颜色
BaseColor Color Gray 底座颜色
FixtureColor Color 100, 100, 100 固定架颜色
BodyBorderColor Color 255, 128, 0 机身边框颜色
BodyBorderWidth int 5 机身边框宽度
PipeDiameter int 0 管道直径(0自动计算)
Text string "" 固定架显示文本
TextColor Color Silver 文本颜色

重要事件

事件名 说明
StateChanged 状态改变时触发
PropertyChanged 属性值改变时触发

使用示例

基本使用

csharp 复制代码
// 创建鼓风机控件
Blower blower = new Blower();
blower.Size = new Size(150, 100);
this.Controls.Add(blower);

// 状态改变事件
blower.StateChanged += (sender, e) =>
{
    Console.WriteLine($"鼓风机状态:{(blower.IsRunning ? "运行" : "停止")}");
};

运行控制

csharp 复制代码
// 开始运行
blower.IsRunning = true;

// 停止运行
blower.IsRunning = false;

朝向设置

csharp 复制代码
// 设置朝向
blower.Direction = Blower.BlowerDirection.DoubleLeft;
blower.Direction = Blower.BlowerDirection.DoubleRight;
blower.Direction = Blower.BlowerDirection.LeftInRightOut;

叶片设置

csharp 复制代码
// 设置叶片数量
blower.BladeCount = Blower.BladeCountEnum.Three;
blower.BladeCount = Blower.BladeCountEnum.Five;
blower.BladeCount = Blower.BladeCountEnum.Seven;

旋转方向

csharp 复制代码
// 设置旋转方向
blower.RotationDirection = Blower.RotationDirection.Clockwise;
blower.RotationDirection = Blower.RotationDirection.CounterClockwise;

颜色自定义

csharp 复制代码
// 设置颜色
blower.BodyColor = Color.FromArgb(220, 80, 60);
blower.BladeColor = Color.FromArgb(255, 128, 0);
blower.PipeColor = Color.FromArgb(255, 128, 0);
blower.BaseColor = Color.Gray;

文本设置

csharp 复制代码
// 设置固定架文本
blower.Text = "1号风机";
blower.TextColor = Color.Silver;

注意事项

  1. 朝向选择:Direction 支持多种进出风方向组合
  2. 叶片数量:BladeCount 只能是 Three、Five 或 Seven
  3. 动画速度:AnimationSpeed 值越大旋转越快
  4. 运行状态:IsRunning 控制叶轮旋转动画的启停

三、后记

陆续补充完善中,如有需求,有好的建议,请留言(xue5zhijing)

相关推荐
久爱物联网3 小时前
【WinForm UI控件系列】Battery 电池电量控件
ui·winformui控件·桌面应用控件·c#控件ui·ui控件gdi
ZC跨境爬虫3 小时前
UI前端美化技能提升日志day5:从布局优化到CSS继承原理深度解析
前端·css·ui·html·状态模式
久爱物联网3 小时前
【WinForm UI控件系列】AlarmLight 报警灯\声光报警灯控件
ui·winformui控件·桌面应用控件·c# ui控件·gdi控件 net控件
Wenzar_4 小时前
# 发散创新:SwiftUI 中状态管理的深度实践与重构艺术 在 SwiftUI 的世界里,**状态驱动 UI 是核心哲学**。但随
java·python·ui·重构·swiftui
Ulyanov4 小时前
《PySide6 GUI开发指南:QML核心与实践》 第五篇:Python与QML深度融合——数据绑定与交互
开发语言·python·qt·ui·交互·雷达电子战系统仿真
Ulyanov21 小时前
《玩转QT Designer Studio:从设计到实战》 QT Designer Studio组件化开发与UI组件库构建
开发语言·python·qt·ui·雷达电子战系统仿真
鼎道开发者联盟1 天前
鼎享会 | OpenClaw Control UI 前端架构全解析:自研 UI 对接 Server 实操指南
前端·ui·架构·openclaw·control ui
星河耀银海1 天前
Unity基础:UI组件详解:Toggle开关的状态控制
ui·unity·lucene
ZC跨境爬虫1 天前
UI前端美化技能提升日志day1:矢量图片规范与自适应控制栏实战
前端·css·ui·状态模式