Exemple #1
0
        public CodeForm(GuiControls.Form form)
        {
            this.form = form;

            InitializeComponent();

            codeSerializer = new CodeSerializer(form);

            GenerateCode();
        }
        public StyleManagerForm()
        {
            InitializeComponent();

            suppressUpdate = false;

            //initialize controls
            controlList = new Dictionary <GuiControls.ControlType, GuiControls.Control>();

            string preview = "Preview";

            previewForm = new GuiControls.Form(new Point(1, 1))
            {
                Size = new Size(424, 200),
                Text = preview
            };

            previewControl = previewForm;

            var button = new GuiControls.Button {
                Text = preview
            };

            controlList.Add(GuiControls.ControlType.Button, button);

            var checkbox = new GuiControls.CheckBox {
                Text = preview
            };

            controlList.Add(GuiControls.ControlType.CheckBox, checkbox);

            var comboBox = new GuiControls.ComboBox
            {
                Items = new[] { preview },
                Text  = preview
            };

            controlList.Add(GuiControls.ControlType.ComboBox, comboBox);

            controlList.Add(GuiControls.ControlType.Form, previewForm);

            var groupbox = new GuiControls.GroupBox
            {
                Text = preview,
                Size = new Size(100, 100)
            };

            controlList.Add(GuiControls.ControlType.GroupBox, groupbox);

            var hotkeyControl = new GuiControls.HotkeyControl {
                Hotkey = Keys.Control | Keys.A
            };

            controlList.Add(GuiControls.ControlType.HotkeyControl, hotkeyControl);

            var label = new GuiControls.Label {
                Text = preview
            };

            controlList.Add(GuiControls.ControlType.Label, label);

            var linklabel = new GuiControls.LinkLabel {
                Text = preview
            };

            controlList.Add(GuiControls.ControlType.LinkLabel, linklabel);

            var listbox = new GuiControls.ListBox {
                Items = new[] { preview }
            };

            controlList.Add(GuiControls.ControlType.ListBox, listbox);

            var picturebox = new GuiControls.PictureBox {
                Size = new Size(100, 100)
            };

            controlList.Add(GuiControls.ControlType.PictureBox, picturebox);

            var panel = new GuiControls.Panel {
                Size = new Size(100, 100)
            };

            controlList.Add(GuiControls.ControlType.Panel, panel);

            var progressbar = new GuiControls.ProgressBar {
                Value = 50
            };

            controlList.Add(GuiControls.ControlType.ProgressBar, progressbar);

            var radiobutton = new GuiControls.RadioButton {
                Text = preview
            };

            controlList.Add(GuiControls.ControlType.RadioButton, radiobutton);

            var tabControl = new GuiControls.TabControl {
                Size = new Size(100, 100)
            };

            controlList.Add(GuiControls.ControlType.TabControl, tabControl);

            var tabPage = new GuiControls.TabPage {
                Text = preview
            };

            tabControl.AddTabPage(tabPage);
            controlList.Add(GuiControls.ControlType.TabPage, tabPage);

            var textbox = new GuiControls.TextBox {
                Text = preview
            };

            controlList.Add(GuiControls.ControlType.TextBox, textbox);

            var trackbar = new GuiControls.TrackBar();

            controlList.Add(GuiControls.ControlType.TrackBar, trackbar);

            foreach (var kv in controlList)
            {
                if (!(kv.Key == GuiControls.ControlType.Form || kv.Key == GuiControls.ControlType.TabPage))
                {
                    kv.Value.DesignerHidden = true;
                    previewForm.AddControl(kv.Value);
                }

                controlsListBox.Items.Add(kv.Key);
            }
        }