private void UDataViewForm_Load(object sender, EventArgs e) { if (!this.isDesigning) { this.DoubleBuffered = true; SystemEnvironment.CreateInstance(); this.dgvDataView.Columns["clmNum"].Visible = false; this.dgvDataView.Columns["clmStatus"].Visible = false; this.dgvDataView.Columns["clmID"].Visible = false; this.dgvDataView.Columns["clmOpenFlag"].Visible = false; this.dgvDataView.Columns["clmPrintFlag"].Visible = false; this.dgvDataView.Columns["clmFolder"].Visible = false; this.dgvDataView.Columns["clmSaveFlag"].Visible = false; this.dgvDataView.Columns["clmDelete"].Visible = false; this.dgvDataView.Columns["clmFileName"].Visible = false; this.dgvDataView.Columns["clmDataInfo"].Visible = false; this.dgvDataView.Columns["clmUserCode"].Visible = false; this.dgvDataView.Columns["clmAttach"].Visible = false; this.dgvDataView.Columns["clmAirSea"].Visible = false; this.dgvDataView.Columns["clmSignflg"].Visible = false; this.dgvDataView.Columns["clmSignFilePath"].Visible = false; DBSort item = new DBSort { ID = 1, Name = "clmTimeStamp", Flag = false }; this.DBSortList.Add(item); } }
private void dgvDataView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { this.DragFlag = false; if (this.DBSortList.Count == 0) { DBSort item = new DBSort { ID = 1, Name = this.dgvDataView.Columns[e.ColumnIndex].Name, Flag = true }; this.DBSortList.Add(item); } else if (this.DBSortList.Count == 1) { if (this.DBSortList[0].Name == this.dgvDataView.Columns[e.ColumnIndex].Name) { DBSort sort2 = this.DBSortList[0]; sort2.Flag = !sort2.Flag; this.DBSortList[0] = sort2; } else { DBSort sort3 = new DBSort { ID = 2, Name = this.dgvDataView.Columns[e.ColumnIndex].Name, Flag = true }; this.DBSortList.Insert(0, sort3); } } else if (this.DBSortList.Count == 2) { if (this.DBSortList[0].Name == this.dgvDataView.Columns[e.ColumnIndex].Name) { DBSort sort4 = this.DBSortList[0]; sort4.Flag = !sort4.Flag; this.DBSortList[0] = sort4; } else if (this.DBSortList[1].Name == this.dgvDataView.Columns[e.ColumnIndex].Name) { DBSort sort5 = new DBSort(); sort5 = this.DBSortList[0]; this.DBSortList.RemoveAt(0); this.DBSortList.Add(sort5); } else { this.DBSortList.RemoveAt(1); DBSort sort6 = new DBSort { ID = 1, Name = this.dgvDataView.Columns[e.ColumnIndex].Name, Flag = true }; this.DBSortList.Insert(0, sort6); } } this.DataViewRepaint(false); }