YMath/Demo/AngleBar.cs

40 lines
920 B
C#
Raw Normal View History

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 Demo
{
public partial class AngleBar : UserControl
{
public AngleBar()
{
InitializeComponent();
}
public double Angle
{
get => trackBar1.Value / 180.0 * Math.PI;
set => numericUpDown1.Value = (decimal)((value % (Math.PI*2)) / Math.PI * 180);
}
public bool Checked => checkBox1.Checked;
private void trackBar1_Scroll(object sender, EventArgs e)
{
numericUpDown1.Value = trackBar1.Value;
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
trackBar1.Value = (int)numericUpDown1.Value;
}
}
}