private void InitGridView(string type) { string CodeColumn = ""; string NameColumn = ""; switch (type) { case "VENDER": CodeColumn = "venderid"; NameColumn = "vendername"; break; case "EQUIP": CodeColumn = "equipmentid"; NameColumn = "equipmentname"; break; case "USER": case "LOGIN": CodeColumn = "userid"; NameColumn = "username"; break; default: break; } dtgCode.AutoGenerateColumns = false; CommonFuction.SetDataGridViewColumnStyle(dtgCode, "코드", CodeColumn, "code", typeof(string), 130); CommonFuction.SetDataGridViewColumnStyle(dtgCode, "이름", NameColumn, "name", typeof(string), 250); }
/// <summary> /// 그리드 세팅 /// </summary> private void InitializeGrid() { // 대분류 grdTopCategory.AutoGenerateColumns = false; grdTopCategory.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; grdTopCategory.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter; grdTopCategory.AllowUserToAddRows = false; grdTopCategory.SelectionMode = DataGridViewSelectionMode.FullRowSelect; grdTopCategory.DefaultCellStyle.SelectionBackColor = Color.Yellow; grdTopCategory.DefaultCellStyle.SelectionForeColor = Color.Black; CommonFuction.SetDataGridViewColumnStyle(grdTopCategory, "NO", "NO", "NO", typeof(string), 50, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdTopCategory, "불량코드", "DEFECTCODE", "DEFECTCODE", typeof(string), 120, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdTopCategory, "불량명", "DEFECTCODENAME", "DEFECTCODENAME", typeof(string), 180, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdTopCategory, "유효여부", "VALIDSTATE", "VALIDSTATE", typeof(string), 100, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdTopCategory, "상위불량코드", "PARENTDEFECTCODE", "PARENTDEFECTCODE", typeof(string), 100, true, false, DataGridViewContentAlignment.MiddleLeft, 10); CommonFuction.SetDataGridViewColumnStyle(grdTopCategory, "레벨", "LEVEL", "LEVEL", typeof(string), 100, true, false, DataGridViewContentAlignment.MiddleLeft, 10); CommonFuction.SetDataGridViewColumnStyle(grdTopCategory, "행변경타입", "ROWTYPE", "ROWTYPE", typeof(string), 100, true, false, DataGridViewContentAlignment.MiddleLeft, 10); // 중분류 grdMiddleCategory.AutoGenerateColumns = false; grdMiddleCategory.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; grdMiddleCategory.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter; grdMiddleCategory.AllowUserToAddRows = false; grdMiddleCategory.SelectionMode = DataGridViewSelectionMode.FullRowSelect; grdMiddleCategory.DefaultCellStyle.SelectionBackColor = Color.Yellow; grdMiddleCategory.DefaultCellStyle.SelectionForeColor = Color.Black; CommonFuction.SetDataGridViewColumnStyle(grdMiddleCategory, "NO", "NO", "NO", typeof(string), 50, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdMiddleCategory, "불량코드", "DEFECTCODE", "DEFECTCODE", typeof(string), 120, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdMiddleCategory, "불량명", "DEFECTCODENAME", "DEFECTCODENAME", typeof(string), 180, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdMiddleCategory, "유효여부", "VALIDSTATE", "VALIDSTATE", typeof(string), 100, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdMiddleCategory, "상위불량코드", "PARENTDEFECTCODE", "PARENTDEFECTCODE", typeof(string), 100, true, false, DataGridViewContentAlignment.MiddleLeft, 10); CommonFuction.SetDataGridViewColumnStyle(grdMiddleCategory, "레벨", "LEVEL", "LEVEL", typeof(string), 100, true, false, DataGridViewContentAlignment.MiddleLeft, 10); CommonFuction.SetDataGridViewColumnStyle(grdMiddleCategory, "행변경타입", "ROWTYPE", "ROWTYPE", typeof(string), 100, true, false, DataGridViewContentAlignment.MiddleLeft, 10); // 불량상세 grdDetailCategory.AutoGenerateColumns = false; grdDetailCategory.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; grdDetailCategory.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter; grdDetailCategory.AllowUserToAddRows = false; grdDetailCategory.SelectionMode = DataGridViewSelectionMode.FullRowSelect; grdDetailCategory.DefaultCellStyle.SelectionBackColor = Color.Yellow; grdDetailCategory.DefaultCellStyle.SelectionForeColor = Color.Black; CommonFuction.SetDataGridViewColumnStyle(grdDetailCategory, "NO", "NO", "NO", typeof(string), 50, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdDetailCategory, "불량코드", "DEFECTCODE", "DEFECTCODE", typeof(string), 120, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdDetailCategory, "불량명", "DEFECTCODENAME", "DEFECTCODENAME", typeof(string), 180, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdDetailCategory, "유효여부", "VALIDSTATE", "VALIDSTATE", typeof(string), 100, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdDetailCategory, "상위불량코드", "PARENTDEFECTCODE", "PARENTDEFECTCODE", typeof(string), 100, true, false, DataGridViewContentAlignment.MiddleLeft, 10); CommonFuction.SetDataGridViewColumnStyle(grdDetailCategory, "레벨", "LEVEL", "LEVEL", typeof(string), 100, true, false, DataGridViewContentAlignment.MiddleLeft, 10); CommonFuction.SetDataGridViewColumnStyle(grdDetailCategory, "행변경타입", "ROWTYPE", "ROWTYPE", typeof(string), 100, true, false, DataGridViewContentAlignment.MiddleLeft, 10); }
/// <summary> /// 그리드 세팅 /// </summary> private void InitializeGrid() { grdUser.AutoGenerateColumns = false; grdUser.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; grdUser.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter; grdUser.AllowUserToAddRows = false; CommonFuction.SetDataGridViewColumnStyle(grdUser, "NO", "NO", "NO", typeof(string), 50, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdUser, "순번", "SEQUENCE", "SEQUENCE", typeof(int), 100, false, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdUser, "사번", "USERNUMBER", "USERNUMBER", typeof(string), 200, false, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdUser, "사용자명", "USERNAME", "USERNAME", typeof(string), 200, false, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdUser, "행변경타입", "ROWTYPE", "ROWTYPE", typeof(string), 100, false, false, DataGridViewContentAlignment.MiddleLeft, 10); }
/// <summary> /// 그리드 세팅 /// </summary> private void InitializeGrid() { grdFrameInfo.AutoGenerateColumns = false; grdFrameInfo.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; grdFrameInfo.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter; grdFrameInfo.AllowUserToAddRows = false; CommonFuction.SetDataGridViewColumnStyle(grdFrameInfo, "NO", "NO", "NO", typeof(string), 50, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdFrameInfo, "시간", "PRODUCTTYPE", "rackid", typeof(string), 200, false, true, DataGridViewContentAlignment.MiddleCenter, 20); CommonFuction.SetDataGridViewColumnStyle(grdFrameInfo, "프레임", "PRODUCTNAME", "durableid", typeof(int), 100, false, true, DataGridViewContentAlignment.MiddleCenter, 20); CommonFuction.SetDataGridViewColumnStyle(grdFrameInfo, "자동판정등급", "PRODUCTNO", "productname", typeof(string), 100, false, true, DataGridViewContentAlignment.MiddleCenter, 80); CommonFuction.SetDataGridViewColumnStyle(grdFrameInfo, "불량유형", "CUSTOMERNAME", "inputdate", typeof(string), 100, false, true, DataGridViewContentAlignment.MiddleCenter, 60); CommonFuction.SetDataGridViewColumnStyle(grdFrameInfo, "최종판정", "CREATOR", "inputresult", typeof(string), 100, false, true, DataGridViewContentAlignment.MiddleCenter, 35); CommonFuction.SetDataGridViewColumnStyle(grdFrameInfo, "위치", "CREATETIME", "usedate", typeof(string), 500, false, true, DataGridViewContentAlignment.MiddleLeft, 60); CommonFuction.SetDataGridViewColumnStyle(grdFrameInfo, "행변경타입", "ROWTYPE", "ROWTYPE", typeof(string), 100, false, false, DataGridViewContentAlignment.MiddleLeft, 60); }
private void InitGridView() { dataGridView1.AutoGenerateColumns = false; dataGridView2.AutoGenerateColumns = false; dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; dataGridView1.ColumnHeadersHeight = dataGridView1.ColumnHeadersHeight * 2; dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter; dataGridView1.Paint += DataGridView1_Paint; dataGridView1.CellPainting += DataGridView1_CellPainting; dataGridView1.ColumnWidthChanged += DataGridView1_ColumnWidthChanged; dataGridView1.Scroll += DataGridView1_Scroll; btnExcel.Click += BtnExcel_Click; btnPrint.Click += BtnPrint_Click; btnSearch.Click += BtnSearch_Click; //컬럼명 setting CommonFuction.SetDataGridViewColumnStyle(dataGridView1, "No", "No", "No", typeof(string), 50, true, true, DataGridViewContentAlignment.MiddleLeft, 10); CommonFuction.SetDataGridViewColumnStyle(dataGridView1, "보관위치", "rackid", "rackid", typeof(string), 70, true, true, DataGridViewContentAlignment.MiddleCenter, 20); CommonFuction.SetDataGridViewColumnStyle(dataGridView1, "Mask No", "durableid", "durableid", typeof(string), 100, true, true, DataGridViewContentAlignment.MiddleCenter, 20); CommonFuction.SetDataGridViewColumnStyle(dataGridView1, "Mask Code", "productname", "productname", typeof(string), 150, true, true, DataGridViewContentAlignment.MiddleLeft, 80); CommonFuction.SetDataGridViewColumnStyle(dataGridView1, "입고일자", "inputdate", "inputdate", typeof(string), 150, true, true, DataGridViewContentAlignment.MiddleLeft, 60); CommonFuction.SetDataGridViewColumnStyle(dataGridView1, "수입검사 결과", "inputresult", "inputresult", typeof(string), 100, true, true, DataGridViewContentAlignment.MiddleCenter, 35); CommonFuction.SetDataGridViewColumnStyle(dataGridView1, "사용일자", "usedate", "usedate", typeof(string), 150, true, true, DataGridViewContentAlignment.MiddleLeft, 60); CommonFuction.SetDataGridViewColumnStyle(dataGridView1, "횟수", "totuseqty", "totuseqty", typeof(string), 100, true, true, DataGridViewContentAlignment.MiddleRight, 35); CommonFuction.SetDataGridViewColumnStyle(dataGridView1, "폐기일", "defectdate", "defectdate", typeof(string), 150, true, true, DataGridViewContentAlignment.MiddleLeft, 60); CommonFuction.SetDataGridViewColumnStyle(dataGridView1, "사유", "defectreason", "defectreason", typeof(string), 100, true, true, DataGridViewContentAlignment.MiddleLeft, 100); CommonFuction.SetDataGridViewColumnStyle(dataGridView1, "durableproductid", "durableproductid", "durableproductid", typeof(string), -1, false, false); CommonFuction.SetDataGridViewColumnStyle(dataGridView1, "state", "state", "state", typeof(string), -1, false, false); //헤더 병합 안된 컬럼들 가운데 정렬하기 dataGridView1.Columns["No"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns["rackid"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns["durableid"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns["productname"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns["inputdate"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns["inputresult"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; CommonFuction.SetDataGridViewColumnStyle(dataGridView2, "날짜", "usedate", "usedate", typeof(DateTime), 130, true, true, DataGridViewContentAlignment.MiddleCenter); CommonFuction.SetDataGridViewColumnStyle(dataGridView2, "횟수", "useqty", "useqty", typeof(string), 50, true, true, DataGridViewContentAlignment.MiddleRight); CommonFuction.SetDataGridViewColumnStyle(dataGridView2, "durableid", "durableid", "durableid", typeof(string), -1, false, false); }
/// <summary> /// 그리드 세팅 /// </summary> private void InitializeGrid() { grdAIjubgmentHistory.AutoGenerateColumns = false; grdAIjubgmentHistory.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; grdAIjubgmentHistory.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter; grdAIjubgmentHistory.AllowUserToAddRows = false; CommonFuction.SetDataGridViewColumnStyle(grdAIjubgmentHistory, "NO", "NO", "NO", typeof(string), 50, true, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdAIjubgmentHistory, "품목ID", "PRODUCTID", "PRODUCTID", typeof(string), 150, false, true, DataGridViewContentAlignment.MiddleCenter, 10); CommonFuction.SetDataGridViewColumnStyle(grdAIjubgmentHistory, "고객", "PRODUCTTYPE", "rackid", typeof(string), 150, false, true, DataGridViewContentAlignment.MiddleCenter, 20); CommonFuction.SetDataGridViewColumnStyle(grdAIjubgmentHistory, "도번", "PRODUCTNAME", "durableid", typeof(int), 180, false, true, DataGridViewContentAlignment.MiddleCenter, 20); CommonFuction.SetDataGridViewColumnStyle(grdAIjubgmentHistory, "품번", "PRODUCTNO", "productname", typeof(string), 180, false, true, DataGridViewContentAlignment.MiddleCenter, 80); CommonFuction.SetDataGridViewColumnStyle(grdAIjubgmentHistory, "LOT번호", "CUSTOMERNAME", "inputdate", typeof(string), 250, false, true, DataGridViewContentAlignment.MiddleCenter, 60); CommonFuction.SetDataGridViewColumnStyle(grdAIjubgmentHistory, "검사일자", "CREATOR", "inputresult", typeof(string), 200, false, true, DataGridViewContentAlignment.MiddleCenter, 35); CommonFuction.SetDataGridViewColumnStyle(grdAIjubgmentHistory, "최종판정", "CREATETIME", "usedate", typeof(string), 100, false, true, DataGridViewContentAlignment.MiddleLeft, 60); CommonFuction.SetDataGridViewColumnStyle(grdAIjubgmentHistory, "AI판정", "MODIFIER", "usedate", typeof(string), 100, false, true, DataGridViewContentAlignment.MiddleLeft, 60); CommonFuction.SetDataGridViewColumnStyle(grdAIjubgmentHistory, "불량유형", "MODIFIEDTIME", "usedate", typeof(string), 100, false, true, DataGridViewContentAlignment.MiddleLeft, 60); CommonFuction.SetDataGridViewColumnStyle(grdAIjubgmentHistory, "행변경타입", "ROWTYPE", "ROWTYPE", typeof(string), 100, false, false, DataGridViewContentAlignment.MiddleLeft, 60); }