当前位置: 首页>>代码示例>>C#>>正文


C# dfKeyEventArgs.Use方法代码示例

本文整理汇总了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;

		}

	}
开发者ID:Elringus,项目名称:StarcorPreAlpha,代码行数:60,代码来源:ControlNavigation.cs

示例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 );
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:40,代码来源:dfSlider.cs

示例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();
    }
开发者ID:BjarkeHou,项目名称:ProjectGuard,代码行数:25,代码来源:dfTextbox.cs

示例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 )
//.........这里部分代码省略.........
开发者ID:BjarkeHou,项目名称:ProjectGuard,代码行数:101,代码来源:dfTextbox.cs

示例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 );
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:25,代码来源:dfTabstrip.cs

示例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 );
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:34,代码来源:dfScrollPanel.cs

示例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 );
    }
开发者ID:kvelury,项目名称:apocalyptia,代码行数:34,代码来源:dfRichTextLabel.cs

示例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);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:38,代码来源:dfScrollbar.cs

示例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 );
    }
开发者ID:haozi000005,项目名称:happy2d,代码行数:35,代码来源:dfScrollbar.cs

示例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 );
    }
开发者ID:zc1415926,项目名称:Unity-SelectCharacter-Scene,代码行数:41,代码来源:dfRichTextLabel.cs

示例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 );
        }
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:29,代码来源:dfProgressBar.cs

示例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);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:24,代码来源:dfTabstrip.cs

示例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)
             {
//.........这里部分代码省略.........
开发者ID:HexHash,项目名称:LegacyRust,代码行数:101,代码来源:dfTextbox.cs

示例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();
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:24,代码来源:dfTextbox.cs

示例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);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:35,代码来源:dfScrollPanel.cs


注:本文中的dfKeyEventArgs.Use方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。