Inheritance: System.Windows.Forms.Panel
Esempio n. 1
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();
		}
Esempio n. 2
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.m_panelMain   = new PanelEx();
            this.panelEx2      = new PanelEx();
            this.panelEx2.Text = "Test";
            this.panelEmbedded = new PanelEx();
            this.spacer        = new PanelEx();
            this.testPanel     = new PanelEx();
            this.m_panelMain.SuspendLayout();
            this.panelEx2.SuspendLayout();
            this.SuspendLayout();
            //
            // m_panelMain
            //
            this.m_panelMain.Controls.Add(this.panelEx2);
            this.m_panelMain.Controls.Add(this.spacer);
            this.m_panelMain.Controls.Add(this.testPanel);
            this.m_panelMain.Dock = System.Windows.Forms.DockStyle.Fill;
            this.m_panelMain.DockPadding.Bottom = 0;
            this.m_panelMain.DockPadding.Left   = 2;
            this.m_panelMain.DockPadding.Right  = 2;
            this.m_panelMain.DockPadding.Top    = 0;
            this.m_panelMain.Font     = new System.Drawing.Font("Tahoma", 13F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.m_panelMain.Location = new System.Drawing.Point(0, 0);
            this.m_panelMain.Name     = "m_panelMain";
            this.m_panelMain.Size     = new System.Drawing.Size(704, 24);
            this.m_panelMain.TabIndex = 0;

            //
            // panelEx2
            //
            this.panelEx2.Controls.Add(this.panelEmbedded);
            this.panelEx2.Dock     = System.Windows.Forms.DockStyle.Right;
            this.panelEx2.Font     = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.panelEx2.Location = new System.Drawing.Point(465, 2);
            this.panelEx2.Name     = "panelEx2";
            this.panelEx2.Size     = new System.Drawing.Size(56, 20);
            this.panelEx2.TabIndex = 2;
            this.panelEx2.Text     = "Test2";
            //
            // panelEmbedded
            //
            this.panelEmbedded.Location = new System.Drawing.Point(0, 0);
            this.panelEmbedded.Name     = "panelEmbedded";
            this.panelEmbedded.Size     = new System.Drawing.Size(20, 20);
            this.panelEmbedded.TabIndex = 0;
            this.panelEmbedded.Text     = "zzz";
            //
            // spacer
            //
            this.spacer.Dock     = System.Windows.Forms.DockStyle.Right;
            this.spacer.Font     = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.spacer.Location = new System.Drawing.Point(521, 2);
            this.spacer.Name     = "spacer";
            this.spacer.Size     = new System.Drawing.Size(48, 20);
            this.spacer.TabIndex = 1;
            //
            // testPanel
            //
            this.testPanel.Dock     = System.Windows.Forms.DockStyle.Right;
            this.testPanel.Font     = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.testPanel.Location = new System.Drawing.Point(569, 2);
            this.testPanel.Name     = "testPanel";
            this.testPanel.Size     = new System.Drawing.Size(120, 20);
            this.testPanel.TabIndex = 0;
            this.testPanel.Text     = "Test";
            //
            // PaneBar
            //
            this.Controls.Add(this.m_panelMain);
            this.Name = "PaneBar";
            this.Size = new System.Drawing.Size(696, 24);
            this.m_panelMain.ResumeLayout(false);
            this.panelEx2.ResumeLayout(false);
            this.ResumeLayout(false);
        }
Esempio n. 3
0
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.m_panelMain = new PanelEx();
			this.panelEx2 = new PanelEx();
			this.panelEx2.Text = "Test";
			this.panelEmbedded = new PanelEx();
			this.spacer = new PanelEx();
			this.testPanel = new PanelEx();
			this.m_panelMain.SuspendLayout();
			this.panelEx2.SuspendLayout();
			this.SuspendLayout();
			//
			// m_panelMain
			//
			this.m_panelMain.Controls.Add(this.panelEx2);
			this.m_panelMain.Controls.Add(this.spacer);
			this.m_panelMain.Controls.Add(this.testPanel);
			this.m_panelMain.Dock = System.Windows.Forms.DockStyle.Fill;
			this.m_panelMain.DockPadding.Bottom = 0;
			this.m_panelMain.DockPadding.Left = 2;
			this.m_panelMain.DockPadding.Right = 2;
			this.m_panelMain.DockPadding.Top = 0;
			this.m_panelMain.Font = new System.Drawing.Font("Tahoma", 13F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.m_panelMain.Location = new System.Drawing.Point(0, 0);
			this.m_panelMain.Name = "m_panelMain";
			this.m_panelMain.Size = new System.Drawing.Size(704, 24);
			this.m_panelMain.TabIndex = 0;

			//
			// panelEx2
			//
			this.panelEx2.Controls.Add(this.panelEmbedded);
			this.panelEx2.Dock = System.Windows.Forms.DockStyle.Right;
			this.panelEx2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.panelEx2.Location = new System.Drawing.Point(465, 2);
			this.panelEx2.Name = "panelEx2";
			this.panelEx2.Size = new System.Drawing.Size(56, 20);
			this.panelEx2.TabIndex = 2;
			this.panelEx2.Text = "Test2";
			//
			// panelEmbedded
			//
			this.panelEmbedded.Location = new System.Drawing.Point(0, 0);
			this.panelEmbedded.Name = "panelEmbedded";
			this.panelEmbedded.Size = new System.Drawing.Size(20, 20);
			this.panelEmbedded.TabIndex = 0;
			this.panelEmbedded.Text = "zzz";
			//
			// spacer
			//
			this.spacer.Dock = System.Windows.Forms.DockStyle.Right;
			this.spacer.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.spacer.Location = new System.Drawing.Point(521, 2);
			this.spacer.Name = "spacer";
			this.spacer.Size = new System.Drawing.Size(48, 20);
			this.spacer.TabIndex = 1;
			//
			// testPanel
			//
			this.testPanel.Dock = System.Windows.Forms.DockStyle.Right;
			this.testPanel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.testPanel.Location = new System.Drawing.Point(569, 2);
			this.testPanel.Name = "testPanel";
			this.testPanel.Size = new System.Drawing.Size(120, 20);
			this.testPanel.TabIndex = 0;
			this.testPanel.Text = "Test";
			//
			// PaneBar
			//
			this.Controls.Add(this.m_panelMain);
			this.Name = "PaneBar";
			this.Size = new System.Drawing.Size(696, 24);
			this.m_panelMain.ResumeLayout(false);
			this.panelEx2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
Esempio n. 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();
        }
Esempio n. 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();
        }