public static Form CreateVisualizerForm(this SolutionSpec solution, int problemId = -1)
        {
            var form  = new Form();
            var split = new SplitContainer();

            split.Dock = DockStyle.Fill;
            var menu = new MenuStrip();

            if (problemId >= 0)
            {
                menu.Items.Add("submit").Click += (sender, args) => PostSolution(problemId, solution);
            }
            form.Controls.Add(split);
            form.Controls.Add(menu);
            split.Panel1.DoubleClick += (sender, args) =>
            {
                CopyToClipboard(solution);
            };
            split.Panel2.DoubleClick += (sender, args) =>
            {
                CopyToClipboard(solution);
            };
            form.WindowState = FormWindowState.Maximized;
            Painter painter = new Painter();

            split.Panel1.Paint +=
                (sender, args) => painter.Paint(args.Graphics, Math.Min(split.Panel1.ClientSize.Height, split.Panel1.ClientSize.Width), solution);
            split.Panel2.Paint +=
                (sender, args) => painter.PaintDest(args.Graphics, Math.Min(split.Panel2.ClientSize.Height, split.Panel2.ClientSize.Width), solution);
            split.Resize += (sender, args) => split.Invalidate();
            form.Text     = "Solution (Doule click to copy solution to clipboard) " + problemId;
            return(form);
        }
Beispiel #2
0
        private void EventSupportChanged(object sender, EventArgs e)
        {
            bool layout = false;

            SplitContainer.BackColor = iViewSupport.BackColour;
            SplitContainer.Invalidate();

            PanelBrowser.BackColor = iViewSupport.BackColour;
            PanelBrowser.Invalidate();

            PanelPlaylist.BackColor = iViewSupport.BackColour;
            PanelPlaylist.ForeColor = iViewSupport.ForeColour;
            PanelPlaylist.Font      = iViewSupport.FontMedium;
            PanelPlaylist.Invalidate();

            TabControl.BackColor        = iViewSupport.BackColour;
            TabControl.ForeColor        = iViewSupport.ForeColour;
            TabControl.ForeColourMuted  = iViewSupport.ForeColourMuted;
            TabControl.ForeColourBright = iViewSupport.ForeColourBright;
            TabControl.HighlightColour  = iViewSupport.HighlightForeColour;
            if (TabControl.Font.Size != iViewSupport.FontSmall.Size)
            {
                doubleBufferedTableLayoutPanel1.SuspendLayout();
                doubleBufferedTableLayoutPanel1.ColumnStyles[0].Width = iViewSupport.FontSmall.Height + 2;
                doubleBufferedTableLayoutPanel1.ResumeLayout(false);

                TabControl.Font = iViewSupport.FontSmall;
            }
            TabControl.Invalidate();

            //ButtonRoomSelector.BackColor = iViewSupport.BackColour;
            ButtonRoomSelector.ForeColor      = iViewSupport.ForeColourMuted;
            ButtonRoomSelector.ForeColorMuted = iViewSupport.ForeColourMuted;
            if (ButtonRoomSelector.Font.Size != iViewSupport.FontSmall.Size)
            {
                ButtonRoomSelector.Font = iViewSupport.FontSmall;
                //ButtonRoomSelector.Height = iViewSupport.FontSmall.Height + 4;
                layout = true;
            }
            ButtonRoomSelector.Invalidate();

            //ButtonSourceSelector.BackColor = iViewSupport.BackColour;
            ButtonSourceSelector.ForeColor      = iViewSupport.ForeColourMuted;
            ButtonSourceSelector.ForeColorMuted = iViewSupport.ForeColourMuted;
            if (ButtonSourceSelector.Font.Size != iViewSupport.FontSmall.Size)
            {
                ButtonSourceSelector.Font = iViewSupport.FontSmall;
                //ButtonSourceSelector.Height = iViewSupport.FontSmall.Height + 4;
                layout = true;
            }
            ButtonSourceSelector.Invalidate();

            if (layout)
            {
                LayoutFormKinskyDesktop();
            }
        }