当前位置: 首页>>代码示例>>C#>>正文


C# Forms.CheckBox类代码示例

本文整理汇总了C#中System.Windows.Forms.CheckBox的典型用法代码示例。如果您正苦于以下问题:C# CheckBox类的具体用法?C# CheckBox怎么用?C# CheckBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CheckBox类属于System.Windows.Forms命名空间,在下文中一共展示了CheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MakeControl

        public Control MakeControl(Size panelSize)
        {
            _flagButton = new CheckBox();
            _flagButton.Appearance = Appearance.Button;
            _flagButton.AutoCheck = true;
            _flagButton.Size = new Size(22, 22);
            _flagButton.ThreeState = false;
            _flagButton.Text = string.Empty;
            _flagButton.FlatStyle = FlatStyle.Flat;
            _flagButton.FlatAppearance.BorderSize = 0;
            _flagButton.FlatAppearance.MouseOverBackColor = Color.White;
            _flagButton.FlatAppearance.MouseDownBackColor = Color.White;

            _flagButton.Location = new Point(-1 + panelSize.Width - _flagButton.Width, 1);
            //          _flagButton.Location = new Point(
            //              -1 + panelSize.Width - _flagButton.Width,
            //              -1 + panelSize.Height - _flagButton.Height);

            _flagButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            _flagButton.TabStop = false;
            _flagButton.Checked = FlagIsOn;
            _flagButton.Name = _nameForTesting;
            _flagButton.MouseEnter += _flagButton_MouseEnter;
            _flagButton.MouseLeave += _flagButton_MouseLeave;
            _flagButton.CheckedChanged += OnFlagButtonCheckedChanged;

            SetFlagImage();

            return _flagButton;
        }
开发者ID:bbriggs,项目名称:wesay,代码行数:30,代码来源:AnnotationWidget.cs

示例2: TestConstructor

    public void TestConstructor() {
      using(ContainerListView listView = new ContainerListView()) {

        // Let the control create its window handle
        listView.CreateControl();
        listView.Columns.Add("Numeric");
        listView.Columns.Add("Spelled");
        listView.Columns.Add("Nonsense");

        addRow(listView, "1", "One");
        addRow(listView, "2", "Two");
        addRow(listView, "3", "Three");

        using(CheckBox checkBox = new CheckBox()) {
          listView.EmbeddedControls.Add(new ListViewEmbeddedControl(checkBox, 2, 0));
          listView.EmbeddedControls.Clear();

          listView.Refresh();

          ListViewEmbeddedControl embeddedControl = new ListViewEmbeddedControl(
            checkBox, 2, 0
          );
          listView.EmbeddedControls.Add(embeddedControl);
          listView.EmbeddedControls.Remove(embeddedControl);

          listView.Refresh();
        }

      }
    }
开发者ID:pr0gramm3r1,项目名称:AngryTanks,代码行数:30,代码来源:ContainerListView.Test.cs

示例3: ChangeSettings

        public ChangeSettings()
        {
            InitializeComponent();

            for (int i = 0; i < Types.Length; i++)
            {
                if (Types[i] != typeof(bool))
                {
                    TextBox tb = new TextBox();
                    tb.Text = set[Names[i, 0]].ToString();
                    tb.Size = new Size(100, lineDist);
                    tb.Location = new Point(185, i * (lineDist + 5) + 20);
                    Controls.Add(tb);
                    controlList.Add(tb);
                    toolTip1.SetToolTip(tb, Names[i, 2]);
                }
                else
                {
                    CheckBox cb = new CheckBox();
                    cb.Checked = (bool)set[Names[i, 0]];
                    cb.Location = new Point(185, i * (lineDist + 5) + 20);
                    Controls.Add(cb);
                    controlList.Add(cb);
                    toolTip1.SetToolTip(cb, Names[i, 2]);
                }

                Label l = new Label();
                l.Text = Names[i, 1];
                l.AutoSize = true;
                l.Location = new Point(180 - TextRenderer.MeasureText(l.Text, new Font(l.Font.FontFamily, l.Font.Size, l.Font.Style)).Width, i * (lineDist + 5) + 20);
                Controls.Add(l);
                toolTip1.SetToolTip(l, Names[i, 2]);
            }
        }
