⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 java基础方面的一些实例代码
💻 CS
📖 第 1 页 / 共 4 页
字号:
			// 
			// treeView1
			// 
			this.treeView1.ImageList = this.imageList1;
			this.treeView1.Location = new System.Drawing.Point(8, 17);
			this.treeView1.Name = "treeView1";
			this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
																				  new System.Windows.Forms.TreeNode("Node-0", new System.Windows.Forms.TreeNode[] {
																																									  new System.Windows.Forms.TreeNode("node-1", 3, 3, new System.Windows.Forms.TreeNode[] {
																																																																new System.Windows.Forms.TreeNode("node-11", 2, 2, new System.Windows.Forms.TreeNode[] {
																																																																																						   new System.Windows.Forms.TreeNode("node-111", 1, 1)}),
																																																																new System.Windows.Forms.TreeNode("node-12", 2, 2)}),
																																									  new System.Windows.Forms.TreeNode("node-2", 3, 3, new System.Windows.Forms.TreeNode[] {
																																																																new System.Windows.Forms.TreeNode("node-21", 2, 2)}),
																																									  new System.Windows.Forms.TreeNode("node-3", 3, 3)})});
			this.treeView1.Size = new System.Drawing.Size(120, 64);
			this.treeView1.TabIndex = 0;
			this.treeView1.DoubleClick += new System.EventHandler(this.treeView1_DoubleClick);
			this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
			// 
			// notifyIcon1
			// 
			this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
			this.notifyIcon1.Text = "notifyIcon1";
			this.notifyIcon1.Visible = true;
			this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
			// 
			// groupBox9
			// 
			this.groupBox9.Controls.Add(this.MyProcessBarPersent);
			this.groupBox9.Controls.Add(this.label2);
			this.groupBox9.Controls.Add(this.progressBar1);
			this.groupBox9.Controls.Add(this.StopProcessBar);
			this.groupBox9.Location = new System.Drawing.Point(450, 48);
			this.groupBox9.Name = "groupBox9";
			this.groupBox9.Size = new System.Drawing.Size(140, 96);
			this.groupBox9.TabIndex = 12;
			this.groupBox9.TabStop = false;
			this.groupBox9.Text = "ProcessBar Test";
			// 
			// MyProcessBarPersent
			// 
			this.MyProcessBarPersent.Location = new System.Drawing.Point(72, 56);
			this.MyProcessBarPersent.Name = "MyProcessBarPersent";
			this.MyProcessBarPersent.Size = new System.Drawing.Size(56, 24);
			this.MyProcessBarPersent.TabIndex = 7;
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(8, 56);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(48, 16);
			this.label2.TabIndex = 6;
			this.label2.Text = "完成:";
			// 
			// progressBar1
			// 
			this.progressBar1.Location = new System.Drawing.Point(8, 24);
			this.progressBar1.Name = "progressBar1";
			this.progressBar1.Size = new System.Drawing.Size(120, 24);
			this.progressBar1.TabIndex = 0;
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(456, 128);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(48, 16);
			this.label1.TabIndex = 6;
			this.label1.Text = "完成:";
			// 
			// groupBox10
			// 
			this.groupBox10.Controls.Add(this.numericUpDown1);
			this.groupBox10.Controls.Add(this.domainUpDown1);
			this.groupBox10.Location = new System.Drawing.Point(450, 152);
			this.groupBox10.Name = "groupBox10";
			this.groupBox10.Size = new System.Drawing.Size(140, 88);
			this.groupBox10.TabIndex = 13;
			this.groupBox10.TabStop = false;
			this.groupBox10.Text = "Every DropDown";
			// 
			// numericUpDown1
			// 
			this.numericUpDown1.Increment = new System.Decimal(new int[] {
																			 15,
																			 0,
																			 0,
																			 65536});
			this.numericUpDown1.Location = new System.Drawing.Point(8, 56);
			this.numericUpDown1.Maximum = new System.Decimal(new int[] {
																		   250,
																		   0,
																		   0,
																		   0});
			this.numericUpDown1.Name = "numericUpDown1";
			this.numericUpDown1.TabIndex = 1;
			this.numericUpDown1.Value = new System.Decimal(new int[] {
																		 75,
																		 0,
																		 0,
																		 0});
			// 
			// domainUpDown1
			// 
			this.domainUpDown1.Items.Add("自定义字符串1");
			this.domainUpDown1.Items.Add("自定义字符串2");
			this.domainUpDown1.Items.Add("自定义字符串3");
			this.domainUpDown1.Location = new System.Drawing.Point(8, 24);
			this.domainUpDown1.Name = "domainUpDown1";
			this.domainUpDown1.TabIndex = 0;
			this.domainUpDown1.Text = "domainUpDown1";
			// 
			// hPictureScrollBar
			// 
			this.hPictureScrollBar.AllowDrop = true;
			this.hPictureScrollBar.Location = new System.Drawing.Point(168, 344);
			this.hPictureScrollBar.Name = "hPictureScrollBar";
			this.hPictureScrollBar.Size = new System.Drawing.Size(124, 8);
			this.hPictureScrollBar.TabIndex = 14;
			this.hPictureScrollBar.TabStop = true;
			this.hPictureScrollBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hPictureScrollBar_Scroll);
			// 
			// vPictureScrollBar
			// 
			this.vPictureScrollBar.Location = new System.Drawing.Point(292, 290);
			this.vPictureScrollBar.Name = "vPictureScrollBar";
			this.vPictureScrollBar.Size = new System.Drawing.Size(8, 56);
			this.vPictureScrollBar.TabIndex = 15;
			this.vPictureScrollBar.TabStop = true;
			this.vPictureScrollBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.vPictureScrollBar_Scroll);
			// 
			// panelPicture
			// 
			this.panelPicture.Controls.Add(this.pictureBox1);
			this.panelPicture.ForeColor = System.Drawing.SystemColors.ControlLight;
			this.panelPicture.Location = new System.Drawing.Point(162, 290);
			this.panelPicture.Name = "panelPicture";
			this.panelPicture.Size = new System.Drawing.Size(132, 56);
			this.panelPicture.TabIndex = 16;
			// 
			// groupBox11
			// 
			this.groupBox11.Controls.Add(this.OpenLabel);
			this.groupBox11.Controls.Add(this.SaveLabel);
			this.groupBox11.Controls.Add(this.BrowseLabel);
			this.groupBox11.Controls.Add(this.FontLabel);
			this.groupBox11.Controls.Add(this.ColorLabel);
			this.groupBox11.Controls.Add(this.PrintLabel);
			this.groupBox11.Controls.Add(this.PrintViewLabel);
			this.groupBox11.Controls.Add(this.SetupLabel);
			this.groupBox11.Controls.Add(this.ResultLabel);
			this.groupBox11.Location = new System.Drawing.Point(450, 240);
			this.groupBox11.Name = "groupBox11";
			this.groupBox11.Size = new System.Drawing.Size(140, 136);
			this.groupBox11.TabIndex = 17;
			this.groupBox11.TabStop = false;
			this.groupBox11.Text = "Each DialogBox Test";
			// 
			// OpenLabel
			// 
			this.OpenLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.OpenLabel.Location = new System.Drawing.Point(8, 24);
			this.OpenLabel.Name = "OpenLabel";
			this.OpenLabel.Size = new System.Drawing.Size(32, 16);
			this.OpenLabel.TabIndex = 0;
			this.OpenLabel.Text = "打开";
			this.OpenLabel.Click += new System.EventHandler(this.OpenLabel_Click);
			// 
			// SaveLabel
			// 
			this.SaveLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.SaveLabel.Location = new System.Drawing.Point(48, 24);
			this.SaveLabel.Name = "SaveLabel";
			this.SaveLabel.Size = new System.Drawing.Size(32, 16);
			this.SaveLabel.TabIndex = 0;
			this.SaveLabel.Text = "保存";
			this.SaveLabel.Click += new System.EventHandler(this.SaveLabel_Click);
			// 
			// BrowseLabel
			// 
			this.BrowseLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.BrowseLabel.Location = new System.Drawing.Point(88, 24);
			this.BrowseLabel.Name = "BrowseLabel";
			this.BrowseLabel.Size = new System.Drawing.Size(32, 16);
			this.BrowseLabel.TabIndex = 0;
			this.BrowseLabel.Text = "浏览";
			this.BrowseLabel.Click += new System.EventHandler(this.BrowseLabel_Click);
			// 
			// FontLabel
			// 
			this.FontLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.FontLabel.Location = new System.Drawing.Point(8, 46);
			this.FontLabel.Name = "FontLabel";
			this.FontLabel.Size = new System.Drawing.Size(32, 16);
			this.FontLabel.TabIndex = 0;
			this.FontLabel.Text = "字体";
			this.FontLabel.Click += new System.EventHandler(this.FontLabel_Click);
			// 
			// ColorLabel
			// 
			this.ColorLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.ColorLabel.Location = new System.Drawing.Point(48, 46);
			this.ColorLabel.Name = "ColorLabel";
			this.ColorLabel.Size = new System.Drawing.Size(32, 16);
			this.ColorLabel.TabIndex = 0;
			this.ColorLabel.Text = "颜色";
			this.ColorLabel.Click += new System.EventHandler(this.ColorLabel_Click);
			// 
			// PrintLabel
			// 
			this.PrintLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.PrintLabel.Location = new System.Drawing.Point(88, 46);
			this.PrintLabel.Name = "PrintLabel";
			this.PrintLabel.Size = new System.Drawing.Size(32, 16);
			this.PrintLabel.TabIndex = 0;
			this.PrintLabel.Text = "打印";
			this.PrintLabel.Click += new System.EventHandler(this.PrintLabel_Click);
			// 
			// PrintViewLabel
			// 
			this.PrintViewLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.PrintViewLabel.Location = new System.Drawing.Point(8, 68);
			this.PrintViewLabel.Name = "PrintViewLabel";
			this.PrintViewLabel.Size = new System.Drawing.Size(32, 16);
			this.PrintViewLabel.TabIndex = 0;
			this.PrintViewLabel.Text = "预览";
			this.PrintViewLabel.Click += new System.EventHandler(this.PrintViewLabel_Click);
			// 
			// SetupLabel
			// 
			this.SetupLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.SetupLabel.Location = new System.Drawing.Point(48, 68);
			this.SetupLabel.Name = "SetupLabel";
			this.SetupLabel.Size = new System.Drawing.Size(32, 16);
			this.SetupLabel.TabIndex = 0;
			this.SetupLabel.Text = "设置";
			this.SetupLabel.Click += new System.EventHandler(this.SetupLabel_Click);
			// 
			// ResultLabel
			// 
			this.ResultLabel.AllowDrop = true;
			this.ResultLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.ResultLabel.Font = new System.Drawing.Font("宋体", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.ResultLabel.Location = new System.Drawing.Point(8, 90);
			this.ResultLabel.Name = "ResultLabel";
			this.ResultLabel.Size = new System.Drawing.Size(128, 36);
			this.ResultLabel.TabIndex = 0;
			this.ResultLabel.Text = "结果";
			this.toolTip1.SetToolTip(this.ResultLabel, "结果显示");
			// 
			// MyPrintPreviewDialog
			// 
			this.MyPrintPreviewDialog.AutoScrollMargin = new System.Drawing.Size(0, 0);
			this.MyPrintPreviewDialog.AutoScrollMinSize = new System.Drawing.Size(0, 0);
			this.MyPrintPreviewDialog.ClientSize = new System.Drawing.Size(400, 300);
			this.MyPrintPreviewDialog.Enabled = true;
			this.MyPrintPreviewDialog.Icon = ((System.Drawing.Icon)(resources.GetObject("MyPrintPreviewDialog.Icon")));
			this.MyPrintPreviewDialog.Location = new System.Drawing.Point(0, 62);
			this.MyPrintPreviewDialog.MinimumSize = new System.Drawing.Size(375, 250);
			this.MyPrintPreviewDialog.Name = "MyPrintPreviewDialog";
			this.MyPrintPreviewDialog.TransparencyKey = System.Drawing.Color.Empty;
			this.MyPrintPreviewDialog.Visible = false;
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(592, 377);
			this.Controls.Add(this.groupBox11);
			this.Controls.Add(this.panelPicture);
			this.Controls.Add(this.groupBox10);
			this.Controls.Add(this.groupBox9);
			this.Controls.Add(this.groupBox8);
			this.Controls.Add(this.groupBox7);
			this.Controls.Add(this.groupBox6);
			this.Controls.Add(this.tabControl1);
			this.Controls.Add(this.groupBox5);
			this.Controls.Add(this.linkLabel1);
			this.Controls.Add(this.toolBar1);
			this.Controls.Add(this.statusBar1);
			this.Controls.Add(this.groupBox4);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.groupBox3);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.vPictureScrollBar);
			this.Controls.Add(this.hPictureScrollBar);
			this.Menu = this.mainMenu1;
			this.Name = "Form1";
			this.Text = "Test for every kind of child control";
			this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.groupBox3.ResumeLayout(false);
			this.groupBox4.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
			this.groupBox5.ResumeLayout(false);
			this.tabControl1.ResumeLayout(false);
			this.groupBox6.ResumeLayout(false);
			this.groupBox7.ResumeLayout(false);
			this.groupBox8.ResumeLayout(false);
			this.groupBox9.ResumeLayout(false);
			this.groupBox10.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
			this.panelPicture.ResumeLayout(false);
			this.groupBox11.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		//Part 1: About ListBox
		//如何添加字符串到liastBox中
		private void PrevT_Click(object sender, System.EventArgs e)
		{
			if (TID.Text != "")
			{
				listBox2.Items.Add (TID.Text );
			}
			else 
			{
				MessageBox.Show ("Please input the No!");
			}
		}

		//如何删除liastBox中选中的字符串
		private void TNext_Click(object sender, System.EventArgs e)
		{
			if (listBox2.SelectedIndex >= 0)
			{
				listBox2.Items.RemoveAt (listBox2.SelectedIndex );
			}
			// Delete All
			//listBox2.Items.Clear ();
		}
	
		// 如何知道所选择的结果
		private void button3_Click(object sender, System.EventArgs e)
		{
			string str = "目前你的选择是第:";
			int CurrentIndex = listBox2.SelectedIndex+1;
			str += CurrentIndex.ToString();
			str += " 项";

			MessageBox.Show (str);
		}

		//Part 2: ComboBox Test
		//How to add string to the combobox
		private void button2_Click(object sender, System.EventArgs e)
		{
			if (MulQuery.FindString("有教授参与授课的所有课程") < 0) 
			{	
				MulQuery.BeginUpdate();
				MulQuery.Items.Add( "有教授参与授课的所有课程");
				MulQuery.Items.Add( "有副教授参与授课的所有课程");
				MulQuery.Items.Add( "所有选择教授所授课程的学生");
				MulQuery.Items.Add( "王心怡老师的所有学生");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -