1 Star 0 Fork 1

Future_Code_Lab/FloatingWindow

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
BGLabel.cs 925 Bytes
一键复制 编辑 原始数据 按行查看 历史
Future_Code_Lab 提交于 2020-06-30 10:43 +08:00 . 添加项目文件。

using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace FloatingWindow
{
public partial class BGLabel : Label
{
public bool BackColorVisible=true;
public bool BorderColorVisible=true;
public int Taget=70;
public int Value=00;
public BGLabel()
{
}
protected override void OnPaintBackground (PaintEventArgs e){
base.OnPaintBackground(e);
if(BackColorVisible){
if(Value>=Taget){
Brush brush=new SolidBrush(Color.Red);
int height=Height*Value/100;
e.Graphics.FillRectangle(brush,0,Height-height,Width,Height);
}else{
Brush brush=new SolidBrush(Color.Green);
int height=Height*Value/100;
e.Graphics.FillRectangle(brush,0,Height-height,Width,Height);
}
}
if(BorderColorVisible&&Value>=Taget){
Pen pen = new Pen(Color.Red,1);
e.Graphics.DrawRectangle(pen,0,0,Width-1,Height-1);
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/future_code_lab/FloatingWindow.git
git@gitee.com:future_code_lab/FloatingWindow.git
future_code_lab
FloatingWindow
FloatingWindow
originmaster

搜索帮助