开发者ID:c37-cae,项目名称:GrblHeightProbe2,代码行数:34,代码来源:ChangeSettings.cs

示例4: osd_screen

		public osd_screen (int num, OSD aosd)
		{
			number=num;
			osd=aosd;
			
			num+=1;
			
			this.tabPage = new System.Windows.Forms.TabPage();		
			this.panelItems=new Panel[64];
			this.panelItems_default = new Panel[64];
			this.LIST_items=new System.Windows.Forms.TreeView();
			this.rbtSortCategory = new System.Windows.Forms.RadioButton();
            this.rbtSortAlphabetic = new System.Windows.Forms.RadioButton();
			this.groupBox = new System.Windows.Forms.GroupBox();
			this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.NUM_Y = new System.Windows.Forms.NumericUpDown();
            this.NUM_X = new System.Windows.Forms.NumericUpDown();
			this.pictureBox = new System.Windows.Forms.PictureBox();
			this.chkSign = new System.Windows.Forms.CheckBox();
			
			this.tabPage.SuspendLayout();
			this.groupBox.SuspendLayout();
			this.pictureBox.SuspendLayout();
		}
开发者ID:svpcom,项目名称:minimosd-extra,代码行数:25,代码来源:osd_screen.cs

示例5: InitializeComponent

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.btnRun = new System.Windows.Forms.Button();
			this.btnAbout = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.checkBox1 = new System.Windows.Forms.CheckBox();
			this.SuspendLayout();
			// 
			// btnRun
			// 
			this.btnRun.Location = new System.Drawing.Point(448, 56);
			this.btnRun.Name = "btnRun";
			this.btnRun.Size = new System.Drawing.Size(72, 23);
			this.btnRun.TabIndex = 2;
			this.btnRun.Text = "Run";
			this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
			// 
			// btnAbout
			// 
			this.btnAbout.Location = new System.Drawing.Point(528, 56);
			this.btnAbout.Name = "btnAbout";
			this.btnAbout.TabIndex = 3;
			this.btnAbout.Text = "Close";
			this.btnAbout.Click += new System.EventHandler(this.btnAbout_Click);
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label1.Location = new System.Drawing.Point(16, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(558, 18);
			this.label1.TabIndex = 4;
			this.label1.Text = "The sample demonstrates how to create percent stacked line chart in an excel work" +
				"book.";
			// 
			// checkBox1
			// 
			this.checkBox1.Location = new System.Drawing.Point(24, 48);
			this.checkBox1.Name = "checkBox1";
			this.checkBox1.Size = new System.Drawing.Size(160, 24);
			this.checkBox1.TabIndex = 5;
			this.checkBox1.Text = "Stacked markers chart";
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(616, 94);
			this.Controls.Add(this.checkBox1);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.btnAbout);
			this.Controls.Add(this.btnRun);
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "Form1";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Chart sample";
			this.ResumeLayout(false);

		}
开发者ID:spirecomponent,项目名称:.NETExcelLibrary,代码行数:64,代码来源:Form1.cs

示例6: CheckBoxText

 private void CheckBoxText(CheckBox box)
 {
     if (box.Text == "Да")
         box.Text = "Нет";
     else
         box.Text = "Да";
 }
开发者ID:BEaStia,项目名称:atomic-event-logger,代码行数:7,代码来源:FormularINESControl.cs

示例7: ConfigUI

        /// <summary>
        /// Configure After Capture Tasks UI
        /// </summary>
        /// <param name="config">Initial config</param>
        /// <param name="chkAfterCaptureTask_CheckedChanged">Event handler of the parent form</param>
        public void ConfigUI(Subtask config, EventHandler chkAfterCaptureTask_CheckedChanged)
        {
            var tasks = Enum.GetValues(typeof(Subtask)).Cast<Subtask>().Select(x => new
            {
                Description = x.GetDescription(),
                Enum = x
            });

            flpTasks.Controls.Clear();

            foreach (var job in tasks)
            {
                switch (job.Enum)
                {
                    case Subtask.None:
                        continue;
                }

                CheckBox chkAfterCaptureTask = new CheckBox();
                chkAfterCaptureTask.Tag = job.Enum;
                chkAfterCaptureTask.Text = job.Description;
                chkAfterCaptureTask.AutoSize = true;
                chkAfterCaptureTask.CheckedChanged += chkAfterCaptureTask_CheckedChanged;
                chkAfterCaptureTask.Checked = config.HasFlag(job.Enum);
                flpTasks.Controls.Add(chkAfterCaptureTask);
            }
        }
