Source/ContainerKeyboardNavigation.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Text;
using System.Windows.Forms;

namespace DevComponents.DotNetBar
{
    internal class ContainerKeyboardNavigation
    {
        internal static void ProcessKeyDown(BaseItem container, System.Windows.Forms.KeyEventArgs objArg)
        {
            if (container.SubItems.Count == 0 || objArg.Handled)
                return;

            BaseItem objExpanded = container.ExpandedItem();

            if (objExpanded != null)
            {
                objExpanded.InternalKeyDown(objArg);
                if (objArg.Handled)
                    return;
            }

            eOrientation containerOrientation = container.Orientation;
            if (container is ItemContainer)
                containerOrientation = ((ItemContainer)container).LayoutOrientation;

            if (containerOrientation == eOrientation.Horizontal && (objArg.KeyCode == Keys.Left || objArg.KeyCode == Keys.Right || container.HotSubItem == null && (objArg.KeyCode == Keys.Down || objArg.KeyCode == Keys.Up)) ||
               (containerOrientation == eOrientation.Vertical && (objArg.KeyCode == Keys.Up || objArg.KeyCode == Keys.Down || container.HotSubItem == null && (objArg.KeyCode == Keys.Right || objArg.KeyCode == Keys.Left))))
            {
                // Select next object
                if (container.HotSubItem != null)
                {
                    container.HotSubItem.InternalMouseLeave();
                    if (container.AutoExpand && container.HotSubItem.Expanded)
                    {
                        container.HotSubItem.Expanded = false;
                    }
                }
                if (objArg.KeyCode == System.Windows.Forms.Keys.Left || objArg.KeyCode == Keys.Up)
                {
                    int iIndex = 0;
                    if (container.HotSubItem != null)
                        iIndex = container.SubItems.IndexOf(container.HotSubItem) - 1;
                    if (iIndex < 0)
                        iIndex = container.SubItems.Count - 1;
                    BaseItem objNew = null;
                    bool bRepeat = false;
                    do
                    {
                        for (int i = iIndex; i >= 0; i--)
                        {
                            objNew = container.SubItems[i];
                            if (CanFocus(objNew))
                            {
                                iIndex = i;
                                break;
                            }
                        }
                        if (!CanFocus(container.SubItems[iIndex]))
                        {
后面还有 146 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。