📄 searchsettings.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using LiveExpoService;
namespace LiveExpoApp
{
public partial class SearchSettings : Form
{
public SearchSettings()
{
InitializeComponent();
}
private void SearchSettings_Load(object sender, EventArgs e)
{
textBoxCity.Text = LiveExpoHelper.SearchCity;
textBoxZIP.Text = LiveExpoHelper.SearchZIP;
textBoxState.Text = LiveExpoHelper.SearchState;
textBoxCountry.Text = LiveExpoHelper.SearchCountry;
textBoxDistance.Text = LiveExpoHelper.SearchDistance.ToString("N0");
}
private void menuItemCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
this.Close();
}
private void menuItemOK_Click(object sender, EventArgs e)
{
LiveExpoHelper.SearchCity = textBoxCity.Text;
LiveExpoHelper.SearchZIP = textBoxZIP.Text;
LiveExpoHelper.SearchState = textBoxState.Text;
LiveExpoHelper.SearchCountry = textBoxCountry.Text;
LiveExpoHelper.SearchDistance = Convert.ToSingle(textBoxDistance.Text);
DialogResult = DialogResult.OK;
this.Close();
}
private void textBoxDistance_Validating(object sender, CancelEventArgs e)
{
float f = 0;
if (textBoxDistance.Text.Length != 0)
{
try
{
f = System.Convert.ToSingle(textBoxDistance.Text);
}
catch (System.OverflowException)
{
MessageBox.Show("Value too large!");
e.Cancel = true;
textBoxDistance.Select(0, textBoxDistance.Text.Length);
}
catch (System.FormatException)
{
MessageBox.Show("Enter a valid number");
e.Cancel = true;
textBoxDistance.Select(0, textBoxDistance.Text.Length);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -