コード例 #1
0
        private void OnselectionChanged(object sender, EventArgs e)
        {
            //Setup(_designer, true);
            Component component = UIDesigner_Tools.Host_Controls_SelectedFirst(_host);
            string    name      = UIDesigner_Component.Component_AsStr(component, true, true);

            if (name != "")
            {
                listBox_Components.zListBox_SearchItem(name);
            }
        }
コード例 #2
0
        private void listBox_Components_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_SelectionChangeFlag)
            {
                return;
            }

            _SelectionChangeFlag = true;
            try
            {
                _ActiveComponent = UIDesigner_Component.FindComponent(_host, _components, listBox_Components.Text);
            }
            finally
            {
                _SelectionChangeFlag = false;
            }
        }
コード例 #3
0
        public void Setup(FormCreator_ designer)
        {
            _SetupFlag = true;
            _designer  = designer;

            // Form Size & Form Panels
            typeof(enForm_Size).zEnum_To_IList(comboBox_FormSize.Items);
            //IamWindows.libUI.WinForms.Controls.ComboBox.SearchItem(comboBox_FormSize, designer.FormSize.ToString());

            typeof(enForm_Panels).zEnum_To_IList(comboBox_FormPanels.Items);
            IamWindows.libUI.WinForms.Controls.ComboBox.SearchItem(comboBox_FormPanels, designer.Panel_Setup.ToString());

            // Panel setup
            input_Panel1.Field_Value = UIDesigner_Component.Component_AsStr(_designer.Panel_Main, true, true);

            listBox_Components.Items.Clear();
            _host = UIDesigner_Service.IDesignerHost_FromComponent(designer);
            if (_host != null)
            {
                // Set event
                UIDesigner_Tools.Host_Controls_SelectionChange(_host, OnselectionChanged);
                this.Closed -= OnFormClosed;
                this.Closed += OnFormClosed;

                // Find all controls on the form
                _components = UIDesigner_Tools.Host_Components_All(_host);
                _controls   = UIDesigner_Tools.Host_Controls_All(_host);
                UIDesigner_Component.ControlNames(_components).zTo_IList(listBox_Components.Items);

                // Populate the list of classes that can be generated
                Assembly      assembly = LamedalCore_.Instance.Types.Assembly.From_Object(designer);
                List <string> typeNameList;
                if (IamWindows.libUI.WinForms.FormGenerate.AssemblyTypes(assembly, out typeNameList, out _typeAttributeDictionary))
                {
                    typeNameList.zTo_IList(listBox_Classes.Items);
                    listBox_Classes.SelectedIndex = 0;
                }

                this.TopMost = true;
                this.Show();
            }

            _SetupFlag = false;
        }
コード例 #4
0
 private void listBox_Components_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (_SelectionChanged)
     {
         return;
     }
     _SelectionChanged = true;
     try
     {
         //Component control1 = Control_Selected();
         Component control1 = UIDesigner_Component.ControlNames(_components, listBox_Components.Text);
         if (control1 != null)
         {
             UIDesigner_Tools.Host_Controls_SelectedSet1(_host, control1);
             //control1.ToString().zOk();
             toolStripStatusLabel1.Text = $"Click on 'Set' to copy image to '{control1.ToString()}'.";
         }
     }
     finally
     {
         _SelectionChanged = false;
     }
 }
コード例 #5
0
        public void Setup(Component designer)
        {
            _designer = designer;
            listBox_Components.Items.Clear();
            _host = UIDesigner_Service.IDesignerHost_FromComponent(designer);
            if (_host != null)
            {
                UIDesigner_Tools.Host_Controls_SelectionChange(_host, OnselectionChanged);  // Set the events

                _components = UIDesigner_Tools.Host_Components_All(_host);
                // Load the controls
                foreach (Component component in _components)
                {
                    string name = UIDesigner_Component.Component_AsStr(component, true, true);
                    if (name != "")
                    {
                        listBox_Components.Items.Add(name);
                    }
                }

                this.TopMost = true;
                this.Show();
            }
        }
コード例 #6
0
        private void button_Set_Click(object sender, EventArgs e)
        {
            if (_image == null)
            {
                toolStripStatusLabel1.Text = "Cannot set image! No selected image.";
                return;
            }

            Image image2 = Image_Scale(_image, comboBox_Resize);
            Icon  icon   = Bmp_ToIcon(new Bitmap(image2));

            this.Icon = icon;

            if (_components == null)
            {
                toolStripStatusLabel1.Text = "Cannot set image! No selected control.";
                return;  // This form was run in normal mode (and not from a component)
            }

            //Component component1 = Control_Selected();
            Component component1 = UIDesigner_Component.ControlNames(_components, listBox_Components.Text);

            if (component1 == null)
            {
                toolStripStatusLabel1.Text = "Cannot set image! No selected control.";
                return;
            }

            // ========================================================
            var form1              = component1 as Form;
            var button1            = component1 as Button;
            var buttonTool1        = component1 as ToolStripButton;
            var toolStripMenuItem1 = component1 as ToolStripMenuItem;

            // Form
            if (form1 != null)
            {
                form1.Icon = icon;
            }
            // Buttons
            else if (button1 != null)
            {
                button1.Image      = image2;
                button1.ImageAlign = ContentAlignment.TopLeft;
                button1.TextAlign  = ContentAlignment.BottomCenter;
            }
            // ButtonTool
            else if (buttonTool1 != null)
            {
                buttonTool1.Image      = image2;
                buttonTool1.ImageAlign = ContentAlignment.TopLeft;
                buttonTool1.TextAlign  = ContentAlignment.BottomCenter;
            }
            // ToolStripMenuItem
            else if (toolStripMenuItem1 != null)
            {
                toolStripMenuItem1.Image      = image2;
                toolStripMenuItem1.ImageAlign = ContentAlignment.TopLeft;
                toolStripMenuItem1.TextAlign  = ContentAlignment.BottomCenter;
            }
            else
            {
                // Other controls
                var control1 = component1 as Control;
                if (control1 != null)
                {
                    control1.BackgroundImage       = image2;
                    control1.BackgroundImageLayout = ImageLayout.None;
                }
            }
        }