示例#1
0
        /*
        private void MainForm_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.X == mainPictureBox.Location.X + mainPictureBox.Size.Width)
            {
                Cursor.Current = Cursors.SizeWE;
            }
        }

        private void MainTreeView_SizeChanged(object sender, EventArgs e)
        {
            float widthDiff = mainTreeView.Bounds.Width - _lastMainTreeViewSize.Width;

            MoveDockedObject(mainPictureBox, (int)widthDiff * 2, 0);
            MoveDockedObject(mainPropertyGrid, (int)widthDiff * 2, 0);

            if (mainPictureBox.Bounds.IntersectsWith(mainTreeView.Bounds) || mainPropertyGrid.Bounds.IntersectsWith(mainTreeView.Bounds))
            {
                
                MoveDockedObject(mainPictureBox, -2, 0);
                MoveDockedObject(mainPropertyGrid, -2, 0);
                
            }

            _lastMainTreeViewSize = mainTreeView.Bounds;
        }

        private void MoveDockedObject(Control control, int width, int height)
        {
            Rectangle old = control.Bounds;
            old.X += width;
            old.Y += height;
            control.Bounds = old;
        }
        */

        // Handlers
        private void HandleTreeViewCtrlShortcuts(Keys keys)
        {
            ResourceWrapper res = (ResourceWrapper)mainTreeView.SelectedNode;

            // Move up
            if (keys.HasFlagUnchecked(Keys.Up))
            {
                if (res.CanMove)
                {
                    res.MoveUp(this, EventArgs.Empty);
                }
            }

            // Move down
            else if (keys.HasFlagUnchecked(Keys.Down))
            {
                if (res.CanMove)
                {
                    res.MoveDown(this, EventArgs.Empty);
                }
            }

            // Delete
            else if (keys.HasFlagUnchecked(Keys.Delete))
            {
                if (res.CanDelete)
                {
                    res.Delete(this, EventArgs.Empty);
                }
            }

            // Replace
            else if (keys.HasFlagUnchecked(Keys.R))
            {
                if (res.CanReplace)
                {
                    res.Replace(this, EventArgs.Empty);
                }
            }

            // Rename
            else if (keys.HasFlagUnchecked(Keys.E))
            {
                if (res.CanRename)
                {
                    res.Export(this, EventArgs.Empty);
                }
            }
        }