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

📄 taskcarreport.cs

📁 车载GPS?今天这个就是最好的工具
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace taskcarReport
{
	/// <summary>
	/// UserControl1 的摘要说明。
	/// </summary>
	public class taskcarReport : System.Windows.Forms.UserControl
	{
		private AxVSFlex7.AxVSFlexGrid vsGrid;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;
		private string _SerialNo;
		public int [] recordData=new int [13];
		public string [] data =new string[13];
		public taskcarReport()
		{
			// 该调用是 Windows.Forms 窗体设计器所必需的。
			InitializeComponent();
			// TODO: 在 InitComponent 调用后添加任何初始化

		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if( components != null )
					components.Dispose();
			}
			base.Dispose( disposing );
		}

		#region 组件设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器 
		/// 修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(taskcarReport));
			this.vsGrid = new AxVSFlex7.AxVSFlexGrid();
			((System.ComponentModel.ISupportInitialize)(this.vsGrid)).BeginInit();
			this.SuspendLayout();
			// 
			// vsGrid
			// 
			this.vsGrid.DataSource = null;
			this.vsGrid.Location = new System.Drawing.Point(8, 8);
			this.vsGrid.Name = "vsGrid";
			this.vsGrid.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("vsGrid.OcxState")));
			this.vsGrid.Size = new System.Drawing.Size(816, 568);
			this.vsGrid.TabIndex = 1;
			this.vsGrid.ClickEvent += new System.EventHandler(this.vsGrid_ClickEvent);
			// 
			// taskcarReport
			// 
			this.Controls.Add(this.vsGrid);
			this.Name = "taskcarReport";
			this.Size = new System.Drawing.Size(832, 584);
			this.Load += new System.EventHandler(this.taskcarReport_Load);
			((System.ComponentModel.ISupportInitialize)(this.vsGrid)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion
		private void taskcarReport_Load(object sender, System.EventArgs e)
		{
			vsGrid.SheetBorder =Color.White;
			vsGrid.RowHeightMin =600;
			vsGrid.RowHeightMax =650;
			vsGrid.Editable =VSFlex7.EditableSettings.flexEDKbd;
			vsGrid.AllowSelection =true;
			vsGrid.MergeCells= VSFlex7.MergeSettings.flexMergeFree;
			vsGrid.MergeCompare = VSFlex7.MergeCompareSettings.flexMCExact;
			vsGrid.set_MergeRow(7,true);
			vsGrid.set_MergeRow(8,true);
			vsGrid.set_MergeRow(9,true);
			vsGrid.set_MergeRow(12,true);
			vsGrid.set_MergeRow(0,true);
			vsGrid.set_MergeRow(2,true);
			vsGrid.set_MergeRow(5,true);
			vsGrid.set_MergeRow(6,true);
			vsGrid.set_MergeCol(0,true);
			vsGrid.set_MergeCol(1,true);
			vsGrid.set_MergeCol(2,true);
			vsGrid.set_Cell(VSFlex7.CellPropertySettings.flexcpChecked,1,1,7,6, VSFlex7.CellCheckedSettings.flexUnchecked );
			//			vsGrid.set_Cell(VSFlex7.CellPropertySettings.flexcpFontSize ,1,1,1,6,VSFlex7.AutoSizeSettings.flexAutoSizeRowHeight );
			//			vsGrid.set_Cell(VSFlex7.CellPropertySettings.flexcpChecked,5,1,7,5, VSFlex7.CellCheckedSettings.flexUnchecked );
			vsGrid.set_Cell(VSFlex7.CellPropertySettings.flexcpChecked,8,3,12,6, VSFlex7.CellCheckedSettings.flexUnchecked );

		}
		private void vsGrid_ClickEvent(object sender, System.EventArgs e)
		{
			int iRow=vsGrid.Row;
			int iCol=this.vsGrid.Col;
			this.vsGrid.ShowCell(iRow,iCol);
			if (iRow>6) SelectOne(iRow,iCol);

			//			this.vsGrid.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor,iRow,iCol,iRow,iCol,);
			object CheckState=this.vsGrid.get_Cell(VSFlex7.CellPropertySettings.flexcpChecked,iRow,iCol,iRow,iCol);
			if (Convert.ToInt16( CheckState)==1)
			{
				this.vsGrid.set_Cell(VSFlex7.CellPropertySettings.flexcpChecked,iRow,iCol,iRow,iCol,VSFlex7.CellCheckedSettings.flexUnchecked);
				this.recordData[iRow] =0;
			}
			else if (Convert.ToInt16( CheckState)==2)
			{
				this.vsGrid.set_Cell(VSFlex7.CellPropertySettings.flexcpChecked,iRow,iCol,iRow,iCol,VSFlex7.CellCheckedSettings.flexChecked);
				this.recordData[iRow] =iCol;
			}
			
		}
		private void SelectOne(int Row,int Col)
		{
			object CheckState=this.vsGrid.get_Cell(VSFlex7.CellPropertySettings.flexcpChecked,Row,Col,Row,Col);
			if (Convert.ToInt16( CheckState)!=0)
			{
				if (this.recordData[Row]!=0)
				{
					this.vsGrid.set_Cell(VSFlex7.CellPropertySettings.flexcpChecked,Row,recordData[Row],Row,recordData[Row],VSFlex7.CellCheckedSettings.flexUnchecked);
					this.recordData[Row] =0;
				}
			}

		}

		public string  Accident
		{
			get
			{
				return "";
			}
		}
		public string  SerialNo
		{
			get
			{
				return _SerialNo;
			}
			set
			{
				_SerialNo=value;
				this.vsGrid.set_Cell(VSFlex7.CellPropertySettings.flexcpText,0,1,0,6,value) ;
			}
		}
		public void LoadSelectData()
		{
			for (int j=1;j<13;j++)
			{
				string strData="";
				for (int i=1;i<7;i++)
				{
					object CheckState=this.vsGrid.get_Cell(VSFlex7.CellPropertySettings.flexcpChecked,j,i,j,i);
					if (Convert.ToInt16( CheckState)==1)
					{
						if (strData=="")
							strData=strData+(i).ToString();
						else
							strData=strData+"&"+(i).ToString();
					}

				}
				this.data[j] =(strData==""?"0":strData);
			}
		}
	}


}

⌨️ 快捷键说明

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