本文整理汇总了C#中System.Windows.Forms.PreviewKeyDownEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# PreviewKeyDownEventArgs类的具体用法?C# PreviewKeyDownEventArgs怎么用?C# PreviewKeyDownEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PreviewKeyDownEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了PreviewKeyDownEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: txtModelID_PreviewKeyDown
private void txtModelID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (string.IsNullOrEmpty(txtModelID.Text))
{
Ultils.TextControlNotNull(txtModelID, "Model");
}
else
{
var model = _modelService.GetModelByName(txtModelID.Text, FujiXerox);
if(model != null)
{
Ultils.SetColorErrorTextControl(txtModelID, "Model này đã được tạo rồi. Vui lòng kiểm tra lại!");
}
else
{
txtQuantity.Focus();
}
}
}
if (e.KeyCode == Keys.Tab)
{
if (string.IsNullOrEmpty(txtModelID.Text))
{
Ultils.TextControlNotNull(txtModelID, "Model");
}
}
}
示例2: CurrentSelected_PreviewKeyDown
private void CurrentSelected_PreviewKeyDown(object TaggerObject, PreviewKeyDownEventArgs e) {
e.IsInputKey = true;
Tagger SelectedObject = (Tagger)TaggerObject, SwappingObject;
int AlphaIndex, BetaIndex;
if (e.KeyCode == Keys.Left) {
AlphaIndex = StringCollection.Controls.GetChildIndex(CurrentSelected);
BetaIndex = AlphaIndex - 1;
if (AlphaIndex > 0) {
SwappingObject = (Tagger)StringCollection.Controls[BetaIndex];
StringCollection.Controls.SetChildIndex(SelectedObject, BetaIndex);
StringCollection.Controls.SetChildIndex(SwappingObject, AlphaIndex);
Tuple<int, string> TempTuple = TagGroupList[AlphaIndex];
TagGroupList[AlphaIndex] = TagGroupList[BetaIndex];
TagGroupList[BetaIndex] = TempTuple;
}
}
if (e.KeyCode == Keys.Right) {
AlphaIndex = StringCollection.Controls.GetChildIndex(CurrentSelected);
BetaIndex = AlphaIndex + 1;
if (AlphaIndex < count - 1) {
SwappingObject = (Tagger)StringCollection.Controls[BetaIndex];
StringCollection.Controls.SetChildIndex(SelectedObject, BetaIndex);
StringCollection.Controls.SetChildIndex(SwappingObject, AlphaIndex);
Tuple<int, string> TempTuple = TagGroupList[AlphaIndex];
TagGroupList[AlphaIndex] = TagGroupList[BetaIndex];
TagGroupList[BetaIndex] = TempTuple;
}
}
CurrentSelected.Focus();
}
示例3: Form1_PreviewKeyDown
private void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
LoginProccess();
}
}
示例4: txtJudge_PreviewKeyDown
private void txtJudge_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (string.IsNullOrEmpty(txtJudge.Text))
{
SetErrorStatus(true, "NG", "Judge không được để trống!");
Ultils.EditTextErrorNoMessage(txtJudge);
}
else
{
if (txtJudge.Text.Trim() == "1" || txtJudge.Text.Trim() == "0")
{
SetErrorStatus(false, null, null);
InsertLog(txtBoxID.Text);
}
else
{
SetErrorStatus(true, "NG", "Judge Error!\nKhông đúng định dạng.\nVui lòng thử lại!\nChỉ chấp nhận giá trị: 1 hoặc 0 ");
txtJudge.SelectAll();
Ultils.EditTextErrorNoMessage(txtJudge);
}
}
}
if (e.KeyCode == Keys.Tab)
{
if (string.IsNullOrEmpty(txtJudge.Text))
{
SetErrorStatus(true, "NG", "Judge không được để trống!");
Ultils.EditTextErrorNoMessage(txtJudge);
}
}
}
示例5: webBrowser_PreviewKeyDown
private void webBrowser_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Back)
{
key = Keys.Back;
}
}
开发者ID:Warrenn,项目名称:WebApp-MultiTenant-OpenIdConnect-DotNet,代码行数:7,代码来源:WindowsFormsWebAuthenticationDialogBase.cs
示例6: GraphicsDeviceControl_PreviewKeyDown
void GraphicsDeviceControl_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
{
e.IsInputKey = true;
}
}
示例7: OnAddressEditPreviewKeyDown
private void OnAddressEditPreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
OnGo(EventArgs.Empty);
}
}
示例8: axShockwaveFlash1_PreviewKeyDown
private void axShockwaveFlash1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.Control && e.KeyCode == Keys.V)
{
PlayNewChannel();
}
}
示例9: txtOperatorCode_PreviewKeyDown
private void txtOperatorCode_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (string.IsNullOrEmpty(txtOperatorCode.Text))
{
Ultils.TextControlNotNull(txtOperatorCode, "Operator code");
}
else
{
gridLookUpEditModelID.Focus();
}
}
if (e.KeyCode == Keys.Tab)
{
if (string.IsNullOrEmpty(txtOperatorCode.Text))
{
Ultils.TextControlNotNull(txtOperatorCode, "Operator code");
}
else
{
gridLookUpEditModelID.Enabled = true;
}
}
}
示例10: txtBoxID_PreviewKeyDown
private void txtBoxID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab)
{
if (string.IsNullOrEmpty(txtBoxID.Text))
{
SetErrorStatus("NG", "Box ID không được để trống!");
Ultils.EditTextErrorNoMessage(txtBoxID);
}
else
{
string strBoxId = txtBoxID.Text;
if (strBoxId.Length >= 3)
{
if (strBoxId.Substring(0, 3).ToUpper() != "F00")
{
SetErrorStatus("NG", "BOX ID phải bắt đầu bằng F00!");
Ultils.EditTextErrorNoMessage(txtBoxID);
txtBoxID.SelectAll();
}
else
{
txtProductID.Focus();
}
}
else
{
SetErrorStatus("NG", "BOX ID không đúng định đạng!");
Ultils.EditTextErrorNoMessage(txtBoxID);
}
}
}
}
示例11: axWindowsMediaPlayer1_PreviewKeyDown
private void axWindowsMediaPlayer1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.MediaNextTrack)
{
playnextSong(ind);
}
if (e.KeyCode == Keys.MediaPreviousTrack)
{
if (Shuffle == false)
{
mediaplayer.Ctlcontrols.stop();
if (songListBox.SelectedIndex - 1 < 0)
{
songListBox.SelectedIndex = (int)songListBox.Items.Count - 1;
ind = (int)songListBox.SelectedValue;
}
else
{
songListBox.SelectedIndex = songListBox.SelectedIndex - 1;
ind = (int)songListBox.SelectedValue;
}
playSong(ind);
}
}
}
示例12: MainForm_PreviewKeyDown
private void MainForm_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode.Equals(Keys.Escape)) {
this.Close();
this.Dispose();
}
}
示例13: Form1_PreviewKeyDown
private async void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyData == (Keys.Control | Keys.V))
{
var data = Clipboard.GetDataObject();
if (data == null)
return;
if (!data.GetDataPresent(typeof(string)))
return;
var url = (string)data.GetData(typeof(string));
try
{
new Uri(url);
}
catch
{
return;
}
var eater = new Eater();
if (eater.Prepare(url, DataFormats.Html))
{
await eater.Eat(ConfigurationManager.AppSettings["path"]);
MessageBox.Show("Completed!");
}
//foreach (var format in data.GetFormats())
//{
// var content = data.GetData(format);
//}
}
}
示例14: HandlePreviewKeyDown
private void HandlePreviewKeyDown(PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Enter && _tbx_command.Text != string.Empty)
{
DebugManager.SendCommand(_tbx_command.Text);
m_commands.Add(_tbx_command.Text);
if (m_commands.Count > 50)
m_commands.RemoveAt(0);
m_pos = m_commands.Count - 1;
_tbx_command.Text = string.Empty;
}
else if (e.KeyCode == Keys.Down)
{
if (m_commands.Count == 0)
return;
if (m_pos < 0)
m_pos = m_commands.Count - 1;
else if (m_pos >= m_commands.Count)
m_pos = 0;
_tbx_command.Text = m_commands[m_pos--];
}
else if (e.KeyCode == Keys.Up)
{
if (m_commands.Count == 0)
return;
if (m_pos < 0)
m_pos = m_commands.Count - 1;
else if (m_pos >= m_commands.Count)
m_pos = 0;
_tbx_command.Text = m_commands[m_pos++];
}
}
示例15: ClientSetup_PreviewKeyDown
private void ClientSetup_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Escape)
{
this.Close();
}
}