开发者ID:dmitriydel,项目名称:sharexmod,代码行数:32,代码来源:AfterCaptureTasksUI.cs

示例8: MainForm

        public MainForm(string[] files)
        {
            InitializeComponent();

            Data.Init("items.txt");

            boxItems.LargeImageList = Data.list;
            boxItems.ItemDrag += ItemDrag;

            foreach (Data.Group group in Data.groups.Values) {
                CheckBox box = new CheckBox();
                box.Size = new Size(26, 26);
                box.Location = new Point(Width-189, 29 + groups.Count*27);
                box.ImageList = Data.list;
                box.ImageIndex = group.imageIndex;
                box.Appearance = Appearance.Button;
                box.Anchor = AnchorStyles.Top | AnchorStyles.Right;
                box.Checked = true;
                box.Tag = group;
                box.MouseDown += ItemMouseDown;
                Controls.Add(box);
                groups.Add(box);
            }

            UpdateItems();

            foreach (string file in files)
                if (File.Exists(file)) Open(file);
        }
开发者ID:embix,项目名称:INVedit,代码行数:29,代码来源:MainForm.cs

示例9: ViewFieldControl

		/// <summary>
		/// Constructor
		/// </summary>
		public ViewFieldControl()
		{
			InitializeComponent();

			ControlBoxes = new CheckBox[]
			{
				ABox,
				BBox,
				CBox,
				DBox,
				EBox,
				FBox,
				GBox,
				HBox,
				IBox,
				JBox,
				KBox,
				LBox,
				MBox,
				NBox,
				TeamBox,
				OBox,
			};


			LBox.Checked = true;
		}
开发者ID:melkor54248,项目名称:dungeoneye,代码行数:30,代码来源:ViewFieldControl.cs

示例10: loadConfig

        private void loadConfig(String file)
        {
            XmlDocument xDoc = new XmlDocument();
            xDoc.Load(file==null?"config.xml":file);
            int wait=0;
            String sWait=xDoc.DocumentElement.GetAttribute("wait");
            if (sWait!=null && (sWait=sWait.Trim()).Length>0) wait=Convert.ToInt32(sWait);

            XmlNodeList apps = xDoc.GetElementsByTagName("app");

            Run.runners=new List<Run>();
            int i=0;
            int w=0;
            int h=0;
            foreach (XmlElement nodo in apps) {
                CheckBox chkList =new CheckBox();
                chkList.Text = nodo.GetAttribute("nombre");
                chkList.Left=5;
                chkList.Top=chkList.Height*(i++);
                this.Controls.Add(chkList);
                w=Math.Max(w,chkList.Width);
                h=chkList.Bottom;
                Run r=new Run(nodo,chkList);
                r.Seg=r.Seg+wait;
                Run.runners.Add(r);
            }

            this.Width=w+5;
            this.Height=h+25;

            if (!Run.starTimer()) this.Text=this.Text+'.';
            Run.form=this;
        }
开发者ID:santos82,项目名称:pliqui,代码行数:33,代码来源:MainForm.cs

示例11: VersionManager_Load

        private void VersionManager_Load(object sender, EventArgs e)
        {
            System.Type type = MainPage.GetAssembly().GetType("PB.Version");

            int index = 0;
            foreach (int enum_value in Enum.GetValues(type))
            {
                String name = Enum.GetName(type, enum_value);

                CheckBox check = new CheckBox();
                check.Text = name;
                check.Location = new Point(30 * (index % 2 == 0 ? 1 : 4), 35 * (index / 2 + 1) );
                check.Size = new System.Drawing.Size(78, 20);

                //int version = Enum.Parse(type, check.Text.ToString()).GetHashCode();

                if (name == "GLOBAL" || MainPage.m_ConfigPath.version.Contains(enum_value))
                {
                    check.Checked = true;
                }

                index++;

                this.Controls.Add(check);
            }
        }
开发者ID:LazyPlanet,项目名称:TemplateEditor,代码行数:26,代码来源:VersionManager.cs

