private void baseButton1_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(this.baseTextBox1.Text)) { return; } string[] mQuery = Regex.Split(baseTextBox1.Text, ";"); int nullCnt = 0; for (int x = 0; x < mQuery.Length; x++) { if (string.IsNullOrWhiteSpace(mQuery[x])) { nullCnt += 1; } } for (int numOfTab = 0; numOfTab < mQuery.Length; numOfTab++) { Control tabControl = new Control(); BaseDataGridView grid = new BaseDataGridView(); grid.Dock = DockStyle.Fill; grid.DataSource = DataTableHelper.InitPivotData(); tabControl.Controls.Add(grid); tabControl.Dock = DockStyle.Fill; string tabName = string.Format("Result {0}", baseTabControl1.TabPages.Count + 1); TabPage tp = new TabPage() { Name = tabName, Text = tabName }; tp.Controls.Add(tabControl); baseTabControl1.TabPages.Add(tp); baseTabControl1.SelectedIndex = baseTabControl1.TabPages.Count - 1; } }
private string getCellValueYMD(BaseDataGridView g, int rowIdx, string col, bool zero) { string ret = ""; DataGridViewCell c = g.Rows[rowIdx].Cells[col]; if (zero) { ret = "0"; } if (c != null && c.Value != null && c.Value != DBNull.Value && !string.IsNullOrWhiteSpace(c.Value.ToString())) { ret = c.Value.ToString(); if (DateTime.Parse(ret).ToString("yyyy/MM/dd").CompareTo("0001/01/01") <= 0) { ret = ""; } else { ret = DateTime.Parse(ret).ToString("yyyy/MM/dd"); } } return(ret); }
/// <summary> /// AddColumn /// </summary> /// <param name="view"></param> /// <param name="eVal"></param> public static void AddColumn(this BaseDataGridView view, Enum eVal, bool isEnum) { DataTable dt = (DataTable)view.DataSource; dt.Columns.Add(new DataColumn(eVal.ToCaption(), typeof(string))); view.DataSource = dt; }
/// <summary> /// AddColumn /// </summary> /// <typeparam name="TEnum"></typeparam> /// <param name="view"></param> /// <param name="eVal"></param> public static void AddColumn <TEnum>(this BaseDataGridView view, TEnum eVal) where TEnum : struct, IConvertible, IComparable, IFormattable { DataTable dt = (DataTable)view.DataSource; dt.Columns.Add(new DataColumn(eVal.ToString(), typeof(string))); view.DataSource = dt; }
public void LoadStockTypes(DataFeed dataFeed, List <int> stockTypeIds) { this.m_DataFeed = dataFeed; this.m_StockTypeIds = stockTypeIds; WinFormSession sess = (WinFormSession)this.Project.Library.Session; this.m_FlowDiagramSheet = this.m_DataFeed.Scenario.GetDataSheet(Constants.DATASHEET_FLOW_PATHWAY_DIAGRAM_NAME); this.m_FlowDiagramData = this.m_FlowDiagramSheet.GetData(); this.m_FlowPathwaySheet = this.m_DataFeed.GetDataSheet(Constants.DATASHEET_FLOW_PATHWAY_NAME); this.m_FlowPathwayData = this.m_FlowPathwaySheet.GetData(); this.m_FlowPathwayView = (MultiRowDataFeedView)sess.CreateMultiRowDataFeedView(dataFeed.Scenario, dataFeed.Scenario); this.m_FlowPathwayView.LoadDataFeed(this.m_DataFeed, Constants.DATASHEET_FLOW_PATHWAY_NAME); this.m_FlowPathwayGrid = this.m_FlowPathwayView.GridControl; this.FilterFlowPathways(); this.ConfigureContextMenus(); this.InitializeColumnVisiblity(); this.UpdateColumnVisibility(); this.ConfigureColumnsReadOnly(); this.PanelMain.Controls.Add(this.m_FlowPathwayView); this.m_FlowPathwayGrid.PaintGridBorders = false; this.m_FlowPathwayView.ManageOptionalColumns = false; this.m_FlowPathwayGrid.CellBeginEdit += OnGridCellBeginEdit; this.m_FlowPathwayGrid.CellEndEdit += OnGridCellEndEdit; }
protected override void InitializeView() { base.InitializeView(); this.m_View = this.Session.CreateMultiRowDataFeedView(this.Project); this.m_Grid = this.m_View.GridControl; this.Controls.Add(this.m_View); this.m_Grid.CellValidating += this.OnCellValidating; }
public override void LoadDataFeed(Core.DataFeed dataFeed) { base.LoadDataFeed(dataFeed); MultiRowDataFeedView v = (MultiRowDataFeedView)this.PanelMain.Controls[0]; this.m_Grid = v.GridControl; v.LoadDataFeed(dataFeed, Strings.DATASHEET_TRANSITION_SIMULATION_GROUP_NAME); this.m_Grid.CellBeginEdit += OnGridCellBeginEdit; this.m_Grid.CellEndEdit += OnGridCellEndEdit; }
public override void LoadDataFeed(Core.DataFeed dataFeed) { base.LoadDataFeed(dataFeed); MultiRowDataFeedView v = (MultiRowDataFeedView)this.PanelMain.Controls[0]; this.m_Grid = v.GridControl; v.LoadDataFeed(dataFeed, Strings.DISTRIBUTION_VALUE_DATASHEET_NAME); this.m_Grid.CellBeginEdit += OnGridCellBeginEdit; this.m_Grid.CellEndEdit += OnGridCellEndEdit; this.m_Grid.CellFormatting += OnGridCellFormatting; this.m_Grid.CellValueChanged += OnGridCellValueChanged; }
protected override void InitializeView() { base.InitializeView(); this.m_View = this.Session.CreateMultiRowDataFeedView(this.Project); this.m_Grid = this.m_View.GridControl; this.Controls.Add(this.m_View); this.m_Grid.CellValidating += this.OnCellValidating; this.m_Grid.CellDoubleClick += this.OnGridCellDoubleClick; this.m_Grid.CellPainting += this.OnGridCellPainting; this.m_Grid.KeyDown += this.OnGridKeyDown; }
// cellの値を文字列で取得 private string getCellValue(BaseDataGridView g, int rowIdx, string col, bool zero) { string ret = ""; DataGridViewCell c = g.Rows[rowIdx].Cells[col]; if (zero) { ret = "0"; } if (c != null && c.Value != null && c.Value != DBNull.Value && !string.IsNullOrWhiteSpace(c.Value.ToString())) { ret = c.Value.ToString(); } return(ret); }