本文整理汇总了C#中dfKeyEventArgs.Use方法的典型用法代码示例。如果您正苦于以下问题:C# dfKeyEventArgs.Use方法的具体用法?C# dfKeyEventArgs.Use怎么用?C# dfKeyEventArgs.Use使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dfKeyEventArgs
的用法示例。
在下文中一共展示了dfKeyEventArgs.Use方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnKeyDown
void OnKeyDown( dfControl sender, dfKeyEventArgs args )
{
switch( args.KeyCode )
{
case KeyCode.Tab:
if( args.Shift )
{
if( SelectOnShiftTab != null )
{
SelectOnShiftTab.Focus();
args.Use();
}
}
else if( SelectOnTab != null )
{
SelectOnTab.Focus();
args.Use();
}
break;
case KeyCode.LeftArrow:
if( SelectOnLeft != null )
{
SelectOnLeft.Focus();
args.Use();
}
break;
case KeyCode.RightArrow:
if( SelectOnRight != null )
{
SelectOnRight.Focus();
args.Use();
}
break;
case KeyCode.UpArrow:
if( SelectOnUp != null )
{
SelectOnUp.Focus();
args.Use();
}
break;
case KeyCode.DownArrow:
if( SelectOnDown != null )
{
SelectOnDown.Focus();
args.Use();
}
break;
default:
break;
}
}
示例2: OnKeyDown
protected internal override void OnKeyDown( dfKeyEventArgs args )
{
if( args.Used )
{
return;
}
if( Orientation == dfControlOrientation.Horizontal )
{
if( args.KeyCode == KeyCode.LeftArrow )
{
this.Value -= ( this.rightToLeft ) ? -scrollSize : scrollSize;
args.Use();
return;
}
else if( args.KeyCode == KeyCode.RightArrow )
{
this.Value += ( this.rightToLeft ) ? -scrollSize : scrollSize;
args.Use();
return;
}
}
else
{
if( args.KeyCode == KeyCode.UpArrow )
{
this.Value += ScrollSize;
args.Use();
return;
}
else if( args.KeyCode == KeyCode.DownArrow )
{
this.Value -= ScrollSize;
args.Use();
return;
}
}
base.OnKeyDown( args );
}
示例3: processKeyPress
private void processKeyPress( dfKeyEventArgs args )
{
DeleteSelection();
if( text.Length < MaxLength )
{
if( cursorIndex == text.Length )
{
text += args.Character;
}
else
{
text = text.Insert( cursorIndex, args.Character.ToString() );
}
cursorIndex += 1;
OnTextChanged();
Invalidate();
}
args.Use();
}
示例4: OnKeyDown
protected internal override void OnKeyDown( dfKeyEventArgs args )
{
if( ReadOnly )
return;
// Give event observers the opportunity to cancel the event
base.OnKeyDown( args );
if( args.Used )
return;
#if !( UNITY_IPHONE || UNITY_ANDROID || UNITY_BLACKBERRY || UNITY_WP8 ) || UNITY_EDITOR
switch( args.KeyCode )
{
case KeyCode.A:
if( args.Control )
{
SelectAll();
}
break;
case KeyCode.Insert:
if( args.Shift )
{
var clipData = dfClipboardHelper.clipBoard;
if( !string.IsNullOrEmpty( clipData ) )
{
PasteAtCursor( clipData );
}
}
break;
case KeyCode.V:
if( args.Control )
{
var clipData = dfClipboardHelper.clipBoard;
if( !string.IsNullOrEmpty( clipData ) )
{
PasteAtCursor( clipData );
}
}
break;
case KeyCode.C:
if( args.Control )
{
CopySelectionToClipboard();
}
break;
case KeyCode.X:
if( args.Control )
{
CutSelectionToClipboard();
}
break;
case KeyCode.LeftArrow:
if( args.Control )
{
if( args.Shift )
moveSelectionPointLeftWord();
else
MoveCursorToPreviousWord();
}
else if( args.Shift )
moveSelectionPointLeft();
else
MoveCursorToPreviousChar();
break;
case KeyCode.RightArrow:
if( args.Control )
{
if( args.Shift )
moveSelectionPointRightWord();
else
MoveCursorToNextWord();
}
else if( args.Shift )
moveSelectionPointRight();
else
MoveCursorToNextChar();
break;
case KeyCode.Home:
if( args.Shift )
SelectToStart();
else
MoveCursorToStart();
break;
case KeyCode.End:
if( args.Shift )
SelectToEnd();
else
MoveCursorToEnd();
break;
case KeyCode.Delete:
if( selectionStart != selectionEnd )
DeleteSelection();
else if( args.Control )
DeleteNextWord();
else
DeleteNextChar();
break;
case KeyCode.Backspace:
if( args.Control )
//.........这里部分代码省略.........
示例5: OnKeyDown
protected internal override void OnKeyDown( dfKeyEventArgs args )
{
if( args.Used )
return;
if( allowKeyboardNavigation )
{
if( args.KeyCode == KeyCode.LeftArrow || ( args.KeyCode == KeyCode.Tab && args.Shift ) )
{
SelectedIndex = Mathf.Max( 0, SelectedIndex - 1 );
args.Use();
return;
}
else if( args.KeyCode == KeyCode.RightArrow || args.KeyCode == KeyCode.Tab )
{
SelectedIndex += 1;
args.Use();
return;
}
}
base.OnKeyDown( args );
}
示例6: OnKeyDown
protected internal override void OnKeyDown( dfKeyEventArgs args )
{
if( !scrollWithArrowKeys || args.Used )
{
base.OnKeyDown( args );
return;
}
var horzAmount = horzScroll != null ? horzScroll.IncrementAmount : 1f;
var vertAmount = vertScroll != null ? vertScroll.IncrementAmount : 1f;
if( args.KeyCode == KeyCode.LeftArrow )
{
ScrollPosition += new Vector2( -horzAmount, 0 );
args.Use();
}
else if( args.KeyCode == KeyCode.RightArrow )
{
ScrollPosition += new Vector2( horzAmount, 0 );
args.Use();
}
else if( args.KeyCode == KeyCode.UpArrow )
{
ScrollPosition += new Vector2( 0, -vertAmount );
args.Use();
}
else if( args.KeyCode == KeyCode.DownArrow )
{
ScrollPosition += new Vector2( 0, vertAmount );
args.Use();
}
base.OnKeyDown( args );
}
示例7: OnKeyDown
protected internal override void OnKeyDown( dfKeyEventArgs args )
{
if( args.Used )
{
base.OnKeyDown( args );
return;
}
var horzAmount = FontSize; // horzScrollbar != null ? horzScrollbar.IncrementAmount : FontSize;
var vertAmount = FontSize; // vertScrollbar != null ? vertScrollbar.IncrementAmount : FontSize;
if( args.KeyCode == KeyCode.LeftArrow )
{
ScrollPosition += new Vector2( -horzAmount, 0 );
args.Use();
}
else if( args.KeyCode == KeyCode.RightArrow )
{
ScrollPosition += new Vector2( horzAmount, 0 );
args.Use();
}
else if( args.KeyCode == KeyCode.UpArrow )
{
ScrollPosition += new Vector2( 0, -vertAmount );
args.Use();
}
else if( args.KeyCode == KeyCode.DownArrow )
{
ScrollPosition += new Vector2( 0, vertAmount );
args.Use();
}
base.OnKeyDown( args );
}
示例8: OnKeyDown
protected internal override void OnKeyDown(dfKeyEventArgs args)
{
if (this.Orientation != dfControlOrientation.Horizontal)
{
if (args.KeyCode == KeyCode.UpArrow)
{
dfScrollbar value = this;
value.Value = value.Value - this.IncrementAmount;
args.Use();
return;
}
if (args.KeyCode == KeyCode.DownArrow)
{
dfScrollbar _dfScrollbar = this;
_dfScrollbar.Value = _dfScrollbar.Value + this.IncrementAmount;
args.Use();
return;
}
}
else
{
if (args.KeyCode == KeyCode.LeftArrow)
{
dfScrollbar value1 = this;
value1.Value = value1.Value - this.IncrementAmount;
args.Use();
return;
}
if (args.KeyCode == KeyCode.RightArrow)
{
dfScrollbar _dfScrollbar1 = this;
_dfScrollbar1.Value = _dfScrollbar1.Value + this.IncrementAmount;
args.Use();
return;
}
}
base.OnKeyDown(args);
}
示例9: OnKeyDown
protected internal override void OnKeyDown( dfKeyEventArgs args )
{
if( Orientation == dfControlOrientation.Horizontal )
{
if( args.KeyCode == KeyCode.LeftArrow )
{
Value -= IncrementAmount;
args.Use();
return;
}
else if( args.KeyCode == KeyCode.RightArrow )
{
Value += IncrementAmount;
args.Use();
return;
}
}
else
{
if( args.KeyCode == KeyCode.UpArrow )
{
Value -= IncrementAmount;
args.Use();
return;
}
else if( args.KeyCode == KeyCode.DownArrow )
{
Value += IncrementAmount;
args.Use();
return;
}
}
base.OnKeyDown( args );
}
示例10: OnKeyDown
protected internal override void OnKeyDown( dfKeyEventArgs args )
{
if( args.Used )
{
base.OnKeyDown( args );
return;
}
var horzAmount = FontSize; // horzScrollbar != null ? horzScrollbar.IncrementAmount : FontSize;
var vertAmount = FontSize; // vertScrollbar != null ? vertScrollbar.IncrementAmount : FontSize;
switch( args.KeyCode )
{
case KeyCode.LeftArrow:
ScrollPosition += new Vector2( -horzAmount, 0 );
args.Use();
break;
case KeyCode.RightArrow:
ScrollPosition += new Vector2( horzAmount, 0 );
args.Use();
break;
case KeyCode.UpArrow:
ScrollPosition += new Vector2( 0, -vertAmount );
args.Use();
break;
case KeyCode.DownArrow:
ScrollPosition += new Vector2( 0, vertAmount );
args.Use();
break;
case KeyCode.Home:
ScrollToTop();
args.Use();
break;
case KeyCode.End:
ScrollToBottom();
args.Use();
break;
}
base.OnKeyDown( args );
}
示例11: OnKeyDown
protected internal override void OnKeyDown( dfKeyEventArgs args )
{
try
{
if( !actAsSlider )
return;
var scrollSize = ( this.maxValue - this.minValue ) * 0.1f;
if( args.KeyCode == KeyCode.LeftArrow )
{
this.Value -= scrollSize;
args.Use();
return;
}
else if( args.KeyCode == KeyCode.RightArrow )
{
this.Value += scrollSize;
args.Use();
return;
}
}
finally
{
base.OnKeyDown( args );
}
}
示例12: OnKeyDown
protected internal override void OnKeyDown(dfKeyEventArgs args)
{
if (args.Used)
{
return;
}
if (this.allowKeyboardNavigation)
{
if (args.KeyCode == KeyCode.LeftArrow || args.KeyCode == KeyCode.Tab && args.Shift)
{
this.SelectedIndex = Mathf.Max(0, this.SelectedIndex - 1);
args.Use();
return;
}
if (args.KeyCode == KeyCode.RightArrow || args.KeyCode == KeyCode.Tab)
{
dfTabstrip selectedIndex = this;
selectedIndex.SelectedIndex = selectedIndex.SelectedIndex + 1;
args.Use();
return;
}
}
base.OnKeyDown(args);
}
示例13: OnKeyDown
protected internal override void OnKeyDown(dfKeyEventArgs args)
{
if (this.ReadOnly)
{
return;
}
base.OnKeyDown(args);
if (args.Used)
{
return;
}
KeyCode keyCode = args.KeyCode;
switch (keyCode)
{
case KeyCode.RightArrow:
{
if (args.Control)
{
if (!args.Shift)
{
this.moveToNextWord();
}
else
{
this.moveSelectionPointRightWord();
}
}
else if (!args.Shift)
{
this.moveToNextChar();
}
else
{
this.moveSelectionPointRight();
}
break;
}
case KeyCode.LeftArrow:
{
if (args.Control)
{
if (!args.Shift)
{
this.moveToPreviousWord();
}
else
{
this.moveSelectionPointLeftWord();
}
}
else if (!args.Shift)
{
this.moveToPreviousChar();
}
else
{
this.moveSelectionPointLeft();
}
break;
}
case KeyCode.Insert:
{
if (args.Shift)
{
string str = dfClipboardHelper.clipBoard;
if (!string.IsNullOrEmpty(str))
{
this.pasteAtCursor(str);
}
}
break;
}
case KeyCode.Home:
{
if (!args.Shift)
{
this.moveToStart();
}
else
{
this.selectToStart();
}
break;
}
case KeyCode.End:
{
if (!args.Shift)
{
this.moveToEnd();
}
else
{
this.selectToEnd();
}
break;
}
default:
{
switch (keyCode)
{
//.........这里部分代码省略.........
示例14: processKeyPress
private void processKeyPress(dfKeyEventArgs args)
{
this.deleteSelection();
if (this.text.Length < this.MaxLength)
{
if (this.cursorIndex != this.text.Length)
{
string str = this.text;
int num = this.cursorIndex;
char character = args.Character;
this.text = str.Insert(num, character.ToString());
}
else
{
dfTextbox _dfTextbox = this;
_dfTextbox.text = string.Concat(_dfTextbox.text, args.Character);
}
dfTextbox _dfTextbox1 = this;
_dfTextbox1.cursorIndex = _dfTextbox1.cursorIndex + 1;
this.OnTextChanged();
this.Invalidate();
}
args.Use();
}
示例15: OnKeyDown
protected internal override void OnKeyDown(dfKeyEventArgs args)
{
if (!this.scrollWithArrowKeys || args.Used)
{
base.OnKeyDown(args);
return;
}
float single = (this.horzScroll == null ? 1f : this.horzScroll.IncrementAmount);
float single1 = (this.vertScroll == null ? 1f : this.vertScroll.IncrementAmount);
if (args.KeyCode == KeyCode.LeftArrow)
{
dfScrollPanel scrollPosition = this;
scrollPosition.ScrollPosition = scrollPosition.ScrollPosition + new Vector2(-single, 0f);
args.Use();
}
else if (args.KeyCode == KeyCode.RightArrow)
{
dfScrollPanel _dfScrollPanel = this;
_dfScrollPanel.ScrollPosition = _dfScrollPanel.ScrollPosition + new Vector2(single, 0f);
args.Use();
}
else if (args.KeyCode == KeyCode.UpArrow)
{
dfScrollPanel scrollPosition1 = this;
scrollPosition1.ScrollPosition = scrollPosition1.ScrollPosition + new Vector2(0f, -single1);
args.Use();
}
else if (args.KeyCode == KeyCode.DownArrow)
{
dfScrollPanel _dfScrollPanel1 = this;
_dfScrollPanel1.ScrollPosition = _dfScrollPanel1.ScrollPosition + new Vector2(0f, single1);
args.Use();
}
base.OnKeyDown(args);
}