/// <summary> /// SuperGridActionList /// </summary> /// <param name="superGrid">Associated SuperGridControl</param> public SuperGridActionList(SuperGridControl superGrid) : base(superGrid) { _SuperGrid = superGrid; _ChangeService = Component.Site.GetService(typeof(IComponentChangeService)) as IComponentChangeService; }
/// <summary> /// Initializes our designer /// </summary> /// <param name="component"></param> public override void Initialize(IComponent component) { base.Initialize(component); if (component.Site.DesignMode == true) _SuperGrid = component as SuperGridControl; #if !TRIAL IDesignerHost dh = this.GetService(typeof(IDesignerHost)) as IDesignerHost; if (dh != null) dh.LoadComplete += new EventHandler(DesignerLoadComplete); #endif }
private void TotalRow(DevComponents.DotNetBar.SuperGrid.SuperGridControl gridview) { /* GridRow gr = new GridRow(); * GridCell gc = new GridCell("合计"); * gr.Cells.Add(gc); * for (int i = 0; i < 16; i++) * {, * GridCell gc1 = new GridCell(); * gr.Cells.Add(gc1); * } * gr.Cells[7].Value = zysl; * gr.Cells[8].Value = pssl; * supergrid.PrimaryGrid.Rows.Add(gr); */ }
///<summary> /// SampleExpr ///</summary> public SampleExpr(SuperGridControl superGrid) { InitializeComponent(); btnClose.Text = superGrid.FilterCloseString; string s = GetRtbText(superGrid); try { richTextBoxEx1.Rtf = s; } catch { richTextBoxEx1.Text = s; } }
internal Boolean ShowDgvInfo(DevComponents.DotNetBar.SuperGrid.SuperGridControl gridView, bool isShowExcle) { if (gridView.PrimaryGrid.Rows.Count == 0) { return(false); } //建立Excel对象 Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application(); excel.Application.Workbooks.Add(true); excel.Visible = isShowExcle; //生成字段名称 for (int i = 0; i < gridView.PrimaryGrid.Columns.Count; i++) { excel.Cells[1, i + 1] = gridView.PrimaryGrid.Columns[i].HeaderText; } //填充数据 try { GridRow gr = null; for (int i = 0; i < gridView.PrimaryGrid.Rows.Count; i++) { //dr = gridView.PrimaryGrid.Rows[i]; gr = (GridRow)gridView.PrimaryGrid.Rows[i]; for (int j = 0; j < gridView.PrimaryGrid.Columns.Count; j++) { if (gr[j].GetType() == typeof(string)) { excel.Cells[i + 2, j + 1] = "'" + gr[j].Value.ToString(); } else { excel.Cells[i + 2, j + 1] = gr[j].Value.ToString(); } } } } catch (Exception) { // MessageBox.Show(Ex.Message); ; } return(true); }
public CellInfoWindow(SuperGridControl superGrid, GridCell cell) { InitializeComponent(); TopLevel = false; _SuperGrid = superGrid; _Cell = cell; _ToolTip = new System.Windows.Forms.ToolTip(); using (GraphicsPath path = GetImageGraphicsPath()) Region = new Region(path); Paint += CellInfoWindowPaint; MouseClick += CellInfoWindowMouseClick; MouseDoubleClick += CellInfoWindowMouseDoubleClick; MouseEnter += CellInfoWindowMouseEnter; MouseLeave += CellInfoWindowMouseLeave; }
internal string GetRtbText(SuperGridControl superGrid) { using (LocalizationManager lm = new LocalizationManager(superGrid)) { string s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterSampleExpr); if (s == "") { using (Stream stream = typeof(SampleExpr).Assembly.GetManifestResourceStream( "DevComponents.DotNetBar.SuperGrid.SampleExpr.rtf")) { if (stream != null) { using (StreamReader reader = new StreamReader(stream)) s = reader.ReadToEnd(); } } } return (s); } }
public void llena_detalle_tratamiento(String codigo, String consultorio, SuperGridControl grid_medicos, SuperGridControl grid_mtos) { String consulta_m = consultas[G_MED]+" WHERE NUMERO_CONSULTORIO="+consultorio; SPG.llena_superGrid_con(consulta_m, grid_medicos); llena_detalle("MXTC", codigo, grid_mtos); }
public void llena_detalle(String detalle,String clave,SuperGridControl sgrid) { String consulta = ""; if (detalle == "MXTC") { consulta = "SELECT CODIGO_TRATAMIENTO AS \"Tratamiento\",ID AS \"ID\",NOMBRE_COMPUESTO AS \"Compuesto\"," + "PRESENTACION AS \"Presentación\",CONTENIDO AS \"Contenido\",VIA_ADMINISTRACION AS \"Vía de administración\"," + "CBP AS \"c.b.p\" FROM MXTC INNER JOIN MEDICAMENTOC ON MXTC.ID_MEDICAMENTO=MEDICAMENTOC.ID WHERE CODIGO_TRATAMIENTO=" + clave; SPG.llena_superGrid_con(consulta, sgrid); } else if (detalle == "MXRF") { consulta = "SELECT ID AS \"ID\",NOMBRE_COMPUESTO AS \"Compuesto\",PRESENTACION AS \"Presentación\",CONTENIDO AS \"Contenido\"," + "VIA_ADMINISTRACION AS \"Vía de administración\",CBP AS \"c.b.p\", DOSIS AS \"Dosis\" FROM MXRF INNER JOIN MEDICAMENTOF " + "ON MXRF.ID_MEDICAMENTO=MEDICAMENTOF.ID WHERE NUMERO_RECETA=" + clave; SO.llena_superGrid_con(consulta, sgrid); } }
public void llena_superGrid_con(String consulta, SuperGridControl super_grid) { DataSet data_set = new DataSet(); dame_dataset_de(consulta, data_set); super_grid.PrimaryGrid.DataSource = data_set; }
/// <summary> /// 将supergrid导出为Excel(OleDb 方式操作) /// </summary> /// <param name="gridView"></param> /// <param name="isShowExcle"></param> /// <returns></returns> public static void superGridToExcel(DevComponents.DotNetBar.SuperGrid.SuperGridControl gridView, string fileName) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "xls files (*.xls)|*.xls"; saveFileDialog.FileName = fileName; if (saveFileDialog.ShowDialog() == DialogResult.OK) { fileName = saveFileDialog.FileName; if (File.Exists(fileName)) { try { File.Delete(fileName); } catch { MessageBox.Show("该文件正在使用中,关闭文件或重新命名导出文件再试!"); return; } } OleDbConnection oleDbConn = new OleDbConnection(); OleDbCommand oleDbCmd = new OleDbCommand(); string sSql = ""; try { //Microsoft.Jet.OleDb.4.0 oleDbConn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + @";Extended ProPerties=""Excel 12.0;HDR=Yes;"""; oleDbConn.Open(); oleDbCmd.CommandType = CommandType.Text; oleDbCmd.Connection = oleDbConn; sSql = "CREATE TABLE sheet1 ("; for (int i = 0; i < gridView.PrimaryGrid.Columns.Count; i++) { // 字段名称出现关键字会导致错误。 if (i < gridView.PrimaryGrid.Columns.Count - 1) { sSql += "[" + gridView.PrimaryGrid.Columns[i].HeaderText + Convert.ToString(i) + "] TEXT(100) ,"; } else { sSql += "[" + gridView.PrimaryGrid.Columns[i].HeaderText + Convert.ToString(i) + "] TEXT(200) )"; } } oleDbCmd.CommandText = sSql; oleDbCmd.ExecuteNonQuery(); GridRow gr = null; for (int i = 0; i < gridView.PrimaryGrid.Rows.Count; i++) { //dr = gridView.PrimaryGrid.Rows[i]; gr = (GridRow)gridView.PrimaryGrid.Rows[i]; sSql = "INSERT INTO sheet1 VALUES('"; for (int j = 0; j < gridView.PrimaryGrid.Columns.Count; j++) { GridCell gcl = gr[j]; GridColumn gc = gridView.PrimaryGrid.Columns[j]; //瓷质 if (gr[j].FormattedValue != "")// gc.DataPropertyName == "FMaterial") { if (j < gridView.PrimaryGrid.Columns.Count - 1) { sSql += gr[j].FormattedValue.ToString() + " ','"; } else { sSql += gr[j].FormattedValue.ToString() + " ')"; } } else { if (j < gridView.PrimaryGrid.Columns.Count - 1) { sSql += gr[j].Value.ToString() + " ','"; } else { sSql += gr[j].Value.ToString() + " ')"; } } } oleDbCmd.CommandText = sSql; oleDbCmd.ExecuteNonQuery(); } MessageBox.Show("导出EXCEL成功"); } catch (Exception ex) { MessageBox.Show("导出EXCEL失败:" + ex.Message); } finally { oleDbCmd.Dispose(); oleDbConn.Close(); oleDbConn.Dispose(); } } }
private void LoadLocalizedStrings(SuperGridControl sg) { if (_localizedStringsLoaded == false) { using (LocalizationManager lm = new LocalizationManager(sg)) { string s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterByRelativeDate)) != "") _filterByRelativeDateString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterBySpecificDate)) != "") _filterBySpecificDateString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterByDateRange)) != "") _filterByDateRangeString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCurrentMonth)) != "") _currentMonth = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCurrentYear)) != "") _currentYear = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLastMonthPeriod)) != "") _lastMonthPeriod = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLast3MonthPeriod)) != "") _last3MonthPeriod = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLast6MonthPeriod)) != "") _last6MonthPeriod = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLast9MonthPeriod)) != "") _last9MonthPeriod = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLastYear)) != "") _lastYear = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLast5YearPeriod)) != "") _last5YearPeriod = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLast10YearPeriod)) != "") _last10YearPeriod = s; } _localizedStringsLoaded = true; } }
private void LoadLocalizedStrings(SuperGridControl sg) { if (_localizedStringsLoaded == false) { using (LocalizationManager lm = new LocalizationManager(sg)) { string s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCustomHelp)) != "") _filterHelpString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterEnterExpr)) != "") _filterEnterExprString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterClear)) != "") _filterClearString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterReset)) != "") _filterResetString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCustomFilter)) != "") _filterCustomFilterString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridNewFilterExpr)) != "") _newFilterExprString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridNewFilter)) != "") _newFilterString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridDeleteFilter)) != "") _deleteFilterString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterName)) != "") _filterNameString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterDescription)) != "") _filterDescriptionString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridShowInFilterPopup)) != "") _showInFilterPopupString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterHelpTitle)) != "") _filterHelpTitle = s; } _localizedStringsLoaded = true; } }
private void PositionWindow(SuperGridControl superGrid) { if (_size != Size.Empty) Size = _size; Form form = superGrid.FindForm(); if (form != null) { Point pt = form.Location; if (_offset != Point.Empty) { pt.Offset(_offset); Location = pt; } else { Screen screen = Screen.FromControl(form); int boundWidth = screen.Bounds.Width; int boundHeight = screen.Bounds.Height; int x = boundWidth - Width; int y = boundHeight - Height; Location = new Point(screen.Bounds.X + x / 2, screen.Bounds.Y + y / 2); } } _LockedResize = false; }
private SuperGridControl GetParentSuperGrid() { if (_SuperGrid != null) return (_SuperGrid); GridElement parent = _Parent; while (parent != null) { if (parent.SuperGrid != null) return (_SuperGrid = parent.SuperGrid); parent = parent.Parent; } return (null); }
private void LoadLocalizedStrings(SuperGridControl sg) { if (_localizedStringsLoaded == false) { using (LocalizationManager lm = new LocalizationManager(sg)) { string s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCustomHelp)) != "") _filterHelpString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterEnterExpr)) != "") _filterEnterExprString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterClear)) != "") _filterClearString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCustomFilter)) != "") _filterCustomFilterString = s; if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterHelpTitle)) != "") _filterHelpTitle = s; } _localizedStringsLoaded = true; } }