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


C# TreeNode.IsScreenNode方法代码示例

本文整理汇总了C#中System.Windows.Forms.TreeNode.IsScreenNode方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.IsScreenNode方法的具体用法?C# TreeNode.IsScreenNode怎么用?C# TreeNode.IsScreenNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.TreeNode的用法示例。


在下文中一共展示了TreeNode.IsScreenNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PopulateRightClickItems

        ///////////////////////////////////////////////////////////
        public static void PopulateRightClickItems(TreeNode node, MenuShowingAction menuShowingAction = MenuShowingAction.RegularRightClick)
        {

            MainGlueWindow.Self.ElementTreeView.SelectedNode = node;
            MainGlueWindow form = MainGlueWindow.Self;

            ContextMenuStrip menu = MainGlueWindow.Self.mElementContextMenu;

            menu.Items.Clear();


            #region IsScreenNode

            if (node.IsScreenNode())
            {
                if (menuShowingAction == MenuShowingAction.RightButtonDrag)
                {
                    menu.Items.Add(mAddEntityInstance);
                    menu.Items.Add(mAddEntityList);
                }
                else
                {
                    menu.Items.Add(form.setAsStartUpScreenToolStripMenuItem);
                    menu.Items.Add(mMakeRequiredAtStartup);
                    mExportElement.Text = "Export Screen";
                    menu.Items.Add(mExportElement);

                    AddRemoveFromProjectItems(form, menu);

                    if (EditorLogic.CurrentScreenSave.IsRequiredAtStartup)
                    {
                        mMakeRequiredAtStartup.Text = "Remove StartUp Requirement";
                    }
                    else
                    {
                        mMakeRequiredAtStartup.Text = "Make Required at StartUp";
                    }


                    menu.Items.Add("-");
                    menu.Items.Add(mFindAllReferences);
                    menu.Items.Add(mRefreshTreeNodesMenuItem);
                }
            }

            #endregion

            #region IsEntityNode

            else if (node.IsEntityNode())
            {
                if (menuShowingAction == MenuShowingAction.RightButtonDrag)
                {
                    menu.Items.Add(mAddEntityInstance);
                    menu.Items.Add(mAddEntityList);
                }
                else
                {
                    AddRemoveFromProjectItems(form, menu);

                    menu.Items.Add("-");
                    mExportElement.Text = "Export Entity";
                    menu.Items.Add(mExportElement);
                    menu.Items.Add(mFindAllReferences);

                    EntitySave entitySave = ((EntityTreeNode)node).EntitySave;

                    if (entitySave.PooledByFactory)
                    {
                        menu.Items.Add(mAddResetVariablesForPooling);
                    }
                    menu.Items.Add(mRefreshTreeNodesMenuItem);
                }
            }

            #endregion

            #region IsFileContainerNode OR IsFolderInFilesContainerNode

            else if (node.IsFilesContainerNode() || node.IsFolderInFilesContainerNode())
            {
                menu.Items.Add(form.addFileToolStripMenuItem);
                menu.Items.Add(form.addFolderToolStripMenuItem);
                menu.Items.Add("-");
                menu.Items.Add(form.viewInExplorerToolStripMenuItem);
                if (node.IsFolderInFilesContainerNode())
                {
                    menu.Items.Add(mDeleteFolder);
                }
            }

            #endregion

            #region IsScreenObjectContainerNode

            else if (node.IsRootObjectNode())
            {
                if (menuShowingAction == MenuShowingAction.RightButtonDrag)
                {
//.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:101,代码来源:RightClickHelper.cs

示例2: MoveEntityOn

        public static TreeNode MoveEntityOn(EntityTreeNode treeNodeMoving, TreeNode targetNode)
        {
            TreeNode newTreeNode = null;

            #region Moving the Entity into (or out of) a directory
            if (targetNode.IsDirectoryNode() || targetNode.IsRootEntityNode())
            {
                MoveEntityToDirectory(treeNodeMoving, targetNode);
            }

            #endregion

            #region Moving an Entity onto another element to create an instance

            else if (targetNode.IsEntityNode() || targetNode.IsScreenNode() || targetNode.IsRootNamedObjectNode())
            {
                bool isValidDrop = true;
                // Make sure that we don't drop an Entity into its own Objects
                if (targetNode.IsRootNamedObjectNode())
                {
                    if(treeNodeMoving == targetNode.GetContainingElementTreeNode())
                    {

                        isValidDrop = false;
                    }
                }
                if (isValidDrop)
                {
                    newTreeNode = MoveEntityOntoElement(treeNodeMoving, targetNode, newTreeNode);
                }
            }

            #endregion

            #region Moving an Entity onto a NamedObject (currently supports only Lists)

            else if (targetNode.IsNamedObjectNode())
            {
                // Allow drop only if it's a list or Layer
                NamedObjectSave targetNamedObjectSave = targetNode.Tag as NamedObjectSave;

                if (!targetNamedObjectSave.IsList && !targetNamedObjectSave.IsLayer)
                {
                    MessageBox.Show("The target is not a List or Layer so we can't add an Object to it.", "Target not valid");
                }
                if (targetNamedObjectSave.IsLayer)
                {
                    TreeNode parent = targetNode.Parent;

                    newTreeNode = MoveEntityOn(treeNodeMoving, parent);

                    // this created a new NamedObjectSave.  Let's put that on the Layer
                    MoveNamedObject(newTreeNode, targetNode);
                }
                else
                {
                    // Make sure that the two types match
                    string listType = targetNamedObjectSave.SourceClassGenericType;

                    if (listType != treeNodeMoving.EntitySave.Name)
                    {
                        MessageBox.Show("The target list type is of type\n\n" +
                            listType +
                            "\n\nBut the Entity is of type\n\n" +
                            treeNodeMoving.EntitySave.Name +
                            "\n\nCould not add an instance to the list", "Could not add instance");
                    }
                    else
                    {
                        NamedObjectSave namedObject = new NamedObjectSave();
                        namedObject.InstanceName =
                            FileManager.RemovePath(listType) + "1";

                        StringFunctions.MakeNameUnique<NamedObjectSave>(
                            namedObject, targetNamedObjectSave.ContainedObjects);

                        // Not sure if we need to set this or not, but I think 
                        // any instance added to a list will not be defined by base
                        namedObject.DefinedByBase = false;

                        NamedObjectSaveExtensionMethodsGlue.AddNamedObjectToCurrentNamedObjectList(namedObject);

                        ElementViewWindow.GenerateSelectedElementCode();
                        // Don't save the Glux, the caller of this method will take care of it
                        // GluxCommands.Self.SaveGlux();
                    }

                }
            }

            #endregion

            else if (targetNode.IsGlobalContentContainerNode())
            {
                AskAndAddAllContainedRfsToGlobalContent(treeNodeMoving.SaveObjectAsElement);
            }

            return newTreeNode;
        }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:99,代码来源:ElementViewWindow.DragDrop.cs


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