コード例 #1
0
        /// <summary>
        /// Show form preview
        /// </summary>
        /// <param name="bounds">preview bounds</param>
        /// <param name="renderer">renderer</param>
        /// <param name="graphics">graphics</param>
        public static void ShowFormPreview(Rectangle bounds, PreviewRenderer renderer, Graphics graphics)
        {
            using (GraphicsPath path = GraphicsOrder.CreateRoundRectPath(bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 5))
            {
                renderer.DrawBackground(bounds, path, graphics);
                renderer.DrawBorder(bounds.Size, path, graphics);
            }

            Rectangle titleBounds = new Rectangle(bounds.Left + 10, bounds.Top + 10, bounds.Width - 21, 24);

            graphics.SetClip(titleBounds, CombineMode.Replace);
            renderer.DrawTitle(titleBounds, graphics);

            Rectangle previewBounds = new Rectangle(bounds.Left + 10, bounds.Top + 40, bounds.Width - 21, bounds.Height - 50);

            graphics.SetClip(previewBounds, CombineMode.Replace);
            renderer.DrawPreview(previewBounds, graphics);
        }
コード例 #2
0
        /// <summary>
        /// Show forms selector
        /// </summary>
        /// <param name="containerScreenBounds">screen bounds of the container</param>
        /// <param name="forms">forms to select</param>
        public void Show(PreviewRenderer renderer, Rectangle containerScreenBounds, DockableFormInfo[] forms)
        {
            Renderer = renderer;
            _forms   = forms;
            if (_forms == null)
            {
                _forms = new DockableFormInfo[0];
            }

            for (int index = 0; index < _forms.Length; index++)
            {
                if (_forms[index].IsSelected)
                {
                    SelectedIndex = index;
                    break;
                }
            }

            _screenBounds = containerScreenBounds;

            ShowSelector();
        }