/// <summary> /// DateTimePicker 변경 이벤트 핸들러 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UiDT_ValueChanged(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; if (sender == uiDT_Start) { uiDT_End.Value = uiDT_Start.Value.AddDays(1); return; } if (sender == uiDT_End) { if (uiDT_End.Value < uiDT_Start.Value) { string msg = $"시작 시간은 종료 시간보다 길 수 없습니다."; JKMessageBox.Show(msg, "Warining", MessageBoxButtons.OK, MessageBoxIcon.Information); uiDT_End.Value = uiDT_Start.Value.AddDays(1);; } } //EqupipmentSearchOptingSetting(); SearchOptoingSetting(); InitCondition(); this.Cursor = Cursors.Default; }
/// <summary> /// 엑셀로 출력 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UiPb_SaveExcel_Click(object sender, EventArgs e) { string date = DateTime.Now.ToString("yyyyMMdd_HHmmss"); string fileName = $"BeomBeomJoJo_RTMS_{date}.xls"; string ext = ".xls"; string filter = "Microsoft Excel Workbook (*.xls)|*.xls"; using (SaveFileDialog saveFileDialog = Function.GetExcelSaveFileDialog(fileName, ext, filter)) { if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; FarPoint.Win.Spread.FpSpread fs = new FarPoint.Win.Spread.FpSpread(); fs.Sheets.Count = uiTab_Main.Controls.Count; FarPoint.Win.Spread.CellType.ImageCellType imgCell = new FarPoint.Win.Spread.CellType.ImageCellType(); imgCell.Style = FarPoint.Win.RenderStyle.Stretch; for (int row = 0; row < uiTab_Main.Controls.Count; ++row) { UI.MainUi ui = uiTab_Main.TabPages[row].Controls[0] as UI.MainUi; fs.Sheets[row].Columns.Count = 1; fs.Sheets[row].Columns[0].CellType = imgCell; fs.Sheets.Add(ui); if (ui == null) { continue; } using (Graphics g = ui.CreateGraphics()) { Bitmap memBitMap = new Bitmap(ui.Width, ui.Height); ui.DrawToBitmap(memBitMap, new Rectangle(0, 0, ui.Width, ui.Height)); g.DrawImageUnscaled(memBitMap, 0, 0); fs.Sheets[row].Rows.Count = 1; fs.Sheets[row].Columns[0].Width = 1500; fs.Sheets[row].Rows[0].Height = 800; fs.Sheets[row].Cells[0, 0].Value = memBitMap.Clone(); memBitMap.Dispose(); } fs.Sheets[row].SheetName = ui.RItem; } if (Function.ExportExcelFile(saveFileDialog.FileName, fs) == true) { JKMessageBox.ShowExcel(this, saveFileDialog.FileName); } this.Cursor = Cursors.Default; } } }
/// <summary> /// RawData 엑셀로 저장 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void uiPb_SaveExcel_Click(object sender, EventArgs e) { if (mainDs == null || mainDs.Tables.Count == 0) { return; } string date = DateTime.Now.ToString("yyyyMMdd_HHmmss"); string fileName = $"BeomBeomJoJo_RawData_{date}.xls"; string ext = ".xls"; string filter = "Microsoft Excel Workbook (*.xls)|*.xls"; using (SaveFileDialog saveFileDialog = GetExcelSaveFileDialog(fileName, ext, filter)) { if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; FarPoint.Win.Spread.FpSpread spread = new FarPoint.Win.Spread.FpSpread(); List <string> sheetNames = new List <string>(); int row = 0; foreach (KeyValuePair <string, FarPoint.Win.Spread.SheetView> items in Common.dicSheet) { spread.Sheets.Add(items.Value); sheetNames.Add(items.Key); spread.Sheets[row].SheetName = items.Key; row++; } if (Function.ExportExcelFile(saveFileDialog.FileName, spread) == true) { JKMessageBox.ShowExcel(this, saveFileDialog.FileName); } this.Cursor = Cursors.Default; } } }