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

📄 wsusercontrol.cs

📁 ASP C#代码实例 适合初学人士学习使用
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace WindowsControl
{
	/// <summary>
	/// Summary description for wsUserControl.
	/// </summary>
	public class wsUserControl : System.Windows.Forms.UserControl
	{
		private System.Windows.Forms.DataGrid myDataGrid;
		private System.Windows.Forms.Button getData;
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public wsUserControl()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitializeComponent call

		}

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Component Designer generated code
		/// <summary> 
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.myDataGrid = new System.Windows.Forms.DataGrid();
			this.getData = new System.Windows.Forms.Button();
			((System.ComponentModel.ISupportInitialize)(this.myDataGrid)).BeginInit();
			this.SuspendLayout();
			// 
			// myDataGrid
			// 
			this.myDataGrid.DataMember = "";
			this.myDataGrid.Dock = System.Windows.Forms.DockStyle.Top;
			this.myDataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.myDataGrid.Location = new System.Drawing.Point(0, 0);
			this.myDataGrid.Name = "myDataGrid";
			this.myDataGrid.Size = new System.Drawing.Size(432, 216);
			this.myDataGrid.TabIndex = 0;
			// 
			// getData
			// 
			this.getData.Location = new System.Drawing.Point(144, 240);
			this.getData.Name = "getData";
			this.getData.Size = new System.Drawing.Size(96, 23);
			this.getData.TabIndex = 1;
			this.getData.Text = "获取数据";
			this.getData.Click += new System.EventHandler(this.getData_Click);
			// 
			// wsUserControl
			// 
			this.Controls.Add(this.getData);
			this.Controls.Add(this.myDataGrid);
			this.Name = "wsUserControl";
			this.Size = new System.Drawing.Size(432, 272);
			((System.ComponentModel.ISupportInitialize)(this.myDataGrid)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void getData_Click(object sender, System.EventArgs e)
		{
			Cursor = Cursors.WaitCursor;
			WindowsService.MyService staffService = new WindowsControl.WindowsService.MyService();

			myDataGrid.DataSource = staffService.GetStaffs();
			Cursor = Cursors.Default;

		}
	}
}

⌨️ 快捷键说明

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