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/TimeLine.cs

46 lines
1.6 KiB
C#
Raw Normal View History

2024-04-19 02:00:37 +00:00
using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CDSAE3_Lian_Lian_Kan.Forms
{
public partial class TimeLine : UserControl
{
public TimeLine()
{
InitializeComponent();
}
private Color _backColor = Color.FromArgb(0,0,0);
private Color _frontColor = Color.FromArgb(97, 97, 108);
public void set_progress(float progress, Color backColor, Color frontColor)
{
_backColor = backColor;
_frontColor = frontColor;
set_progress(progress);
}
public void set_progress(double progress)
{
SolidBrush upperBrush = new SolidBrush(_backColor);
SolidBrush lowerBrush = new SolidBrush(_frontColor);
SolidBrush pointBrush = new SolidBrush(Color.FromArgb(255, 255, 255));
Graphics formGraphics = CreateGraphics();
//formGraphics.SmoothingMode = SmoothingMode.HighQuality;
int wire = (int)(progress * Width);
formGraphics.FillRectangle(lowerBrush, new Rectangle(0, 0, wire, Height));
formGraphics.FillRectangle(pointBrush, new Rectangle(wire,0 , 4, Height));
formGraphics.FillRectangle(upperBrush, new Rectangle(wire + 4, 0, Width, Height));
upperBrush.Dispose();
lowerBrush.Dispose();
formGraphics.Dispose();
}
}
}