mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-29 11:34:07 +02:00
Add a NumericUpDown control with a text suffix
This commit is contained in:
parent
502310c413
commit
19a445fdab
@ -47,6 +47,12 @@ public static void SetValueInstant(this ProgressBar bar, int value){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetValueSafe(this NumericUpDown numUpDown, int value){
|
||||||
|
if (value >= numUpDown.Minimum && value <= numUpDown.Maximum){
|
||||||
|
numUpDown.Value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void SetValueSafe(this TrackBar trackBar, int value){
|
public static void SetValueSafe(this TrackBar trackBar, int value){
|
||||||
if (value >= trackBar.Minimum && value <= trackBar.Maximum){
|
if (value >= trackBar.Minimum && value <= trackBar.Maximum){
|
||||||
trackBar.Value = value;
|
trackBar.Value = value;
|
||||||
|
18
Core/Controls/NumericUpDownEx.cs
Normal file
18
Core/Controls/NumericUpDownEx.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Controls{
|
||||||
|
sealed class NumericUpDownEx : NumericUpDown{
|
||||||
|
public string TextSuffix { get; set ; }
|
||||||
|
|
||||||
|
protected override void UpdateEditText(){
|
||||||
|
base.UpdateEditText();
|
||||||
|
|
||||||
|
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime){
|
||||||
|
ChangingText = true;
|
||||||
|
Text += TextSuffix;
|
||||||
|
ChangingText = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -83,6 +83,9 @@
|
|||||||
<Compile Include="Core\Controls\LabelVertical.cs">
|
<Compile Include="Core\Controls\LabelVertical.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Core\Controls\NumericUpDownEx.cs">
|
||||||
|
<SubType>Component</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Core\Handling\BrowserProcessHandler.cs" />
|
<Compile Include="Core\Handling\BrowserProcessHandler.cs" />
|
||||||
<Compile Include="Core\Handling\ContextMenuBase.cs" />
|
<Compile Include="Core\Handling\ContextMenuBase.cs" />
|
||||||
<Compile Include="Core\Handling\ContextMenuBrowser.cs" />
|
<Compile Include="Core\Handling\ContextMenuBrowser.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user