mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-05 02:34:07 +02:00
Add a FlatProgressBar control
This commit is contained in:
parent
f81d332d8f
commit
496c1a91a3
31
Core/Controls/FlatProgressBar.Designer.cs
generated
Normal file
31
Core/Controls/FlatProgressBar.Designer.cs
generated
Normal file
@ -0,0 +1,31 @@
|
||||
namespace TweetDick.Core.Controls {
|
||||
partial class FlatProgressBar {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
35
Core/Controls/FlatProgressBar.cs
Normal file
35
Core/Controls/FlatProgressBar.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDick.Core.Controls{
|
||||
public partial class FlatProgressBar : ProgressBar{
|
||||
private SolidBrush brush;
|
||||
|
||||
public FlatProgressBar(){
|
||||
SetStyle(ControlStyles.UserPaint,true);
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer,true);
|
||||
}
|
||||
|
||||
public void SetValueInstant(int value){
|
||||
if (value == Maximum){
|
||||
Value = value;
|
||||
Value = value-1;
|
||||
Value = value;
|
||||
}
|
||||
else{
|
||||
Value = value+1;
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e){
|
||||
if (brush == null || brush.Color != ForeColor){
|
||||
brush = new SolidBrush(ForeColor);
|
||||
}
|
||||
|
||||
Rectangle rect = e.ClipRectangle;
|
||||
rect.Width = (int)(rect.Width*((double)Value/Maximum));
|
||||
e.Graphics.FillRectangle(brush,rect);
|
||||
}
|
||||
}
|
||||
}
|
@ -79,6 +79,12 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Configuration\UserConfig.cs" />
|
||||
<Compile Include="Core\Controls\FlatProgressBar.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Core\Controls\FlatProgressBar.Designer.cs">
|
||||
<DependentUpon>FlatProgressBar.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Core\Handling\ContextMenuHandler.cs" />
|
||||
<Compile Include="Core\FormBrowser.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
Loading…
Reference in New Issue
Block a user