Commit 933feca2 authored by tsuji's avatar tsuji

NumericUpDownメニューをFormから参照したメニューに修正

parent eb78f75a
......@@ -46,6 +46,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
......@@ -58,6 +59,7 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
......
This diff is collapsed.
......@@ -32,46 +32,6 @@ namespace CSRender
public MainWindow()
{
InitializeComponent();
//解像度選択UpDownバーの設定
this.Title = this.ToString();
ResolutionBox.MouseWheel += NumericTextBox_MouseWheel;
ResolutionBox.GotFocus += NumericTextBox_GotFocusSelectAll;
ResolutionBox.TextChanged += NumericTextBox_TextChanged;
ResolutionBox.TextChanged += NumericTextBox_NumChanged;
NumericScroll1.MouseWheel += NumericScroll1_MouseWheel;
//位置ズレ許容量選択UpDownバーの設定
this.Title = this.ToString();
PositionBox.MouseWheel += NumericTextBox_MouseWheel;
PositionBox.GotFocus += NumericTextBox_GotFocusSelectAll;
PositionBox.TextChanged += NumericTextBox_TextChanged;
PositionBox.TextChanged += PosiTextBox_NumChanged;
PosiScroll1.MouseWheel += PosiScroll1_MouseWheel;
//諧調差許容量選択UpDownバーの設定
this.Title = this.ToString();
GradationBox.MouseWheel += NumericTextBox_MouseWheel;
GradationBox.GotFocus += NumericTextBox_GotFocusSelectAll;
GradationBox.TextChanged += NumericTextBox_TextChanged;
GradationBox.TextChanged += GradTextBox_NumChanged;
GradScroll.MouseWheel += GradScroll_MouseWheel;
//微小誤差許容量選択UpDownバーの設定
this.Title = this.ToString();
SmallDiffBox.MouseWheel += NumericTextBox_MouseWheel;
SmallDiffBox.GotFocus += NumericTextBox_GotFocusSelectAll;
SmallDiffBox.TextChanged += NumericTextBox_TextChanged;
SmallDiffBox.TextChanged += SmallDiffTextBox_NumChanged;
SmallDiffScroll.MouseWheel += SmallDiffScroll_MouseWheel;
//視覚的あいまい量選択UpDownバーの設定
this.Title = this.ToString();
VisualBox.MouseWheel += NumericTextBox_MouseWheel;
VisualBox.GotFocus += NumericTextBox_GotFocusSelectAll;
VisualBox.TextChanged += NumericTextBox_TextChanged;
VisualBox.TextChanged += VisualTextBox_NumChanged;
VisualScroll.MouseWheel += VisualScroll_MouseWheel;
//ページ入力メニューの設定
PagePattern.Add((new ComboBoxSet { Id = 1, Item = "全ページ"}));
......
......@@ -20,181 +20,5 @@ namespace CSRender
public partial class MainWindow : Window
{
////////////////////////////////////////////////////////////////////////////
// 解像度のUpDownメニュー機能の記述
////////////////////////////////////////////////////////////////////////////
//TextBoxフォーカス時にテキスト全選択
private void NumericTextBox_GotFocusSelectAll(object sender, RoutedEventArgs e)
{
TextBox ResolutionBox = (TextBox)sender;
//box.SelectAll();
this.Dispatcher.InvokeAsync(() => { Task.Delay(10); ResolutionBox.SelectAll(); });
}
//正規表現で数値以外は削除using System.Text.RegularExpressions;
private void NumericTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
TextBox ResolutionBox = (TextBox)sender;
double d;
if (!double.TryParse(ResolutionBox.Text, out d))
{
ResolutionBox.Text = Regex.Replace(ResolutionBox.Text, "[^0-9-]", "");
}
}
//数字の下限;
private void NumericTextBox_NumChanged(object sender, TextChangedEventArgs e)
{
TextBox ResolutionBox = (TextBox)sender;
if (ResolutionBox.Text == "")
{
ResolutionBox.Text = "72";
}
NumericScroll1.Value = Int32.Parse(ResolutionBox.Text);
}
//TextBox上でマウスホイールを回転させた時にスクロールバーの値を上下させる
private void NumericTextBox_MouseWheel(object sender, MouseWheelEventArgs e)
{
TextBox ResolutionBox = (TextBox)sender;
Binding binding = BindingOperations.GetBinding(ResolutionBox, TextBox.TextProperty);
ScrollBar NumericScroll1 = (ScrollBar)this.FindName(binding.ElementName);//名前から取得
NumericScroll1.Value = Int32.Parse(ResolutionBox.Text);
if (e.Delta > 0)
{
NumericScroll1.Value++;
}
else
{
NumericScroll1.Value--;
}
}
//ScrollBar上でマウスホイールを回転させた時にScrollBarの値を上下させる
private void NumericScroll1_MouseWheel(object sender, MouseWheelEventArgs e)
{
ScrollBar NumericScroll1 = (ScrollBar)sender;
NumericScroll1.Value = Int32.Parse(ResolutionBox.Text);
if (e.Delta > 0)
{
NumericScroll1.Value++;
}
else
{
NumericScroll1.Value--;
}
}
////////////////////////////////////////////////////////////////////////////
// 位置ズレ許容量のUpDownメニュー機能の記述
////////////////////////////////////////////////////////////////////////////
//数字の下限;
private void PosiTextBox_NumChanged(object sender, TextChangedEventArgs e)
{
TextBox PositionBox = (TextBox)sender;
if (PositionBox.Text == "")
{
PositionBox.Text = "2";
}
PosiScroll1.Value = Int32.Parse(PositionBox.Text);
}
//ScrollBar上でマウスホイールを回転させた時にScrollBarの値を上下させる
private void PosiScroll1_MouseWheel(object sender, MouseWheelEventArgs e)
{
ScrollBar PosiScroll1 = (ScrollBar)sender;
PosiScroll1.Value = Int32.Parse(PositionBox.Text);
if (e.Delta > 0)
{
PosiScroll1.Value++;
}
else
{
PosiScroll1.Value--;
}
}
////////////////////////////////////////////////////////////////////////////
// 諧調差許容量のUpDownメニュー機能の記述
////////////////////////////////////////////////////////////////////////////
//数字の下限;
private void GradTextBox_NumChanged(object sender, TextChangedEventArgs e)
{
TextBox GradationBox = (TextBox)sender;
if (GradationBox.Text == "")
{
GradationBox.Text = "60";
}
GradScroll.Value = Int32.Parse(GradationBox.Text);
}
//ScrollBar上でマウスホイールを回転させた時にScrollBarの値を上下させる
private void GradScroll_MouseWheel(object sender, MouseWheelEventArgs e)
{
ScrollBar GradScroll = (ScrollBar)sender;
GradScroll.Value = Int32.Parse(GradationBox.Text);
if (e.Delta > 0)
{
GradScroll.Value++;
}
else
{
GradScroll.Value--;
}
}
////////////////////////////////////////////////////////////////////////////
// 微小差異許容量のUpDownメニュー機能の記述
////////////////////////////////////////////////////////////////////////////
//数字の下限;
private void SmallDiffTextBox_NumChanged(object sender, TextChangedEventArgs e)
{
TextBox SmallDiffBox = (TextBox)sender;
if (SmallDiffBox.Text == "")
{
SmallDiffBox.Text = "60";
}
SmallDiffScroll.Value = Int32.Parse(SmallDiffBox.Text);
}
//ScrollBar上でマウスホイールを回転させた時にScrollBarの値を上下させる
private void SmallDiffScroll_MouseWheel(object sender, MouseWheelEventArgs e)
{
ScrollBar SmallDiffScroll = (ScrollBar)sender;
SmallDiffScroll.Value = Int32.Parse(SmallDiffBox.Text);
if (e.Delta > 0)
{
SmallDiffScroll.Value++;
}
else
{
SmallDiffScroll.Value--;
}
}
////////////////////////////////////////////////////////////////////////////
// 視覚的あいまい量のUpDownメニュー機能の記述
////////////////////////////////////////////////////////////////////////////
//数字の下限;
private void VisualTextBox_NumChanged(object sender, TextChangedEventArgs e)
{
TextBox VisualBox = (TextBox)sender;
if (VisualBox.Text == "")
{
VisualBox.Text = "60";
}
VisualScroll.Value = Int32.Parse(VisualBox.Text);
}
//ScrollBar上でマウスホイールを回転させた時にScrollBarの値を上下させる
private void VisualScroll_MouseWheel(object sender, MouseWheelEventArgs e)
{
ScrollBar VisualScroll = (ScrollBar)sender;
VisualScroll.Value = Int32.Parse(VisualBox.Text);
if (e.Delta > 0)
{
VisualScroll.Value++;
}
else
{
VisualScroll.Value--;
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment