This repository has been archived on 2024-06-21. You can view files and clone it, but cannot push or open issues or pull requests.
CDSAE3/CDSAE3_Lian_Lian_Kan/Forms/middle_parent.cs

41 lines
1.3 KiB
C#
Raw Normal View History

2024-04-08 13:04:47 +00:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CDSAE3_Lian_Lian_Kan.Forms
{
public partial class middle_parent : UserControl
{
public middle_parent()
{
InitializeComponent();
}
private Color _backColor = Etcs.def_Color;
private Color _frontColor = Etcs.mouse_upper_color;
public void set_progress(float progress, Color backColor, Color frontColor)
{
_backColor = backColor;
_frontColor = frontColor;
set_progress(progress);
}
public void set_progress(float progress)
{
SolidBrush upperBrush = new SolidBrush(_backColor);
SolidBrush lowerBrush = new SolidBrush(_frontColor);
Graphics formGraphics = CreateGraphics();
int wire = (int)((1-progress) * 40);
formGraphics.FillRectangle(upperBrush, new Rectangle(0, 0, 40, wire));
formGraphics.FillRectangle(lowerBrush, new Rectangle(0, wire, 40, 40));
upperBrush.Dispose();
lowerBrush.Dispose();
formGraphics.Dispose();
}
}
}