public void DrawCheckBox(RibbonRenderEventArgs e, RibbonCheckBox checkbox)
        {

            Rectangle checkboxBorder = new Rectangle(checkbox.Bounds.X + 2, checkbox.Bounds.Y + 2, 13, 13);

			if (checkbox.CheckedState == CheckState.Unchecked) {
				if (checkbox.Selected) {
					e.Graphics.DrawImage(Properties.Resources.checkbox_uh, checkboxBorder.Location);
				} else {
					e.Graphics.DrawImage(Properties.Resources.checkbox_un, checkboxBorder.Location);
				}
			} else if (checkbox.CheckedState == CheckState.Checked) {
				if (checkbox.Pressed) {
					e.Graphics.DrawImage(Properties.Resources.checkbox_cd, checkboxBorder.Location);
				} else if (checkbox.Selected) {
					e.Graphics.DrawImage(Properties.Resources.checkbox_ch, checkboxBorder.Location);
				} else {
					e.Graphics.DrawImage(Properties.Resources.checkbox_cn, checkboxBorder.Location);
				}
			}

			Rectangle textArea = Rectangle.FromLTRB(checkbox.Bounds.Left + 2 + 15, checkbox.Bounds.Top + 2,
				checkbox.Bounds.Right - 2, checkbox.Bounds.Bottom - 2);

            StringFormat sf = new StringFormat();
            sf.Alignment = StringAlignment.Center;
            sf.LineAlignment = StringAlignment.Center;

            using (Brush b = new SolidBrush(GetTextColor(true, ColorTable.PanelText)))
            {
                e.Graphics.DrawString(checkbox.Text, e.Ribbon.Font, b, textArea, sf);
            }

            //g.FillRectangle(Brushes.Black, checkbox.Bounds);
        }
Ejemplo n.º 2
0
		private void InitViewTab()
		{
			chkBackground = new RibbonCheckBox("Background");
			chkBackground.Checked = true;
			chkBackground.CheckedChanged += new EventHandler(showBackgroundRibbonButton_Click);

			chkInterface = new RibbonCheckBox("Interface");
			chkInterface.Checked = true;
			chkInterface.CheckedChanged += new EventHandler(showInterfaceRibbonButton_Click);

			chkObjects = new RibbonCheckBox("Objects");
			chkObjects.Checked = true;
			chkObjects.CheckedChanged += new EventHandler(showPegsRibbonButton_Click);

			chkCollision = new RibbonCheckBox("Collision");
			chkCollision.CheckedChanged += new EventHandler(showCollisionRibbonButton_Click);

			chkPreview = new RibbonCheckBox("Preview");
			chkPreview.CheckedChanged += new EventHandler(showPreviewRibbonButton_Click);

			RibbonPanel panelShowHide = new RibbonPanel("Show / Hide");
			panelShowHide.Items.Add(chkBackground);
			panelShowHide.Items.Add(chkInterface);
			panelShowHide.Items.Add(chkObjects);
			panelShowHide.Items.Add(chkCollision);
			panelShowHide.Items.Add(chkPreview);

			RibbonButton btnPackExplorer = new RibbonButton("Pack Explorer");
			btnPackExplorer.Image = Resources.pack_explorer_32;
			btnPackExplorer.Click += new EventHandler(packExplorerRibbonButton_Click);

			RibbonButton btnProperties = new RibbonButton("Properties");
			btnProperties.Image = Resources.properties_32;
			btnProperties.Click += new EventHandler(propertiesRibbonButton_Click);

			RibbonButton btnEntryList = new RibbonButton("Entry List");
			btnEntryList.Image = Resources.properties_32;
			btnEntryList.Click += new EventHandler(entryListRibbonButton_Click);

			RibbonPanel panelWindow = new RibbonPanel("Window");
			panelWindow.Items.Add(btnPackExplorer);
			panelWindow.Items.Add(btnProperties);
			panelWindow.Items.Add(btnEntryList);

			RibbonTab tabView = new RibbonTab(mRibbon, "View");
			tabView.Panels.Add(panelShowHide);
			tabView.Panels.Add(panelWindow);
			mRibbon.Tabs.Add(tabView);
		}
Ejemplo n.º 3
0
 private RibbonCheckBox AddCheckBox(RibbonItemCollection collection, string text, string msoCommandName)
 {
     RibbonCheckBox checkbox = new RibbonCheckBox();
     checkbox.Text = text;
     collection.Add(checkbox);
     AssignAction(checkbox, msoCommandName);
     return checkbox;
 }