コード例 #1
0
ファイル: ColorEditor.cs プロジェクト: GabeTesta/Warps
        public static KeyValuePair<Form, ColorEditor> Show(ColorMap colors)
        {
            ColorEditor edit = new ColorEditor(colors);
            if (colors.Count() > 0)
            {
                edit.m_list.SelectedIndices.Clear();
                edit.m_list.SelectedIndices.Add(0);
            }
            Form f = new Form();
            f.Text = "Colors";
            f.FormBorderStyle = FormBorderStyle.SizableToolWindow;
            int pad = f.Size.Width - f.ClientRectangle.Width;
            int ypad = f.Size.Height - f.ClientRectangle.Height;
            f.Width = edit.Width + pad;
            f.Height = edit.Height + ypad;

            f.Controls.Add(edit);
            edit.Dock = DockStyle.Fill;

            f.Show();
            return new KeyValuePair<Form, ColorEditor>(f, edit);
        }