2015-07-17 20:58:57 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI.Controls
|
|
|
|
|
{
|
2016-12-11 14:25:29 -05:00
|
|
|
|
public partial class ctrlTrackbar : BaseControl
|
2015-07-17 20:58:57 -04:00
|
|
|
|
{
|
|
|
|
|
public event EventHandler ValueChanged
|
|
|
|
|
{
|
|
|
|
|
add { trackBar.ValueChanged += value; }
|
|
|
|
|
remove { trackBar.ValueChanged -= value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ctrlTrackbar()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2016-12-17 15:46:13 -05:00
|
|
|
|
|
|
|
|
|
if(!Program.IsMono) {
|
|
|
|
|
this.trackBar.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
|
|
|
|
}
|
2015-07-17 20:58:57 -04:00
|
|
|
|
}
|
|
|
|
|
|
2017-04-15 13:54:47 -04:00
|
|
|
|
public int Minimum
|
|
|
|
|
{
|
|
|
|
|
get { return trackBar.Minimum; }
|
|
|
|
|
set { trackBar.Minimum = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-14 01:21:09 -05:00
|
|
|
|
public int Maximum
|
|
|
|
|
{
|
|
|
|
|
get { return trackBar.Maximum; }
|
|
|
|
|
set { trackBar.Maximum = value; }
|
|
|
|
|
}
|
2017-04-15 13:54:47 -04:00
|
|
|
|
|
2016-02-19 19:25:28 -05:00
|
|
|
|
[Bindable(true)]
|
|
|
|
|
[Browsable(true)]
|
|
|
|
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Always)]
|
2016-02-19 13:05:04 -05:00
|
|
|
|
public override string Text
|
2015-07-17 20:58:57 -04:00
|
|
|
|
{
|
|
|
|
|
get { return lblText.Text; }
|
|
|
|
|
set { lblText.Text = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Value
|
|
|
|
|
{
|
|
|
|
|
get { return trackBar.Value; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
trackBar.Value = value;
|
2017-04-15 13:54:47 -04:00
|
|
|
|
UpdateText();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void UpdateText()
|
|
|
|
|
{
|
|
|
|
|
if(this.Minimum == 0) {
|
2015-07-17 20:58:57 -04:00
|
|
|
|
txtValue.Text = trackBar.Value.ToString() + "%";
|
2017-04-15 13:54:47 -04:00
|
|
|
|
} else {
|
|
|
|
|
txtValue.Text = (trackBar.Value / 10.0).ToString() + "dB";
|
|
|
|
|
txtValue.Font = new Font("Microsoft Sans Serif", 6.75F);
|
2015-07-17 20:58:57 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void trackBar_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2017-04-15 13:54:47 -04:00
|
|
|
|
UpdateText();
|
2015-07-17 20:58:57 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|