Пример #1
0
        private void panelButton_MouseEnter(object sender, EventArgs e)
        {
            mouseOverControl = true;

            XCore.ChoiceRelatedClass choice  = (XCore.ChoiceRelatedClass) this.Tag;
            UIItemDisplayProperties  display = choice.GetDisplayProperties();


            this.Refresh();
        }
Пример #2
0
        private void panelButton_MouseDown(object sender, MouseEventArgs e)
        {
            XCore.ChoiceRelatedClass choice  = (XCore.ChoiceRelatedClass) this.Tag;
            UIItemDisplayProperties  display = choice.GetDisplayProperties();

#if USE_DOTNETBAR
            this.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemPressedBackground;
            this.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemPressedBackground2;
#endif

            this.Refresh();
        }
Пример #3
0
        private void panelButton_MouseLeave(object sender, EventArgs e)
        {
            mouseOverControl = false;

            XCore.ChoiceRelatedClass choice  = (XCore.ChoiceRelatedClass) this.Tag;
            UIItemDisplayProperties  display = choice.GetDisplayProperties();

            if (display.Checked)
            {
                this.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemCheckedBackground;
                this.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemCheckedBackground2;
            }
            else
            {
                this.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
                this.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
                this.Style.ForeColor.ColorSchemePart  = DevComponents.DotNetBar.eColorSchemePart.PanelText;
            }

            this.Refresh();
        }
Пример #4
0
        private void SetLabel()
        {
            XCore.ChoiceRelatedClass choice  = (XCore.ChoiceRelatedClass) this.Tag;
            UIItemDisplayProperties  display = choice.GetDisplayProperties();

            string   s = display.Text.Replace("_", "&");
            Graphics g = this.CreateGraphics();

            this.Width           = (int)(g.MeasureString(s, this.Font).Width);
            this.Text            = s;
            this.Style.Alignment = System.Drawing.StringAlignment.Center;

            if (display.Checked)
            {
                this.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemCheckedBackground;
                this.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemCheckedBackground2;
                this.Style.ForeColor.ColorSchemePart  = DevComponents.DotNetBar.eColorSchemePart.ItemCheckedText;
            }
            else
            {
                this.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
                this.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
                this.Style.ForeColor.ColorSchemePart  = DevComponents.DotNetBar.eColorSchemePart.PanelText;
            }

            // Simulate a mouse enter or leave event to get the correct highlighting
            if (mouseOverControl)
            {
                this.panelButton_MouseEnter(null, null);
            }
            else
            {
                this.panelButton_MouseLeave(null, null);
            }

            this.Controls.Clear();             // Clear out any previous checkboxes and images

            // Add in a checkbox that reflects the "checked" status of the button
            CheckBox checkBox = new CheckBox();

            checkBox.Checked     = display.Checked;
            checkBox.Click      += new EventHandler(PanelButton_Click);
            checkBox.Location    = new Point(0, 0);
            checkBox.Anchor      = System.Windows.Forms.AnchorStyles.Left;
            checkBox.Dock        = System.Windows.Forms.DockStyle.None;
            checkBox.Width       = 17;
            this.Width          += checkBox.Width;
            checkBox.MouseEnter += new EventHandler(panelButton_MouseEnter);
            checkBox.MouseLeave += new EventHandler(panelButton_MouseLeave);
            checkBox.MouseDown  += new MouseEventHandler(panelButton_MouseDown);
            this.Controls.Add(checkBox);
            this.Style.Alignment = System.Drawing.StringAlignment.Far;

            if (display.ImageLabel != null && display.ImageLabel != "" && display.ImageLabel != "default")
            {
                PanelEx p = new PanelEx();
                Image   i = m_images.GetImage(display.ImageLabel);
                p.Style.BackgroundImage         = i;
                p.Style.BackgroundImagePosition = eBackgroundImagePosition.Center;
                p.Location  = new Point(checkBox.Width, 0);
                p.Anchor    = System.Windows.Forms.AnchorStyles.Left;
                p.Dock      = System.Windows.Forms.DockStyle.None;
                p.Size      = new Size(17, this.Height);
                this.Width += p.Size.Width;
                this.Controls.Add(p);
                p.Click      += new EventHandler(PanelButton_Click);
                p.MouseEnter += new EventHandler(panelButton_MouseEnter);
                p.MouseLeave += new EventHandler(panelButton_MouseLeave);
                p.MouseDown  += new MouseEventHandler(panelButton_MouseDown);
            }

            this.Refresh();
        }
Пример #5
0
        private void SetLabel()
        {
            XCore.ChoiceRelatedClass choice  = (XCore.ChoiceRelatedClass) this.Tag;
            UIItemDisplayProperties  display = choice.GetDisplayProperties();

            const int checkBoxWidth = 17;
            string    s             = display.Text.Replace("_", "&");

            this.Text = s;

            using (Graphics g = this.CreateGraphics())
            {
                int labelWidth = (int)(g.MeasureString(s + "_", this.Font).Width);
                this.Width = labelWidth;
            }

            // Simulate a mouse enter or leave event to get the correct highlighting
            if (mouseOverControl)
            {
                this.panelButton_MouseEnter(null, null);
            }
            else
            {
                this.panelButton_MouseLeave(null, null);
            }

            this.Controls.Clear();             // Clear out any previous checkboxes and images

            // Add in a checkbox that reflects the "checked" status of the button
            CheckBox checkBox = new CheckBox();

            checkBox.Checked     = display.Checked;
            checkBox.Click      += new EventHandler(PanelButton_Click);
            checkBox.Location    = new Point(0, 0);
            checkBox.Anchor      = System.Windows.Forms.AnchorStyles.Left;
            checkBox.Dock        = System.Windows.Forms.DockStyle.Left;
            checkBox.Width       = checkBoxWidth;
            checkBox.MouseEnter += new EventHandler(panelButton_MouseEnter);
            checkBox.MouseLeave += new EventHandler(panelButton_MouseLeave);
            checkBox.MouseDown  += new MouseEventHandler(panelButton_MouseDown);
            checkBox.BackColor   = Color.Transparent;
            this.Controls.Add(checkBox);

            this.Width += checkBox.Width;


            if (display.ImageLabel != null && display.ImageLabel != "" && display.ImageLabel != "default")
            {
                PanelEx p = new PanelEx();
                Image   i = m_images.GetImage(display.ImageLabel);
                p.BackgroundImage       = i;
                p.BackgroundImageLayout = ImageLayout.Center;
                p.Location  = new Point(checkBox.Width, 0);
                p.Anchor    = System.Windows.Forms.AnchorStyles.Left;
                p.Dock      = System.Windows.Forms.DockStyle.None;
                p.Size      = new Size(17, this.Height);
                this.Width += p.Size.Width;
                this.Controls.Add(p);
                p.Click      += new EventHandler(PanelButton_Click);
                p.MouseEnter += new EventHandler(panelButton_MouseEnter);
                p.MouseLeave += new EventHandler(panelButton_MouseLeave);
                p.MouseDown  += new MouseEventHandler(panelButton_MouseDown);
            }
            this.Refresh();
        }