示例12: GetTime

 public bool GetTime(ComboBox cmb_Hour, ComboBox cmb_Minute,CheckBox chb,GroupBox gbx)
 {
     using (ds=new DataSet())
     {
         ds = tpdal.GetTime();
         if (ds != null && ds.Tables.Count > 0)
         {
             if (ds.Tables.Count > 0)
             {
                 string str = ds.Tables[0].Rows[0][0].ToString();
                 if (str.Equals("0"))
                 {
                     chb.Checked = false;
                     gbx.Enabled = false;
                     cmb_Hour.Text = "00";
                     cmb_Minute.Text = "00";
                 }
                 else
                 {
                     chb.Checked = true;
                     gbx.Enabled = true;
                     cmb_Hour.Text = str.Substring(0, 2);
                     cmb_Minute.Text = str.Substring(3, 2);
                 }
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:ZoeCheck,项目名称:128_5.6_2010,代码行数:30,代码来源:TaskTimeBLL.cs

示例13: MakeControlls

        public void MakeControlls()
        {
            for(int i= 0 ; i < ClipBoardData.id_max; i++)
            {
                LinkLabel label = new LinkLabel();
                label.AutoSize = true;
                label.Location = new System.Drawing.Point(22, i * 25);
                label.Name = "lblLink_" + i;
                label.Size = new System.Drawing.Size(55, 13);
                label.TabStop = true;
                label.Visible = true;
                label.Tag = i;
                label.LinkBehavior = LinkBehavior.HoverUnderline;
                label.Click += new EventHandler(ClipBoardEntery_Click);

                CheckBox chkBox = new CheckBox();
                chkBox.Location = new System.Drawing.Point(5, i * 25);
                chkBox.Size = new System.Drawing.Size(14, 14);
                chkBox.Name = "chkBox_" + i;
                chkBox.TabStop = true;
                chkBox.Tag = i;
                chkBox.CheckedChanged +=new EventHandler(ClipBoardChkBox_CheckedChanged);

                panel1.Controls.Add(label);
                panel1.Controls.Add(chkBox);

            }
        }
开发者ID:dmarijanovic,项目名称:uber-tools,代码行数:28,代码来源:NTHClipBoardFlyWindow.cs

示例14: OpFlagsControl

        public OpFlagsControl(BHAVEditor master, EditorScope scope, VMPrimitiveOperand operand, string title, OpFlag[] flags)
        {
            InitializeComponent();
            this.FlagsPanel.Controls.Clear();
            Master = master;
            Scope = scope;
            Operand = operand;
            Flags = flags;
            FlagChecks = new CheckBox[flags.Length];

            int i = 0;
            foreach (var flag in flags)
            {
                var check = new CheckBox();
                check.AutoSize = true;
                check.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
                check.Size = new System.Drawing.Size(195, 17);
                check.Text = flag.Title;
                check.UseVisualStyleBackColor = true;
                check.CheckedChanged += Check_CheckedChanged;

                FlagChecks[i++] = check;
                CheckToFlag.Add(check, flag);
                this.FlagsPanel.Controls.Add(check);
            }

            OperandUpdated();
        }
开发者ID:Daribon,项目名称:FreeSO,代码行数:28,代码来源:OpFlagsControl.cs

示例15: MainForm

        public MainForm(string[] files)
        {
            InitializeComponent();

            Data.Init("items.txt");

            labelVersion.Text = Data.mcVersion;

            boxItems.LargeImageList = Data.list;
            boxItems.ItemDrag += ItemDrag;

            foreach (Data.Group group in Data.groups.Values) {
                CheckBox box = new CheckBox();
                box.Size = new Size(26, 26);
                box.Location = new Point(Width-205 + (groups.Count / 12) * 27, 29 + (groups.Count % 12) * 27);
                box.ImageList = Data.list;
                box.ImageIndex = group.imageIndex;
                box.Appearance = Appearance.Button;
                box.Checked = true;
                box.Tag = group;
                box.MouseDown += ItemMouseDown;
                Controls.Add(box);
                groups.Add(box);
            }
            Width += ((groups.Count-1) / 12) * 27;

            UpdateItems();

            foreach (string file in files)
                if (File.Exists(file)) Open(file);
        }
开发者ID:chillgamingAZ,项目名称:INVedit,代码行数:31,代码来源:MainForm.cs


注:本文中的System.Windows.Forms.CheckBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。