public void OpenGridViewGroups(GridControl ctrl, int groupleveltoexpand) { // open grouplevel 0 (if available) ctrl.BeginUpdate(); try { GridView view = (GridView)ctrl.DefaultView; //view.ExpandAllGroups(); view.MoveFirst(); while (!view.IsLastRow) { int rowhandle = view.FocusedRowHandle; if (view.IsGroupRow(rowhandle)) { int grouplevel = view.GetRowLevel(rowhandle); if (grouplevel <= groupleveltoexpand) { view.ExpandGroupRow(rowhandle); } } view.MoveNext(); } view.MoveFirst(); } catch (Exception E) { Console.WriteLine(E.Message); } ctrl.EndUpdate(); }
/// <summary> /// Converts the specified <code>token</code> into an instance of <code>IGridControlValue</code>. /// </summary> /// <param name="control">The parent control.</param> /// <param name="token">The instance of <code>JToken</code> representing the control value.</param> /// <param name="value">The converted value.</param> public bool ConvertControlValue(GridControl control, JToken token, out IGridControlValue value) { value = null; switch (control.Editor.Alias) { case "media_wide": case "media_wide_cropped": value = GridControlMediaValue.Parse(control, token as JObject); break; case "banner_headline": case "banner_tagline": case "headline_centered": case "abstract": case "paragraph": case "quote_D": case "code": value = GridControlTextValue.Parse(control, token); break; } return value != null; }
/// <summary> /// Gets an instance <code>GridControlWrapper</code> for the specified <code>control</code>. /// </summary> /// <param name="control">The control to be wrapped.</param> /// <param name="wrapper">The wrapper.</param> public bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper) { wrapper = null; switch (control.Editor.Alias) { case "media_wide": case "media_wide_cropped": wrapper = control.GetControlWrapper<GridControlMediaValue, GridEditorMediaConfig>(); break; case "banner_headline": case "banner_tagline": case "headline_centered": case "abstract": case "paragraph": case "quote_D": case "code": wrapper = control.GetControlWrapper<GridControlTextValue, GridEditorTextConfig>(); break; } return wrapper != null; }
public SystemParametersController(AdministrationForm form, GridControl gridControl) { view = form; _gridControl = gridControl; _instance = this; //identity = Thread.CurrentPrincipal as UserIdentity;//TODO }
public GridColumn[] CreateDM_NHAN_VIEN(GridControl gridControl, GridView gridView) { XtraGridSupportExt.TextLeftColumn( XtraGridSupportExt.CreateGridColumn(gridView, "ID", -1, -1), "ID"); XtraGridSupportExt.TextLeftColumn( XtraGridSupportExt.CreateGridColumn(gridView, "Mã nhân viên", 0, 150), "MA_NV"); GridColumn Ten = XtraGridSupportExt.CreateGridColumn(gridView, "Tên nhân viên", 1, 150); XtraGridSupportExt.TextLeftColumn( Ten, "NAME"); GridColumn ColPhongBan = XtraGridSupportExt.CreateGridColumn(gridView, "Tên phòng ban", 2, 150); ColPhongBan.FieldName = "DEPARTMENT_ID"; //XtraGridSupportExt.IDGridColumn(ColPhongBan, "ID", "NAME", "DEPARTMENT", "DEPARTMENT_ID"); HelpGridColumn.CotCombobox(ColPhongBan, HelpDB.getDatabase().LoadDataSet(@"SELECT * FROM DEPARTMENT WHERE PARENT_ID IS NOT NULL"), "ID", "NAME", "DEPARTMENT_ID"); ColPhongBan.OptionsColumn.AllowEdit = true; ColPhongBan.OptionsColumn.AllowFocus = false; ColPhongBan.OptionsColumn.ReadOnly = true; Ten.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending; XtraGridSupportExt.TextLeftColumn( XtraGridSupportExt.CreateGridColumn(gridView, "CMND", 3, 150), "CMND"); XtraGridSupportExt.DateTimeGridColumn( XtraGridSupportExt.CreateGridColumn(gridView, "Ngày sinh", 4, 150), "NGAY_SINH"); XtraGridSupportExt.TextLeftColumn( XtraGridSupportExt.CreateGridColumn(gridView, "Điện thoại", 5, 150), "DIEN_THOAI"); XtraGridSupportExt.TextLeftColumn( XtraGridSupportExt.CreateGridColumn(gridView, "Địa chỉ", 6, 150), "DIA_CHI"); XtraGridSupportExt.TextLeftColumn( XtraGridSupportExt.CreateGridColumn(gridView, "Email", 7, 150), "EMAIL"); HelpGridColumn.CotCheckEdit( XtraGridSupportExt.CreateGridColumn(gridView, "Hiển thị", 8, 100), "VISIBLE_BIT"); gridView.OptionsView.ShowGroupedColumns = false; gridView.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; gridView.OptionsView.ColumnAutoWidth = true; return null; }
/// <summary> /// /// </summary> /// <param name="gridControl"></param> /// <returns></returns> public static WinTextBox GetMemoTextBox(GridControl gridControl) { if (m_memoTextBox == null || m_memoTextBox.IsDisposed) { WinTextBox memoTextBox = new WinTextBox(EnhancedBorderStyle.None); //WinButton moreButton = new WinButton(new Xceed.Editors.ButtonType(Xceed.Editors.ButtonBackgroundImageType.Combo, Xceed.Editors.ButtonImageType.ScrollDown)); //memoTextBox.SideButtons.Add(moreButton); //memoTextBox.DropDownButton = moreButton; memoTextBox.TextBoxArea.WordWrap = false; memoTextBox.TextBoxArea.Multiline = false; memoTextBox.TextBoxArea.AcceptsReturn = false; memoTextBox.TextBoxArea.ReadOnly = false; WinTextBox multilineTextBox = new WinTextBox(); multilineTextBox.TextBoxArea.WordWrap = true; multilineTextBox.TextBoxArea.Multiline = true; multilineTextBox.TextBoxArea.ReadOnly = true; memoTextBox.DropDownAnchor = DropDownAnchor.Left; memoTextBox.DropDownDirection = DropDownDirection.Automatic; memoTextBox.DropDownAllowFocus = true; memoTextBox.DropDownControl = multilineTextBox; memoTextBox.DropDownSize = new System.Drawing.Size(300, 150); memoTextBox.DroppedDownChanged += new EventHandler(memoTextBox_DroppedDownChanged); m_memoTextBox = memoTextBox; } SetMemoTextBoxParent(m_memoTextBox, gridControl); return m_memoTextBox; }
public frmGroup(GridControl dv, string flag) { this.InitializeComponent(); clsMe clsMe = new clsMe(); clsMe.setFormStyl(this); this.dvgroup = (DataView)dv.DataSource; this.BindCombox(); this.comboBox1.SelectedIndex = 0; this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; this.dataGridView1.ReadOnly = true; this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.AllowUserToDeleteRows = false; this.dataGridView1.AllowUserToResizeRows = false; this.dataGridView1.MultiSelect = false; this.dataGridView1.RowHeadersWidth = 55; this.dataGridView1.BackgroundColor = this.BackColor; this.dataGridView1.EnableHeadersVisualStyles = false; this.dataGridView1.AllowUserToResizeColumns = false; this.dataGridView2.SelectionMode = DataGridViewSelectionMode.FullRowSelect; this.dataGridView2.ReadOnly = true; this.dataGridView2.AllowUserToAddRows = false; this.dataGridView2.AllowUserToDeleteRows = false; this.dataGridView2.AllowUserToResizeRows = false; this.dataGridView2.MultiSelect = false; this.dataGridView2.RowHeadersWidth = 55; this.dataGridView2.BackgroundColor = this.BackColor; this.dataGridView2.EnableHeadersVisualStyles = false; }
public GridColumn[] CreateDM_DANH_BA(GridControl gridControl, GridView gridView) { HelpGridColumn.CotTextLeft( HelpGridColumn.ThemCot(gridView, "ID", -1, -1), "ID"); HelpGridColumn.CotTextLeft( HelpGridColumn.ThemCot(gridView, "Tên tài liệu", 0, 150), "NAME"); HelpGridColumn.CotTextLeft( HelpGridColumn.ThemCot(gridView, "Địa chỉ", 1, 150), "DIA_CHI"); HelpGridColumn.CotTextLeft( HelpGridColumn.ThemCot(gridView, "Số điện thoại", 2, 150), "SO_DIEN_THOAI"); HelpGridColumn.CotTextLeft( HelpGridColumn.ThemCot(gridView, "Di động", 3, 150), "DI_DONG"); HelpGridColumn.CotTextLeft( HelpGridColumn.ThemCot(gridView, "Fax", 4, 150), "SO_FAX"); HelpGridColumn.CotTextLeft( HelpGridColumn.ThemCot(gridView, "Người đại diện", 5, 150), "NGUOI_DAI_DIEN"); HelpGridColumn.CotTextLeft( HelpGridColumn.ThemCot(gridView, "Chức vụ", 6, 150), "CHUC_VU"); HelpGridColumn.CotTextLeft( HelpGridColumn.ThemCot(gridView, "Số tài khoản", 7, 150), "TAI_KHOAN"); XtraGridSupportExt.ComboboxGridColumn(HelpGridColumn.ThemCot(gridView, "Ngân hàng", 1, 150), " DM_BANK", "ID", "NAME", "TEN_NGAN_HANG").NullText = string.Empty; gridView.OptionsView.ColumnAutoWidth = false; gridView.OptionsView.ShowAutoFilterRow = false; gridView.OptionsView.ShowGroupedColumns = false; gridView.OptionsView.ShowFilterPanelMode = DevExpress.XtraGrid.Views.Base.ShowFilterPanelMode.Never; ((PLGridView)gridView).DefaultNewRow = ProtocolVN.Framework.Win.HelpGrid.CheckVisibleDefault; ((PLGridView)gridView)._SetUserLayout(); return null; }
//Chú ý tên table trong DataTable phải giống như tên table mà mình cần thao tác thêm xóa public static PLGridViewUpdate ToPLGridViewUpdate(GridControl grid, PLGridView gridView, DataTable DataSource, string IDField, string[] NameFields, string[] Subjects, InitGridColumns InitGridCol, GetRule Rule, DelegationLib.DefinePermission permission, PLDelegation.ProcessDataRow InsertFunc, PLDelegation.ProcessDataRow DeleteFunc, PLDelegation.ProcessDataRow UpdateFunc, int RowPerPage) { PLGridViewUpdate update = new PLGridViewUpdate(); for (int i = 0; i < gridView.Columns.Count; i++) { update.gridView.Columns.Add(gridView.Columns[i]); } update._init(DataSource, IDField, NameFields, Subjects, InitGridCol, Rule, permission, InsertFunc, DeleteFunc, UpdateFunc); PLGridViewUpdateHelp page = new PLGridViewUpdateHelp(update.gridControl, RowPerPage, update); page.AddFunction = update.AddAction; page.DeleteFunction = update.DeleteAction; page.EditFunction = update.EditAction; page.NoSaveFunction = update.NoSaveAction; page.PrintFunction = update.PrintAction; page.SaveFunction = update.SaveAction; update.Dock = grid.Dock; update.Location = grid.Location; return update; }
public GridControl InitializeSendToGrid(GridControl gridSendFax, string _faxFolder) { try { gridSendFax.RowCount = 0; gridSendFax.ColCount = 3; gridSendFax.ColWidths[0] = 10; gridSendFax.ColWidths[1] = 75; gridSendFax.ColWidths[2] = 150; gridSendFax.ColWidths[3] = 150; gridSendFax[0, 1].Text = "Del"; gridSendFax[0, 2].Text = "Recipient name"; gridSendFax[0, 3].Text = "Fax number"; gridSendFax[0, 1].BackColor = Color.LightGray; gridSendFax[0, 2].BackColor = Color.LightGray; gridSendFax[0, 3].BackColor = Color.LightGray; GridModel model = gridSendFax.Model; return gridSendFax; } catch (Exception er) { Common.Log(er.Message); return gridSendFax; } }
/// <summary> /// Gets an instance <code>GridControlWrapper</code> for the specified <code>control</code>. /// </summary> /// <param name="control">The control to be wrapped.</param> /// <param name="wrapper">The wrapper.</param> public virtual bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper) { wrapper = null; switch (control.Editor.Alias) { case "media": wrapper = control.GetControlWrapper<GridControlMediaValue, GridEditorMediaConfig>(); break; case "embed": wrapper = control.GetControlWrapper<GridControlEmbedValue>(); break; case "rte": wrapper = control.GetControlWrapper<GridControlRichTextValue>(); break; case "macro": wrapper = control.GetControlWrapper<GridControlMacroValue>(); break; case "quote": case "headline": wrapper = control.GetControlWrapper<GridControlTextValue, GridEditorTextConfig>(); break; } return wrapper != null; }
/// <summary> /// Converts the specified <code>token</code> into an instance of <code>IGridControlValue</code>. /// </summary> /// <param name="control">The parent control.</param> /// <param name="token">The instance of <code>JToken</code> representing the control value.</param> /// <param name="value">The converted value.</param> public virtual bool ConvertControlValue(GridControl control, JToken token, out IGridControlValue value) { value = null; switch (control.Editor.Alias) { case "media": value = GridControlMediaValue.Parse(control, token as JObject); break; case "embed": value = GridControlEmbedValue.Parse(control, token); break; case "rte": value = GridControlRichTextValue.Parse(control, token); break; case "macro": value = GridControlMacroValue.Parse(control, token as JObject); break; case "headline": case "quote": value = GridControlTextValue.Parse(control, token); break; } return value != null; }
/// <summary> /// Gets an instance <see cref="GridControlWrapper"/> for the specified <code>control</code>. /// </summary> /// <param name="control">The control to be wrapped.</param> /// <param name="wrapper">The wrapper.</param> public bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper) { wrapper = null; if (IsLinkPickerEditor(control.Editor)) { wrapper = control.GetControlWrapper<GridControlLinkPickerValue, GridEditorLinkPickerConfig>(); } return wrapper != null; }
/// <summary> /// Converts the specified <code>token</code> into an instance of <see cref="IGridControlValue"/>. /// </summary> /// <param name="control">A reference to the parent <see cref="GridControl"/>.</param> /// <param name="token">The instance of <see cref="JToken"/> representing the control value.</param> /// <param name="value">The converted control value.</param> public bool ConvertControlValue(GridControl control, JToken token, out IGridControlValue value) { value = null; if (IsLinkPickerEditor(control.Editor)) { value = GridControlLinkPickerValue.Parse(control, token as JObject); } return value != null; }
public GridViewPrinter(GridControl aGrid, PrintDocument aPrintDocument, GridView aTable) { TheDataGrid = aGrid; ThePrintDocument = aPrintDocument; TheTable = aTable; if (aPrintDocument.DefaultPageSettings.Landscape) { PageWidth = ThePrintDocument.DefaultPageSettings.PaperSize.Height; PageHeight = ThePrintDocument.DefaultPageSettings.PaperSize.Width; TopMargin = ThePrintDocument.DefaultPageSettings.Margins.Right; BottomMargin = ThePrintDocument.DefaultPageSettings.Margins.Left; LeftMargin = ThePrintDocument.DefaultPageSettings.Margins.Top; RightMargin = ThePrintDocument.DefaultPageSettings.Margins.Bottom; } else { PageWidth = ThePrintDocument.DefaultPageSettings.PaperSize.Width; PageHeight = ThePrintDocument.DefaultPageSettings.PaperSize.Height; TopMargin = ThePrintDocument.DefaultPageSettings.Margins.Top; BottomMargin = ThePrintDocument.DefaultPageSettings.Margins.Bottom; } }
public GridColumn[] Create(GridControl gridControl, GridView gridView) { XtraGridSupportExt.TextLeftColumn( XtraGridSupportExt.CreateGridColumn(gridView, "ID", -1, -1), "ID"); XtraGridSupportExt.TextLeftColumn( XtraGridSupportExt.CreateGridColumn(gridView, "Số ĐKCB HD", 0, 150), "NAME"); XtraGridSupportExt.TextLeftColumn( XtraGridSupportExt.CreateGridColumn(gridView, "Mô tả", 1, 500), "NOI_DUNG"); XtraGridSupportExt.TextLeftColumn( XtraGridSupportExt.CreateGridColumn(gridView, "Mục đích", 2, 500), "MUC_DICH"); HelpGrid.CotSpinEditInt( XtraGridSupportExt.CreateGridColumn(gridView, "Dung lượng (MB)", 3, 150), "DUNG_LUONG", true); XtraGridSupportExt.TextLeftColumn( XtraGridSupportExt.CreateGridColumn(gridView, "Tình trạng", 4, 150), "TINH_TRANG"); XtraGridSupportExt.TextLeftColumn( XtraGridSupportExt.CreateGridColumn(gridView, "Chịu trách nhiệm", 5, 300), "NGUOI_CHIU_TRACH_NHIEM"); HelpGridColumn.CotMemoExEdit( XtraGridSupportExt.CreateGridColumn(gridView, "Ghi chú", 6, 150), "GHI_CHU"); HelpGridColumn.CotCheckEdit( XtraGridSupportExt.CreateGridColumn(gridView, GlobalConst.VISIBLE_TITLE, 7, 60), "VISIBLE_BIT"); ((PLGridView)gridView).DefaultNewRow = delegate(DataRow row) { row["VISIBLE_BIT"] = "Y"; }; return null; }
//private GridControl _gridResult1; //private GridView _gridView1; private void CreateXtraGrid() { _gridResult1 = new GridControl(); _gridView1 = new GridView(); ((ISupportInitialize)(_gridResult1)).BeginInit(); ((ISupportInitialize)(_gridView1)).BeginInit(); //tab_result.Controls.Add(_gridResult1); // // _gridResult1 // _gridResult1.Dock = DockStyle.Fill; _gridResult1.EmbeddedNavigator.Name = ""; _gridResult1.Font = new Font("Courier New", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); _gridResult1.Location = new Point(3, 3); _gridResult1.MainView = _gridView1; _gridResult1.Name = "_gridResult1"; _gridResult1.Size = new Size(1042, 358); _gridResult1.TabIndex = 0; //_gridResult1.Text = "gridControl1"; // // gridView1 // _gridView1.GridControl = _gridResult1; _gridView1.Name = "_gridView1"; ((ISupportInitialize)(_gridResult1)).EndInit(); ((ISupportInitialize)(_gridView1)).EndInit(); tab_result1.Controls.Add(_gridResult1); }
public static GridControl Create(string name = null, DockStyle dockStyle = DockStyle.None, int? x = null, int? y = null, int? width = null, int? height = null) { GridControl grid = new GridControl(); GridView gridView = new GridView(); ((ISupportInitialize)grid).BeginInit(); ((ISupportInitialize)gridView).BeginInit(); grid.MainView = gridView; grid.Name = name; grid.Dock = dockStyle; grid.Font = new Font("Courier New", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0); Point? point = zForm.GetPoint(x, y); if (point != null) grid.Location = (Point)point; Size? size = zForm.GetSize(width, height); if (size != null) grid.Size = (Size)size; //grid.TabIndex = 0; gridView.GridControl = grid; ((ISupportInitialize)grid).EndInit(); ((ISupportInitialize)gridView).EndInit(); return grid; }
public GridControl InitializeOutlookGrid( GridControl gridOutlookList) { try { gridOutlookList.RowCount = 0; gridOutlookList.ColCount = 4; gridOutlookList.ColWidths[0] = 10; gridOutlookList.ColWidths[1] = 200; gridOutlookList.ColWidths[2] = 150; gridOutlookList.ColWidths[3] = 150; gridOutlookList.ColWidths[4] = 0; gridOutlookList[0, 1].Text = "Name"; gridOutlookList[0, 2].Text = "Business Fax"; gridOutlookList[0, 3].Text = "Home Fax"; gridOutlookList[0, 1].BackColor = Color.LightGray; gridOutlookList[0, 2].BackColor = Color.LightGray; gridOutlookList[0, 3].BackColor = Color.LightGray; return gridOutlookList; } catch (Exception er) { Common.Log(er.Message); return gridOutlookList; } }
public bool InsertExcel(string titleName, string unit, GridControl gridControl, TONLI.BZH.UI.DSOFramerWordControl wordcontrol) { try { System.Drawing.Font font = new System.Drawing.Font("���ו", 16); wordcontrol.DoInsert("\n\n"+titleName+"\n" , font, TONLI.BZH.UI.WdParagraphAlignment.Center); //wordcontrol.DoPaste(); font = new System.Drawing.Font("���ו", 12); wordcontrol.DoInsert(unit + "\n", font, TONLI.BZH.UI.WdParagraphAlignment.Right); //wordcontrol.DoPaste(); wordcontrol.DoInsert("", font, TONLI.BZH.UI.WdParagraphAlignment.Center); string filename =System.Windows.Forms.Application.StartupPath + "\\BlogData\\Blog.xls"; gridControl.DefaultView.ExportToExcelOld(filename); wordcontrol.DoInsertOleObject(filename); //System.Drawing.Font font = new System.Drawing.Font("���ו", 16); wordcontrol.DoInsert("", font, TONLI.BZH.UI.WdParagraphAlignment.Center); //Microsoft.Office.Interop.Excel.Application ep = new Microsoft.Office.Interop.Excel.Application(); //Microsoft.Office.Interop.Excel._Workbook wb = ep.Workbooks.Add(filename); //Microsoft.Office.Interop.Excel.Sheets sheets = wb.Worksheets; //Microsoft.Office.Interop.Excel._Worksheet ws = (Microsoft.Office.Interop.Excel._Worksheet)sheets.get_Item(1);// [System.Type.Missing];//.get.get_Item("xx"); //ws.UsedRange.Select(); //ws.UsedRange.Copy(System.Type.Missing); //wordcontrol.DoPaste(); return true; } catch { return false; } }
void InitializeFromDataSet(GridControl gridControl) { DataSet dataSet = new DataSet("dataSet"); DataTable dataTable1 = dataSet.Tables.Add("table1"); dataTable1.Columns.Add("Text1", typeof(string)); dataTable1.Columns.Add("Number1", typeof(int)); dataTable1.Columns.Add("Check1", typeof(bool)); for (int i = 0; i < Form1.maxRowCount; i++) { dataTable1.Rows.Add(); } DataTable dataTable2 = dataSet.Tables.Add("table2"); dataTable2.Columns.Add("Text2", typeof(string)); dataTable2.Columns.Add("Number2", typeof(int)); dataTable2.Columns.Add("Check2", typeof(bool)); for (int i = 0; i < Form1.maxRowCount; i++) { dataTable2.Rows.Add(); } gridControl.DataSource = dataSet; gridControl.DataMember = "table2"; }
/// <summary> /// Initializes a new instance of the <see cref="XtraGridPrintAdapter"/> class. /// </summary> /// <param name="adaptee">The adaptee.</param> /// <param name="workItem">The work item.</param> public XtraGridPrintAdapter(GridControl adaptee, WorkItem workItem) { this.adaptee = adaptee; this.workItem = workItem; xtrapService = new XtraPrintService(adaptee, adaptee.DefaultView.ViewCaption); RegisterEvent(); }
public override void Activate() { this.Key = "kHandleStock"; this.Caption = "补货作业"; this.Dock = DockStyle.Fill; this.InnerControl = new HandleStockControl(); gridControl = ((HandleStockControl)this.InnerControl).gridHandleStock; }
public override void Activate() { this.Key = "kStockChannelQuery"; this.InnerControl = new StockChannelQueryControl(); this.Dock = DockStyle.Fill; this.Caption = "补货烟道"; gridControl = ((StockChannelQueryControl)this.InnerControl).gridStockChannel; }
public CPivotGridBatch(GridControl gc, BandedGridView bgv) { gridcontrol = gc; gridview = bgv; FormatColumns(); FormatColumnConst(); FormatRows(); }
public static void AddNewRecord(Record record, GridControl theGrid) { BindingList<Record> listDataSource = theGrid.DataSource as BindingList<Record>; listDataSource.Add(record); theGrid.DataSource = listDataSource; }
//NumPerPage -- So dong tren 1 trang public GridPaging(GridControl gridCtrl, int NumPerPage) { this.gridControl = gridCtrl; this.gridControl.UseEmbeddedNavigator = true; InvisibleAllNavigateButton(); AddCustomButton(); InitPager(NumPerPage); }
/// <summary> /// Gets a macro value from the specified <code>JsonObject</code>. /// </summary> /// <param name="control">The parent control.</param> /// <param name="obj">The instance of <code>JObject</code> to be parsed.</param> public static GridControlMacroValue Parse(GridControl control, JObject obj) { if (obj == null) return null; return new GridControlMacroValue(control, obj) { Syntax = obj.GetString("syntax"), MacroAlias = obj.GetString("macroAlias"), Parameters = obj.GetObject("macroParamsDictionary").ToObject<Dictionary<string, object>>() }; }
public static ChartControl CreatPieChart(SolidColorBrush forecolor, string ChartTitle, List<ChartDataChartCommonData> dtchart) { mausac = 0; ChartControl abc = new ChartControl(); SimpleDiagram2D dg1 = new SimpleDiagram2D(); //liabc.Titles.Clear(); //Tao Tile cho Chart Title nt = new Title(); nt.Content = ChartTitle; nt.Foreground = forecolor; abc.Titles.Add(nt); //Tinh so Series List<string> countsr = (from p in dtchart group p by p.Series into g select g.Key).ToList(); //Creat Diagram abc.Diagram = dg1; GridControl dtl = new GridControl(); for (int i = 0; i < countsr.Count; i++) { PieSeries2D dgs1 = new PieSeries2D(); dgs1.HoleRadiusPercent = 0;//Thiet lap khoang trong tu tam hinh tron den duong tron dgs1.ArgumentScaleType = ScaleType.Auto; foreach (ChartDataChartCommonData dr in dtchart)//Tao cac point { if (dr.Series == countsr.ElementAt(i)) { //Tao Series SeriesPoint sr1 = new SeriesPoint(); sr1.Argument = dr.Agrument + ":" + dr.Value.ToString(); sr1.Value = dr.Value; sr1.Tag = mausac.ToString(); dgs1.Points.Add(sr1); mausac++; } } dgs1.Label = new SeriesLabel();//Tao Label cho Diagram PieSeries.SetLabelPosition(dgs1.Label, PieLabelPosition.TwoColumns); dgs1.Label.RenderMode = LabelRenderMode.RectangleConnectedToCenter; dgs1.LabelsVisibility = true;//Hien thi Lablel cho tung vung PointOptions pn1 = new PointOptions(); pn1.PointView = PointView.ArgumentAndValues; pn1.Pattern = "{A} ({V})";//Tao mau chu thich NumericOptions nbm1 = new NumericOptions();//Tao Kieu hien thi nbm1.Format = NumericFormat.Percent; pn1.ValueNumericOptions = nbm1; PieSeries2D.SetPercentOptions(pn1, new PercentOptions() { ValueAsPercent = true, PercentageAccuracy = 5 });//Quy dinh ty le phan tram chinh xac dgs1.PointOptions = pn1; dg1.Series.Add(dgs1); //Tao chu thich dgs1.LegendPointOptions = pn1; } abc.Legend = new Legend(); //End tao chu thich //Set mau sac cho seriespont abc.CustomDrawSeriesPoint += abc_CustomDrawSeriesPoint; return abc; }
/// <summary> /// Initializes a new instance of the <see cref="StorageField"/> class. /// </summary> /// <param name="control">The control.</param> public StorageGrid(GridControl control, string id) { Control = control; Id = id; if (control.DataSource != null) { Value = control.DataSource.Serialize(); ValueType = Control.DataSource.GetType().ToString(); } }
public virtual void SetChargeUiControls(ChartControl chartControlChargeProportion, ChartControl feCuPropotionCtl, ChartControl chargePropotionChart, GridControl gridControl1, GridControl gridControl2, GridControl gridControl3, GridControl gridControl4, DocumentViewer documentView) { }
protected bool IsSorted(GridControl grid) { return(grid.SortInfo.Count > 0); }
protected bool IsSortedButNotGrouped(GridControl grid) { return(IsSorted(grid) && !IsGrouped(grid)); }
protected internal virtual void SetGridControlAccessMetod(GridControl newControl) { SetGridControl(newControl); }
private void SetGridProperties(GridControl gridControl) { gridControl.AllowDrop = true; gridControl.Model.Options.ExcelLikeSelectionFrame = true; Random r = new Random(); gridControl.Model.RowCount = 30; gridControl.Model.ColumnCount = 25; gridControl.Model.RowHeights[1] = 50; gridControl.Model.RowHeights.DefaultLineSize = 32; gridControl.Model.ColumnWidths[2] = 100; for (int row = 1; row < 100; row++) { for (int col = 1; col <= 8; col++) { if (col > 7) { continue; } if (r.Next(1, 4) == 2) { gridControl.Model[row, col].CellValue = r.Next(10, 100); } else if (r.Next(1, 4) == 3) { gridControl.Model[row, col].CellValue = "Text" + r.Next(10, 100).ToString(); } else { gridControl.Model[row, col].CellValue = (r.Next(1000, 10000) * .01); } if (r.Next(10, 14) == 12) { gridControl.Model[row, col].Font.FontStyle = FontStyles.Italic; gridControl.Model[row, col].Font.FontWeight = FontWeights.Bold; gridControl.Model[row, col].Font.FontSize = 13; } if (r.Next(10, 14) == 13) { gridControl.Model[row, col].Background = Brushes.Orange; gridControl.Model[row, col].Foreground = Brushes.Blue; } if (r.Next(10, 14) == 13) { gridControl.Model[row, col].HorizontalAlignment = HorizontalAlignment.Right; } } } for (int row = 1; row <= gridControl.Model.RowCount; row++) { gridControl.Model[row, 7].CellType = "DateTimeEdit"; gridControl.Model[row, 7].CellValue = DateTime.Now; } gridControl.Model.CoveredCells.Add(new Syncfusion.Windows.Controls.Cells.CoveredCellInfo(4, 4, 6, 6)); gridControl.Model.CoveredCells.Add(new Syncfusion.Windows.Controls.Cells.CoveredCellInfo(8, 10, 12, 12)); gridControl.Model.ColumnWidths[7] = 100; }
private void InitializeComponent() { ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(FrmLogSearch)); repositoryItemPictureEdit1 = new RepositoryItemPictureEdit(); repositoryItemDateEdit1 = new RepositoryItemDateEdit(); groupBox1 = new GroupBox(); labelControl3 = new LabelControl(); labelControl1 = new LabelControl(); spinEdit1 = new SpinEdit(); lvObjects = new CheckedListBoxControl(); lbObjects = new LabelControl(); lbDate = new LabelControl(); tbScore = new TextEdit(); lbInfo = new Label(); btSearch = new SimpleButton(); btLoadPicture = new SimpleButton(); pictureEdit1 = new PictureEdit(); gbDate = new GroupBox(); labelControl5 = new LabelControl(); labelControl4 = new LabelControl(); dtBefore = new DateEdit(); dtFrom = new DateEdit(); gridControl1 = new GridControl(); gridView1 = new GridView(); colFaceID = new GridColumn(); colPicture = new GridColumn(); colName = new GridColumn(); colScore = new GridColumn(); colBirthday = new GridColumn(); colCategory = new GridColumn(); colPosition = new GridColumn(); btPrint = new SimpleButton(); labelControl2 = new LabelControl(); marqueeProgressBarControl1 = new MarqueeProgressBarControl(); btClear = new SimpleButton(); repositoryItemPictureEdit1.BeginInit(); repositoryItemDateEdit1.BeginInit(); repositoryItemDateEdit1.CalendarTimeProperties.BeginInit(); groupBox1.SuspendLayout(); spinEdit1.Properties.BeginInit(); lvObjects.BeginInit(); tbScore.Properties.BeginInit(); pictureEdit1.Properties.BeginInit(); gbDate.SuspendLayout(); dtBefore.Properties.CalendarTimeProperties.BeginInit(); dtBefore.Properties.BeginInit(); dtFrom.Properties.CalendarTimeProperties.BeginInit(); dtFrom.Properties.BeginInit(); gridControl1.BeginInit(); gridView1.BeginInit(); marqueeProgressBarControl1.Properties.BeginInit(); SuspendLayout(); repositoryItemPictureEdit1.Name = "repositoryItemPictureEdit1"; repositoryItemPictureEdit1.PictureStoreMode = PictureStoreMode.ByteArray; componentResourceManager.ApplyResources(repositoryItemDateEdit1, "repositoryItemDateEdit1"); repositoryItemDateEdit1.Buttons.AddRange(new EditorButton[1] { new EditorButton((ButtonPredefines)componentResourceManager.GetObject("repositoryItemDateEdit1.Buttons")) }); repositoryItemDateEdit1.CalendarTimeProperties.Buttons.AddRange(new EditorButton[1] { new EditorButton() }); repositoryItemDateEdit1.Name = "repositoryItemDateEdit1"; groupBox1.Controls.Add(labelControl3); groupBox1.Controls.Add(labelControl1); groupBox1.Controls.Add(spinEdit1); groupBox1.Controls.Add(lvObjects); groupBox1.Controls.Add(lbObjects); groupBox1.Controls.Add(lbDate); groupBox1.Controls.Add(tbScore); groupBox1.Controls.Add(lbInfo); groupBox1.Controls.Add(btSearch); groupBox1.Controls.Add(btLoadPicture); groupBox1.Controls.Add(pictureEdit1); groupBox1.Controls.Add(gbDate); componentResourceManager.ApplyResources(groupBox1, "groupBox1"); groupBox1.Name = "groupBox1"; groupBox1.TabStop = false; groupBox1.Enter += groupBox1_Enter; labelControl3.Appearance.Font = (Font)componentResourceManager.GetObject("labelControl3.Appearance.Font"); componentResourceManager.ApplyResources(labelControl3, "labelControl3"); labelControl3.Name = "labelControl3"; labelControl1.Appearance.Font = (Font)componentResourceManager.GetObject("labelControl1.Appearance.Font"); componentResourceManager.ApplyResources(labelControl1, "labelControl1"); labelControl1.Name = "labelControl1"; componentResourceManager.ApplyResources(spinEdit1, "spinEdit1"); spinEdit1.Name = "spinEdit1"; spinEdit1.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton() }); componentResourceManager.ApplyResources(lvObjects, "lvObjects"); lvObjects.Appearance.Font = (Font)componentResourceManager.GetObject("lvObjects.Appearance.Font"); lvObjects.Appearance.Options.UseFont = true; lvObjects.Name = "lvObjects"; lbObjects.Appearance.Font = (Font)componentResourceManager.GetObject("lbObjects.Appearance.Font"); componentResourceManager.ApplyResources(lbObjects, "lbObjects"); lbObjects.Name = "lbObjects"; lbDate.Appearance.Font = (Font)componentResourceManager.GetObject("lbDate.Appearance.Font"); componentResourceManager.ApplyResources(lbDate, "lbDate"); lbDate.Name = "lbDate"; componentResourceManager.ApplyResources(tbScore, "tbScore"); tbScore.Name = "tbScore"; tbScore.Properties.Appearance.Font = (Font)componentResourceManager.GetObject("tbScore.Properties.Appearance.Font"); tbScore.Properties.Appearance.Options.UseFont = true; tbScore.TextChanged += tbScore_TextChanged; tbScore.Validating += tbScore_Validating; componentResourceManager.ApplyResources(lbInfo, "lbInfo"); lbInfo.Name = "lbInfo"; componentResourceManager.ApplyResources(btSearch, "btSearch"); btSearch.Appearance.Font = (Font)componentResourceManager.GetObject("btSearch.Appearance.Font"); btSearch.Appearance.Options.UseFont = true; btSearch.Name = "btSearch"; btSearch.Click += simpleButton2_Click; btLoadPicture.Appearance.Font = (Font)componentResourceManager.GetObject("btLoadPicture.Appearance.Font"); btLoadPicture.Appearance.Options.UseFont = true; componentResourceManager.ApplyResources(btLoadPicture, "btLoadPicture"); btLoadPicture.Name = "btLoadPicture"; btLoadPicture.Click += btLoadPicture_Click; componentResourceManager.ApplyResources(pictureEdit1, "pictureEdit1"); pictureEdit1.Name = "pictureEdit1"; pictureEdit1.Properties.SizeMode = PictureSizeMode.Zoom; gbDate.Controls.Add(labelControl5); gbDate.Controls.Add(labelControl4); gbDate.Controls.Add(dtBefore); gbDate.Controls.Add(dtFrom); componentResourceManager.ApplyResources(gbDate, "gbDate"); gbDate.Name = "gbDate"; gbDate.TabStop = false; gbDate.Enter += groupBox3_Enter; labelControl5.Appearance.Font = (Font)componentResourceManager.GetObject("labelControl5.Appearance.Font"); componentResourceManager.ApplyResources(labelControl5, "labelControl5"); labelControl5.Name = "labelControl5"; labelControl4.Appearance.Font = (Font)componentResourceManager.GetObject("labelControl4.Appearance.Font"); componentResourceManager.ApplyResources(labelControl4, "labelControl4"); labelControl4.Name = "labelControl4"; componentResourceManager.ApplyResources(dtBefore, "dtBefore"); dtBefore.Name = "dtBefore"; dtBefore.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton((ButtonPredefines)componentResourceManager.GetObject("dtBefore.Properties.Buttons")) }); dtBefore.Properties.CalendarTimeProperties.Buttons.AddRange(new EditorButton[1] { new EditorButton() }); dtBefore.Properties.DisplayFormat.FormatString = "dd.MMMM.yyyy HH:mm:ss"; dtBefore.Properties.DisplayFormat.FormatType = FormatType.DateTime; dtBefore.Properties.EditFormat.FormatString = "dd.MMMM.yyyy HH:mm:ss"; dtBefore.Properties.EditFormat.FormatType = FormatType.DateTime; dtBefore.Properties.Mask.EditMask = componentResourceManager.GetString("dtBefore.Properties.Mask.EditMask"); componentResourceManager.ApplyResources(dtFrom, "dtFrom"); dtFrom.Name = "dtFrom"; dtFrom.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton((ButtonPredefines)componentResourceManager.GetObject("dtFrom.Properties.Buttons")) }); dtFrom.Properties.CalendarTimeProperties.Buttons.AddRange(new EditorButton[1] { new EditorButton() }); dtFrom.Properties.DisplayFormat.FormatString = "dd.MMMM.yyyy HH:mm:ss"; dtFrom.Properties.DisplayFormat.FormatType = FormatType.DateTime; dtFrom.Properties.EditFormat.FormatString = "dd.MMMM.yyyy HH:mm:ss"; dtFrom.Properties.EditFormat.FormatType = FormatType.DateTime; dtFrom.Properties.Mask.EditMask = componentResourceManager.GetString("dtFrom.Properties.Mask.EditMask"); componentResourceManager.ApplyResources(gridControl1, "gridControl1"); gridControl1.LookAndFeel.SkinName = "Office 2007 Blue"; gridControl1.MainView = gridView1; gridControl1.Name = "gridControl1"; gridControl1.ViewCollection.AddRange(new BaseView[1] { gridView1 }); gridView1.ColumnPanelRowHeight = 50; gridView1.Columns.AddRange(new GridColumn[7] { colFaceID, colPicture, colName, colScore, colBirthday, colCategory, colPosition }); gridView1.GridControl = gridControl1; gridView1.IndicatorWidth = 60; gridView1.Name = "gridView1"; gridView1.OptionsBehavior.Editable = false; gridView1.OptionsCustomization.AllowFilter = false; gridView1.OptionsFind.ClearFindOnClose = false; gridView1.OptionsFind.FindDelay = 10000; gridView1.OptionsFind.FindMode = FindMode.Always; gridView1.OptionsFind.ShowCloseButton = false; gridView1.OptionsSelection.MultiSelect = true; gridView1.OptionsView.RowAutoHeight = true; gridView1.OptionsView.ShowGroupPanel = false; gridView1.SortInfo.AddRange(new GridColumnSortInfo[1] { new GridColumnSortInfo(colScore, ColumnSortOrder.Descending) }); gridView1.CustomDrawRowIndicator += gridView1_CustomDrawRowIndicator; colFaceID.AppearanceCell.Font = (Font)componentResourceManager.GetObject("colFaceID.AppearanceCell.Font"); colFaceID.AppearanceCell.Options.UseFont = true; colFaceID.AppearanceHeader.Font = (Font)componentResourceManager.GetObject("colFaceID.AppearanceHeader.Font"); colFaceID.AppearanceHeader.Options.UseFont = true; colFaceID.AppearanceHeader.Options.UseTextOptions = true; colFaceID.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; componentResourceManager.ApplyResources(colFaceID, "colFaceID"); colFaceID.FieldName = "FaceID"; colFaceID.Name = "colFaceID"; colFaceID.OptionsColumn.AllowEdit = false; colFaceID.OptionsColumn.ReadOnly = true; colPicture.AppearanceCell.Font = (Font)componentResourceManager.GetObject("colPicture.AppearanceCell.Font"); colPicture.AppearanceCell.Options.UseFont = true; colPicture.AppearanceHeader.Font = (Font)componentResourceManager.GetObject("colPicture.AppearanceHeader.Font"); colPicture.AppearanceHeader.Options.UseFont = true; colPicture.AppearanceHeader.Options.UseTextOptions = true; colPicture.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; componentResourceManager.ApplyResources(colPicture, "colPicture"); colPicture.ColumnEdit = repositoryItemPictureEdit1; colPicture.FieldName = "Image"; colPicture.Name = "colPicture"; colPicture.OptionsColumn.AllowEdit = false; colPicture.OptionsColumn.AllowSort = DefaultBoolean.False; colPicture.OptionsColumn.ReadOnly = true; colName.AppearanceCell.Font = (Font)componentResourceManager.GetObject("colName.AppearanceCell.Font"); colName.AppearanceCell.Options.UseFont = true; colName.AppearanceHeader.Font = (Font)componentResourceManager.GetObject("colName.AppearanceHeader.Font"); colName.AppearanceHeader.Options.UseFont = true; colName.AppearanceHeader.Options.UseTextOptions = true; colName.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; colName.AppearanceHeader.TextOptions.WordWrap = WordWrap.Wrap; componentResourceManager.ApplyResources(colName, "colName"); colName.FieldName = "Name"; colName.Name = "colName"; colName.OptionsColumn.AllowEdit = false; colName.OptionsColumn.ReadOnly = true; colScore.AppearanceCell.Font = (Font)componentResourceManager.GetObject("colScore.AppearanceCell.Font"); colScore.AppearanceCell.Options.UseFont = true; colScore.AppearanceHeader.Font = (Font)componentResourceManager.GetObject("colScore.AppearanceHeader.Font"); colScore.AppearanceHeader.Options.UseFont = true; colScore.AppearanceHeader.Options.UseTextOptions = true; colScore.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; colScore.AppearanceHeader.TextOptions.WordWrap = WordWrap.Wrap; componentResourceManager.ApplyResources(colScore, "colScore"); colScore.FieldName = "Score"; colScore.Name = "colScore"; colScore.OptionsColumn.AllowEdit = false; colScore.OptionsColumn.FixedWidth = true; colScore.OptionsColumn.ReadOnly = true; colBirthday.AppearanceCell.Font = (Font)componentResourceManager.GetObject("colBirthday.AppearanceCell.Font"); colBirthday.AppearanceCell.Options.UseFont = true; colBirthday.AppearanceHeader.Font = (Font)componentResourceManager.GetObject("colBirthday.AppearanceHeader.Font"); colBirthday.AppearanceHeader.Options.UseFont = true; colBirthday.AppearanceHeader.Options.UseTextOptions = true; colBirthday.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; colBirthday.AppearanceHeader.TextOptions.WordWrap = WordWrap.Wrap; componentResourceManager.ApplyResources(colBirthday, "colBirthday"); colBirthday.ColumnEdit = repositoryItemDateEdit1; colBirthday.DisplayFormat.FormatString = "dd.MM.yyyy HH:mm:ss"; colBirthday.DisplayFormat.FormatType = FormatType.DateTime; colBirthday.FieldName = "Date"; colBirthday.Name = "colBirthday"; colBirthday.OptionsColumn.AllowEdit = false; colBirthday.OptionsColumn.ReadOnly = true; colCategory.AppearanceCell.Font = (Font)componentResourceManager.GetObject("colCategory.AppearanceCell.Font"); colCategory.AppearanceCell.Options.UseFont = true; colCategory.AppearanceHeader.Font = (Font)componentResourceManager.GetObject("colCategory.AppearanceHeader.Font"); colCategory.AppearanceHeader.Options.UseFont = true; colCategory.AppearanceHeader.Options.UseTextOptions = true; colCategory.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; componentResourceManager.ApplyResources(colCategory, "colCategory"); colCategory.FieldName = "Category"; colCategory.Name = "colCategory"; colCategory.OptionsColumn.ReadOnly = true; colPosition.AppearanceCell.Font = (Font)componentResourceManager.GetObject("colPosition.AppearanceCell.Font"); colPosition.AppearanceCell.Options.UseFont = true; colPosition.AppearanceHeader.Font = (Font)componentResourceManager.GetObject("colPosition.AppearanceHeader.Font"); colPosition.AppearanceHeader.Options.UseFont = true; colPosition.AppearanceHeader.Options.UseTextOptions = true; colPosition.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; colPosition.AppearanceHeader.TextOptions.WordWrap = WordWrap.Wrap; componentResourceManager.ApplyResources(colPosition, "colPosition"); colPosition.FieldName = "Comment"; colPosition.Name = "colPosition"; colPosition.OptionsColumn.AllowEdit = false; colPosition.OptionsColumn.ReadOnly = true; componentResourceManager.ApplyResources(btPrint, "btPrint"); btPrint.Appearance.Font = (Font)componentResourceManager.GetObject("btPrint.Appearance.Font"); btPrint.Appearance.Options.UseFont = true; btPrint.Name = "btPrint"; btPrint.Click += btPrint_Click; labelControl2.Appearance.Font = (Font)componentResourceManager.GetObject("labelControl2.Appearance.Font"); componentResourceManager.ApplyResources(labelControl2, "labelControl2"); labelControl2.Name = "labelControl2"; componentResourceManager.ApplyResources(marqueeProgressBarControl1, "marqueeProgressBarControl1"); marqueeProgressBarControl1.Name = "marqueeProgressBarControl1"; componentResourceManager.ApplyResources(btClear, "btClear"); btClear.Appearance.Font = (Font)componentResourceManager.GetObject("btClear.Appearance.Font"); btClear.Appearance.Options.UseFont = true; btClear.Name = "btClear"; btClear.Click += btClear_Click; Appearance.Options.UseFont = true; AutoScaleMode = AutoScaleMode.None; componentResourceManager.ApplyResources(this, "$this"); Controls.Add(btClear); Controls.Add(labelControl2); Controls.Add(marqueeProgressBarControl1); Controls.Add(groupBox1); Controls.Add(btPrint); Controls.Add(gridControl1); FormBorderStyle = FormBorderStyle.None; Name = "FrmLogSearch"; ShowIcon = false; WindowState = FormWindowState.Maximized; FormClosing += frmLogSearch_FormClosing; Load += frmDBSearch_Load; Resize += frmDBSearch_Resize; repositoryItemPictureEdit1.EndInit(); repositoryItemDateEdit1.CalendarTimeProperties.EndInit(); repositoryItemDateEdit1.EndInit(); groupBox1.ResumeLayout(false); groupBox1.PerformLayout(); spinEdit1.Properties.EndInit(); lvObjects.EndInit(); tbScore.Properties.EndInit(); pictureEdit1.Properties.EndInit(); gbDate.ResumeLayout(false); gbDate.PerformLayout(); dtBefore.Properties.CalendarTimeProperties.EndInit(); dtBefore.Properties.EndInit(); dtFrom.Properties.CalendarTimeProperties.EndInit(); dtFrom.Properties.EndInit(); gridControl1.EndInit(); gridView1.EndInit(); marqueeProgressBarControl1.Properties.EndInit(); ResumeLayout(false); PerformLayout(); }
public override BaseView CreateView(GridControl grid) { return(new MyGridView(grid)); }
private void HideRoot(GridControl gridControl, TreeListView treeListView) { gridControl.ItemsSource = (DataContext as SchedulerViewModel)?.Users; treeListView.CustomNodeFilter += CustomNodeFilter; gridControl.FilterCriteria = CriteriaOperator.Parse("true"); }
/// <summary> /// 將新增、刪除、變更的紀錄分別都列印或匯出出來(橫式A4) /// </summary> /// <param name="gridControl"></param> /// <param name="ChangedForAdded"></param> /// <param name="ChangedForDeleted"></param> /// <param name="ChangedForModified"></param> protected void AfterSaveForPrint(GridControl gridControl, DataTable ChangedForAdded, DataTable ChangedForDeleted, DataTable ChangedForModified, bool IsHandlePersonVisible = true, bool IsManagerVisible = true) { GridControl gridControlPrint = GridHelper.CloneGrid(gridControl); string _ReportTitle = _ProgramID + "─" + _ProgramName + GlobalInfo.REPORT_TITLE_MEMO; ReportHelper reportHelper = new ReportHelper(gridControl, _ProgramID, _ReportTitle); CommonReportLandscapeA4 reportLandscape = new CommonReportLandscapeA4(); //橫向A4 reportLandscape.printableComponentContainerMain.PrintableComponent = gcMain; reportLandscape.IsHandlePersonVisible = IsHandlePersonVisible; reportLandscape.IsManagerVisible = IsManagerVisible; reportHelper.Create(reportLandscape); if (ChangedForAdded != null) { if (ChangedForAdded.Rows.Count != 0) { gridControlPrint.DataSource = ChangedForAdded; reportHelper.PrintableComponent = gridControlPrint; reportHelper.ReportTitle = _ReportTitle + "─" + "新增"; reportHelper.Print(); reportHelper.Export(FileType.PDF, reportHelper.FilePath); } } if (ChangedForDeleted != null) { if (ChangedForDeleted.Rows.Count != 0) { DataTable dtTemp = ChangedForDeleted.Clone(); int rowIndex = 0; foreach (DataRow dr in ChangedForDeleted.Rows) { DataRow drNewDelete = dtTemp.NewRow(); for (int colIndex = 0; colIndex < ChangedForDeleted.Columns.Count; colIndex++) { drNewDelete[colIndex] = dr[colIndex, DataRowVersion.Original]; } dtTemp.Rows.Add(drNewDelete); rowIndex++; } gridControlPrint.DataSource = dtTemp.AsDataView(); reportHelper.PrintableComponent = gridControlPrint; reportHelper.ReportTitle = _ReportTitle + "─" + "刪除"; reportHelper.Print(); reportHelper.Export(FileType.PDF, reportHelper.FilePath); } } if (ChangedForModified != null) { if (ChangedForModified.Rows.Count != 0) { gridControlPrint.DataSource = ChangedForModified; reportHelper.PrintableComponent = gridControlPrint; reportHelper.ReportTitle = _ReportTitle + "─" + "變更"; reportHelper.Print(); reportHelper.Export(FileType.PDF, reportHelper.FilePath); } } }
private void InitializeGrid() { #region "Style declaration" //header Style this.gridControl1.DefaultRowHeight = (int)DpiAware.LogicalToDeviceUnits(22.0f); GridStyleInfo headerstyle = new GridStyleInfo(); headerstyle.Font.Size = 12; headerstyle.Font.Bold = true; headerstyle.VerticalAlignment = GridVerticalAlignment.Middle; headerstyle.HorizontalAlignment = GridHorizontalAlignment.Center; headerstyle.CellType = GridCellTypeName.Static; //Subheader Style GridStyleInfo subheaderstyle = new GridStyleInfo(); subheaderstyle.Font.Bold = true; subheaderstyle.VerticalAlignment = GridVerticalAlignment.Middle; subheaderstyle.HorizontalAlignment = GridHorizontalAlignment.Center; subheaderstyle.CellType = GridCellTypeName.Static; //Value Style GridStyleInfo valuestyle = new GridStyleInfo(); valuestyle.BackColor = SystemColors.Menu; valuestyle.TextColor = Color.Black; valuestyle.VerticalAlignment = GridVerticalAlignment.Middle; valuestyle.HorizontalAlignment = GridHorizontalAlignment.Center; gridControl1.FloatCellsMode = GridFloatCellsMode.BeforeDisplayCalculation; #endregion #region "Date Time Picker Cells" int rowIndex = 1, colIndex = 4; gridControl1.AllowProportionalColumnSizing = true; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount)); gridControl1[rowIndex, 1] = headerstyle; gridControl1[rowIndex, 1].Text = "Date Time Picker Cells"; rowIndex += 3; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 3, rowIndex, 5)); this.gridControl1[rowIndex, colIndex - 1].Text = "Date Picker : (MM/dd/yyyy hh:mm)"; this.gridControl1[rowIndex, colIndex - 1].TextColor = Color.Black; colIndex++; colIndex++; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, colIndex, rowIndex, colIndex + 1)); this.gridControl1.CellModels.Add("DateTimePicker", new DateTimeCellModel(this.gridControl1.Model)); this.gridControl1[rowIndex, colIndex].CellType = "DateTimePicker"; this.gridControl1[rowIndex, colIndex].CellValueType = typeof(DateTime); this.gridControl1[rowIndex, colIndex].CellValue = DateTime.Now; this.gridControl1[rowIndex, colIndex].Format = "MM/dd/yyyy hh:mm"; rowIndex++; rowIndex++; colIndex -= 2; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 3, rowIndex, 5)); this.gridControl1[rowIndex, colIndex - 1].Text = "Time Picker cell : (hh:mm:ss tt)"; this.gridControl1[rowIndex, colIndex - 1].TextColor = Color.Black; colIndex++; colIndex++; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, colIndex, rowIndex, colIndex + 1)); this.gridControl1[rowIndex, colIndex].CellType = "DateTimePicker"; this.gridControl1[rowIndex, colIndex].CellValueType = typeof(DateTime); this.gridControl1[rowIndex, colIndex].CellValue = DateTime.Now; this.gridControl1[rowIndex, colIndex].Format = "hh:mm:ss tt"; #endregion #region "DropDownGrid cells" GridControl GridA = new GridControl(); GridA.RowCount = 10; GridA.ColCount = 5; GridA.ThemesEnabled = true; GridA.CausesValidation = false; GridA[1, 1].Text = "Grid A"; GridA.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Office2007Blue; GridA.Properties.BackgroundColor = System.Drawing.Color.FromArgb(((System.Byte)(227)), ((System.Byte)(239)), ((System.Byte)(255))); GridA.Properties.GridLineColor = System.Drawing.Color.FromArgb(((System.Byte)(208)), ((System.Byte)(215)), ((System.Byte)(229))); GridA.DefaultGridBorderStyle = GridBorderStyle.Solid; GridA.ForeColor = System.Drawing.Color.MidnightBlue; GridA.Font = new System.Drawing.Font("Verdana", 8.5F); GridControl GridB = new GridControl(); GridB.RowCount = 6; GridB.ColCount = 6; GridB.CausesValidation = false; GridB.ThemesEnabled = true; GridB[1, 1].Text = "Grid B"; GridB.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; DropDownGridCellModel aModel = new DropDownGridCellModel(this.gridControl1.Model); aModel.EmbeddedGrid = GridA; DropDownGridCellModel bModel = new DropDownGridCellModel(this.gridControl1.Model); bModel.EmbeddedGrid = GridB; gridControl1.CellModels.Add("GridADropCell", aModel); gridControl1.CellModels.Add("GridBDropCell", bModel); rowIndex += 3; colIndex -= 3; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount)); gridControl1[rowIndex, 1] = headerstyle; gridControl1[rowIndex, 1].Text = "DropDown Grid Cells"; rowIndex += 3; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, colIndex, rowIndex, colIndex + 1)); this.gridControl1[rowIndex, colIndex].Text = "Grid A"; this.gridControl1[rowIndex, colIndex].CellType = "GridADropCell"; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, colIndex + 3, rowIndex, colIndex + 4)); this.gridControl1[rowIndex, colIndex + 3].Text = "Grid B"; this.gridControl1[rowIndex, colIndex + 3].CellType = "GridBDropCell"; #endregion #region "DropDown Form and User Control" rowIndex += 3; colIndex -= 2; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount)); gridControl1[rowIndex, 1] = headerstyle; gridControl1[rowIndex, 1].Text = "DropDown Form and User Control"; rowIndex++; rowIndex++; this.gridControl1.CellModels.Add("DropDownForm", new DropDownFormCellModel(this.gridControl1.Model, new DropDownForm())); this.gridControl1.CellModels.Add("DropDownUserControl", new DropDownUserCellModel(this.gridControl1.Model, new DropDownUser())); ////DropDownForm... rowIndex++; colIndex = 3; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 3, rowIndex, 4)); gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 5, rowIndex, 7)); gridControl1[rowIndex, colIndex].Text = "DropDownForm"; gridControl1[rowIndex, colIndex].TextColor = Color.Black; this.gridControl1[rowIndex, colIndex + 2].CellType = "DropDownForm"; this.gridControl1[rowIndex, colIndex + 2].Text = "choice1,choice3"; ////DropDownForm... rowIndex++; rowIndex++; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 3, rowIndex, 4)); gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 5, rowIndex, 7)); gridControl1[rowIndex, colIndex].Text = "DropDownUserControl"; gridControl1[rowIndex, colIndex].TextColor = Color.Black; this.gridControl1[rowIndex, colIndex + 2].CellType = "DropDownUserControl"; this.gridControl1[rowIndex, colIndex + 2].Text = "choice1,choice3"; #endregion #region "DropDOwnCalculator Cell" rowIndex += 3; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount)); gridControl1[rowIndex, 1] = headerstyle; gridControl1[rowIndex, 1].Text = "DropDown Calculator TextBox"; rowIndex++; rowIndex++; #if HELPERCLASS RegisterCellModel.GridCellType(gridControl1, CustomCellTypes.CalculatorTextBox); #else this.gridControl1.CellModels.Add("CalculatorTextBox", new DropDownCalculatorTextBoxCellModel(this.gridControl1.Model)); #endif rowIndex++; gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 4, rowIndex, 6)); CalculatorControl c1 = new CalculatorControl(); c1.BorderStyle = Border3DStyle.Flat; c1.ButtonStyle = Syncfusion.Windows.Forms.ButtonAppearance.Office2007; c1.UseVisualStyle = true; GridStyleInfo style = gridControl1[rowIndex, 4]; style.CellType = "CalculatorTextBox"; style.Control = c1; style.Text = "Calculator TextBox"; this.gridControl1.Model.EnableGridListControlInComboBox = false; #endregion }
void InitDetailsAndPageHeader(GridControl grid) { IList <GridColumn> groupedColumns = ((TableView)grid.View).GroupedColumns; int pagewidth = (report.PageWidth - (report.Margins.Left + report.Margins.Right)) - groupedColumns.Count * subGroupOffset; List <ColumnInfo> columns = GetColumnsInfo(grid, pagewidth); if (CustomizeColumnsCollection != null) { CustomizeColumnsCollection(report, new ColumnsCreationEventArgs(pagewidth) { ColumnsInfo = columns }); } report.Bands.Add(new DetailBand() { HeightF = bandHeight }); report.Bands.Add(new PageHeaderBand() { HeightF = bandHeight }); XRTable headerTable = new XRTable(); XRTableRow row = new XRTableRow(); XRTable detailTable = new XRTable(); XRTableRow row2 = new XRTableRow(); for (int i = 0; i < columns.Count; i++) { if (columns[i].IsVisible) { XRTableCell cell = new XRTableCell(); cell.Width = columns[i].ColumnWidth; cell.Text = columns[i].FieldName; row.Cells.Add(cell); XRTableCell cell2 = new XRTableCell(); cell2.Width = columns[i].ColumnWidth; ControlCustomizationEventArgs cc = new ControlCustomizationEventArgs() { FieldName = columns[i].FieldName, IsModified = false, Owner = cell2 }; if (CustomizeColumn != null) { CustomizeColumn(report, cc); } if (cc.IsModified == false) { cell2.DataBindings.Add("Text", null, columns[i].FieldName); } detailsInfo.Add(columns[i].GridViewColumn, cell2); row2.Cells.Add(cell2); } } headerTable.Rows.Add(row); headerTable.Width = pagewidth; headerTable.LocationF = new PointF(groupedColumns.Count * subGroupOffset, 0); headerTable.Borders = BorderSide.Bottom; detailTable.Rows.Add(row2); detailTable.LocationF = new PointF(groupedColumns.Count * subGroupOffset, 0); detailTable.Width = pagewidth; report.Bands[BandKind.PageHeader].Controls.Add(headerTable); report.Bands[BandKind.Detail].Controls.Add(detailTable); }
void InitFilters(GridControl grid) { report.FilterString = grid.FilterString; }
public CustomGridView(GridControl ownerGrid) : base(ownerGrid) { }
private void gridControl1_EditorKeyPress(object sender, KeyPressEventArgs e) { GridControl grid = sender as GridControl; gridView1_KeyPress(grid.FocusedView, e); }
private void InitGridControl(GridControl grid) { var gridListProperties = new List <GridListControlProperties>(); gridListProperties.Add(new GridListControlProperties { Header = "No", Width = 30 }); gridListProperties.Add(new GridListControlProperties { Header = "Kode Produk", Width = 120 }); gridListProperties.Add(new GridListControlProperties { Header = "Nama Produk", Width = 240 }); gridListProperties.Add(new GridListControlProperties { Header = "Jumlah Retur", Width = 60 }); gridListProperties.Add(new GridListControlProperties { Header = "Harga", Width = 90 }); gridListProperties.Add(new GridListControlProperties { Header = "Sub Total", Width = 110 }); gridListProperties.Add(new GridListControlProperties { Header = "Aksi" }); GridListControlHelper.InitializeGridListControl <ItemReturJualProduk>(grid, _listOfItemRetur, gridListProperties, 30); grid.PushButtonClick += delegate(object sender, GridCellPushButtonClickEventArgs e) { if (e.ColIndex == 7) { if (grid.RowCount == 1) { MsgHelper.MsgWarning("Minimal 1 produk harus diinputkan !"); return; } if (MsgHelper.MsgDelete()) { var itemRetur = _listOfItemRetur[e.RowIndex - 1]; itemRetur.entity_state = EntityState.Deleted; _listOfItemReturDeleted.Add(itemRetur); _listOfItemRetur.Remove(itemRetur); grid.RowCount = _listOfItemRetur.Count(); grid.Refresh(); RefreshTotal(); } } }; grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e) { // Make sure the cell falls inside the grid if (e.RowIndex > 0) { if (!(_listOfItemRetur.Count > 0)) { return; } var itemRetur = _listOfItemRetur[e.RowIndex - 1]; var produk = itemRetur.Produk; if (e.RowIndex % 2 == 0) { e.Style.BackColor = ColorCollection.BACK_COLOR_ALTERNATE; } switch (e.ColIndex) { case 1: // no urut e.Style.HorizontalAlignment = GridHorizontalAlignment.Center; e.Style.Enabled = false; e.Style.CellValue = e.RowIndex.ToString(); break; case 2: if (produk != null) { e.Style.CellValue = produk.kode_produk; } break; case 3: // nama produk if (produk != null) { e.Style.CellValue = produk.nama_produk; } break; case 4: // jumlah retur e.Style.HorizontalAlignment = GridHorizontalAlignment.Center; e.Style.CellValue = itemRetur.jumlah_retur; break; case 5: // harga e.Style.HorizontalAlignment = GridHorizontalAlignment.Right; e.Style.CellValue = NumberHelper.NumberToString(itemRetur.harga_jual); break; case 6: // subtotal e.Style.HorizontalAlignment = GridHorizontalAlignment.Right; e.Style.Enabled = false; e.Style.CellValue = NumberHelper.NumberToString(itemRetur.jumlah_retur * itemRetur.harga_jual); break; case 7: // button hapus e.Style.HorizontalAlignment = GridHorizontalAlignment.Center; e.Style.CellType = GridCellTypeName.PushButton; e.Style.Enabled = true; e.Style.Description = "Hapus"; break; default: break; } e.Handled = true; // we handled it, let the grid know } }; var colIndex = 2; // kolom nama produk grid.CurrentCell.MoveTo(1, colIndex, GridSetCurrentCellOptions.BeginEndUpdate); }
private void toolView_Click(object sender, EventArgs e) { IEnumerator enumControl = _componentContainer.GetEnumerator(); DataView dt = null; Dictionary <string, string> dic = new Dictionary <string, string>(); SnDataSet temp = _solution.DataSetList[0] as SnDataSet; GridControl grd = null; while (enumControl.MoveNext()) { ICommonAttribute commonAttribute = enumControl.Current as ICommonAttribute; if (commonAttribute != null) { if (temp.DataSetName == commonAttribute.DataSetName) { dic.Add(commonAttribute.ParamName, commonAttribute.Value); } } } var enumGridControl = _componentContainer.GetEnumerator(); Hashtable htControls = new Hashtable(); while (enumGridControl.MoveNext()) { GridControl grid = enumGridControl.Current as GridControl; if (grid != null) { List <string> filter = new List <string>(); DevExpress.XtraGrid.Views.Grid.GridView view = grid.Views[0] as DevExpress.XtraGrid.Views.Grid.GridView; foreach (GridColumn gcc in view.SortedColumns) { filter.Add(gcc.FieldName + " " + (gcc.SortOrder == ColumnSortOrder.Descending ? "DESC" : "")); } DataView dv = grid.DataSource as DataView; if (dv != null) { dv.Sort = string.Join(",", filter.ToArray()); dt = dv; } grd = grid; //break; } if (!enumGridControl.Current.GetType().Equals(typeof(Column))) { Control ctl = (Control)enumGridControl.Current; htControls.Add(ctl.Name, ctl.Text); } } if (dt == null) { MessageBox.Show("数据源没有数据"); } else { if (string.IsNullOrEmpty(temp.ReportPath)) { if (grd != null) { if (PrintHelper.IsPrintingAvailable) { PrintHelper.ShowPreview(grd); } else { MessageBox.Show("打印组件库没有发现!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { Print(htControls, dic, dt, temp.ReportPath, false); } } }
public MyGridView(GridControl control) : base(control) { }
private void ExeQuery() { string sql = string.Empty; IEnumerator enumerator = _solution.DataSetList.GetEnumerator(); while (enumerator.MoveNext()) { SnDataSet temp = enumerator.Current as SnDataSet; switch (temp.DataSetType) { case DataSetType.Page: #region Page Hashtable htParam = new Hashtable(); sql = temp.SQLExpression; IEnumerator enumControl = _componentContainer.GetEnumerator(); while (enumControl.MoveNext()) { ICommonAttribute commonAttribute = enumControl.Current as ICommonAttribute; if (commonAttribute != null && !string.IsNullOrEmpty(commonAttribute.ParamName)) { if (commonAttribute.DataSetName == "所有数据集" || temp.DataSetID + "-" + temp.DataSetName == commonAttribute.DataSetName) { string paramName = commonAttribute.ParamName, paramType = commonAttribute.ParamType, value = commonAttribute.Value; if (!htParam.ContainsKey(paramName)) { switch (paramType) { case "String": htParam.Add(paramName, value); break; case "Int": htParam.Add(paramName, Convert.ToInt32(value)); break; case "Decimal": htParam.Add(paramName, Convert.ToDecimal(value)); break; case "DateTime": htParam.Add(paramName, Convert.ToDateTime(value)); break; } } } } } string strParam = ""; if (htParam != null) { foreach (DictionaryEntry de in htParam) { strParam += string.Format("{0}:{1}->{2}\r\n", de.Value.GetType().Name, de.Key, de.Value); } } WriteLog(sql + "\r\n" + strParam); try { _masterDataSource = _dao.ExecSQL(sql, htParam); } catch (Exception ex) { MessageBox.Show(ex.Message, "查询失败"); WriteLog(ex.Message); return; } IEnumerator enumGridControl = _componentContainer.GetEnumerator(); while (enumGridControl.MoveNext()) { GridControl grd = enumGridControl.Current as GridControl; if (grd != null) { grd.BeginUpdate(); if (string.IsNullOrEmpty(grd.Text)) { grd.DataSource = _masterDataSource.DefaultView; } else if (grd.Text == temp.DataSetID) { grd.DataSource = _masterDataSource.DefaultView; } //_currentRecordCount = _masterDataSource.Rows.Count; grd.EndUpdate(); //toolMoreRow.Enabled = (_currentRecordCount != _maxRecordCount); Size = new Size(Size.Width, Size.Height + 1); Size = new Size(Size.Width, Size.Height - 1); } } #endregion break; case DataSetType.Proc: #region Proc //string procName = temp.DataSetName; //enumControl = _componentContainer.GetEnumerator(); //Dictionary<string, object> dic = new Dictionary<string, object>(); //while (enumControl.MoveNext()) //{ // ICommonAttribute commonAttribute = enumControl.Current as ICommonAttribute; // if (commonAttribute != null) // { // if (temp.DataSetID + "-" + temp.DataSetName == commonAttribute.DataSetName) // { // if (string.IsNullOrEmpty(commonAttribute.ProcParamName)) // throw new Exception("存储过程参数名称不能为空"); // Type t = Type.GetType("System." + commonAttribute.ProcParamType, false, true); // if (commonAttribute is SnControl.ParamComboBox) // { // SnControl.ParamComboBox combox = (commonAttribute as SnControl.ParamComboBox); // if (!string.IsNullOrEmpty(combox.ValueMember)) // { // dic.Add(commonAttribute.ProcParamName.ToUpper(), combox.SelectedValue); // continue; // } // } // else if (commonAttribute is SnControl.ParamRadioButton) // { // SnControl.ParamRadioButton radioButton = (commonAttribute as SnControl.ParamRadioButton); // if (radioButton.Checked) // dic.Add(commonAttribute.ProcParamName.ToUpper(), radioButton.Value); // continue; // } // else if (commonAttribute is SnControl.Search) // { // SnControl.Search search = (commonAttribute as SnControl.Search); // if (!string.IsNullOrEmpty(search.Value)) // { // dic.Add(commonAttribute.ProcParamName.ToUpper(), search.Value); // continue; // } // } // if (t.Name == "String") // { // dic.Add(commonAttribute.ProcParamName.ToUpper(), commonAttribute.Text); // } // else // { // object value = null; // try // { // if (commonAttribute.Text == string.Empty) // value = t.IsValueType ? Activator.CreateInstance(t) : null; // else // value = t.GetMethod("Parse", new Type[] { typeof(string) }).Invoke(null, new object[] { commonAttribute.Text }); // } // catch (Exception) // { // throw new Exception("数据类型不匹配,请检查"); // } // dic.Add(commonAttribute.ProcParamName.ToUpper(), value); // } // } // } //} //string strParam2 = ""; //foreach (var de in dic) //{ // strParam2 += string.Format("{0}<->{1}<->{2}\r\n", // de.Value.GetType().Name, de.Key, de.Value); //} //WriteLog(procName + "\r\n" + strParam2); //_masterDataSource = _dao.ExecProc(procName, dic); //enumGridControl = _componentContainer.GetEnumerator(); //while (enumGridControl.MoveNext()) //{ // GridControl grd = enumGridControl.Current as GridControl; // if (grd != null) // { // grd.BeginUpdate(); // grd.DataSource = _masterDataSource.DefaultView; // //_currentRecordCount = _masterDataSource.Rows.Count; // grd.EndUpdate(); // //toolMoreRow.Enabled = (_currentRecordCount != _maxRecordCount); // Size = new Size(Size.Width, Size.Height + 1); // Size = new Size(Size.Width, Size.Height - 1); // } //} #endregion break; } } }
private IEnterspeedProperty GetProperty(string name, JToken value, string culture) { var type = value.Type; if (type == JTokenType.String) { return(new StringEnterspeedProperty(name, value.Value <string>())); } if (type == JTokenType.Boolean) { return(new BooleanEnterspeedProperty(name, value.Value <bool>())); } if (type == JTokenType.Integer) { return(new NumberEnterspeedProperty(name, value.Value <int>())); } if (type == JTokenType.Array) { var arrayItems = new List <IEnterspeedProperty>(); foreach (var jToken in (JArray)value) { if (jToken is JObject item) { var properties = new Dictionary <string, IEnterspeedProperty>(); foreach (var prop in item) { IEnterspeedProperty property = null; if (name == "controls" && prop.Key == "value") { var gridControl = new GridControl(item); property = EnterspeedGridEditorService.ConvertGridEditor(gridControl, culture); } if (property == null) { property = GetProperty(prop.Key, prop.Value, culture); } if (property != null) { properties.Add(prop.Key, property); } } if (properties.Any()) { arrayItems.Add(new ObjectEnterspeedProperty(properties)); } } } return(new ArrayEnterspeedProperty(name, arrayItems.ToArray())); } if (type == JTokenType.Object) { if (value is JObject item) { var properties = new Dictionary <string, IEnterspeedProperty>(); foreach (var prop in item) { var property = GetProperty(prop.Key, prop.Value, culture); if (property != null) { properties.Add(prop.Key, property); } } if (properties.Any()) { return(new ObjectEnterspeedProperty(name, properties)); } } } return(null); }
private object CreateObject(XmlElement xmlElement, bool suspend) { Type type = GetTypeByName(xmlElement.Name); if (xmlElement.Attributes["value"] != null) { try { return(Convert.ChangeType(xmlElement.Attributes["value"].InnerText, type)); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (type == null) { return(null); } object newObj; if (type.FullName == "System.Windows.Forms.Form") { newObj = this.mainPanel; } else if (type.FullName == "System.Windows.Forms.DataGridView") { GridControl grdEntity = new GridControl(); grdEntity.Name = "grdEntity"; grdEntity.Dock = DockStyle.Fill; grdEntity.LookAndFeel.UseWindowsXPTheme = true; XmlNode nodeTmp = xmlElement.SelectSingleNode("DataMember"); if (nodeTmp != null) { grdEntity.Text = nodeTmp.Attributes["value"].Value; } GridView viewEntity = new GridView(); viewEntity.Appearance.GroupPanel.Options.UseBackColor = true; viewEntity.Appearance.GroupPanel.BackColor = Color.SkyBlue; viewEntity.Appearance.GroupPanel.BackColor2 = Color.White; viewEntity.Appearance.FocusedRow.Options.UseBackColor = true; viewEntity.Appearance.FocusedRow.BackColor = Color.FromArgb(51, 153, 255); viewEntity.Appearance.HideSelectionRow.Options.UseBackColor = true; viewEntity.Appearance.HideSelectionRow.BackColor = Color.FromArgb(51, 153, 255); viewEntity.Appearance.HideSelectionRow.Options.UseForeColor = true; viewEntity.Appearance.HideSelectionRow.ForeColor = Color.White; viewEntity.OptionsView.ColumnAutoWidth = false; //viewEntity.OptionsView.ShowGroupPanel = false; //viewEntity.OptionsCustomization.AllowFilter = false; viewEntity.GroupPanelText = "查询结果"; viewEntity.OptionsBehavior.Editable = false; viewEntity.GroupFooterShowMode = GroupFooterShowMode.VisibleIfExpanded; viewEntity.OptionsView.ShowDetailButtons = false; viewEntity.OptionsView.ShowFooter = true; viewEntity.FocusRectStyle = DrawFocusRectStyle.None; viewEntity.GridControl = grdEntity; viewEntity.Name = "GirdView"; viewEntity.OptionsSelection.EnableAppearanceFocusedCell = false; viewEntity.PaintStyleName = "WindowsXP"; viewEntity.RowHeight = 25; viewEntity.ColumnPanelRowHeight = 30; viewEntity.GroupFooterShowMode = GroupFooterShowMode.VisibleAlways; GridGroupSummaryItem summaryItem; IEnumerator enumerator = _solution.DataSetList.GetEnumerator(); SnDataSet temp = null; while (enumerator.MoveNext()) { temp = enumerator.Current as SnDataSet; if (temp.DataSetID != grdEntity.Text && !string.IsNullOrEmpty(grdEntity.Text)) { continue; } for (int i = 0; i < temp.FieldsList.Count; i++) { GridColumn gridColumn = new GridColumn(); gridColumn.FieldName = temp.FieldsList[i].FieldName; gridColumn.Caption = temp.FieldsList[i].FieldChineseName; gridColumn.Width = temp.FieldsList[i].DisplayWidth > 0 ? temp.FieldsList[i].DisplayWidth : 90; if (!temp.FieldsList[i].ColumnVisible) { gridColumn.Visible = false; gridColumn.VisibleIndex = -1; } else { gridColumn.VisibleIndex = i; } switch (temp.FieldsList[i].CalcType) { case "Sum": summaryItem = new GridGroupSummaryItem(); summaryItem.FieldName = temp.FieldsList[i].FieldChineseName; summaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; summaryItem.DisplayFormat = "合计:{0:0.00}"; summaryItem.ShowInGroupColumnFooter = gridColumn; viewEntity.GroupSummary.Add(summaryItem); gridColumn.SummaryItem.DisplayFormat = "合计:{0:0.00}"; gridColumn.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; break; case "Average": summaryItem = new GridGroupSummaryItem(); summaryItem.FieldName = temp.FieldsList[i].FieldChineseName; summaryItem.SummaryType = DevExpress.Data.SummaryItemType.Average; summaryItem.DisplayFormat = "均值:{0:c2}"; summaryItem.ShowInGroupColumnFooter = gridColumn; viewEntity.GroupSummary.Add(summaryItem); gridColumn.SummaryItem.DisplayFormat = "均值:{0:c}"; gridColumn.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Average; break; case "Max": gridColumn.SummaryItem.DisplayFormat = "最大:{0:c}"; gridColumn.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Max; break; case "Min": gridColumn.SummaryItem.DisplayFormat = "最小:{0:c}"; gridColumn.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Min; break; case "Count": gridColumn.SummaryItem.DisplayFormat = "行数:{0:d}"; gridColumn.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Count; break; default: gridColumn.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.None; break; } foreach (StyleFormat s in temp.FieldsList[i].StyleFormat) { DevExpress.XtraGrid.StyleFormatCondition styleFormatCondition = new DevExpress.XtraGrid.StyleFormatCondition(); styleFormatCondition.Column = gridColumn; styleFormatCondition.Appearance.Options.UseForeColor = true; styleFormatCondition.Appearance.Options.UseBackColor = true; styleFormatCondition.Appearance.BackColor = System.Drawing.Color.FromArgb(s.BackColorRed, s.BackColorGreen, s.BackColorBlue); styleFormatCondition.Appearance.ForeColor = System.Drawing.Color.FromArgb(s.ForeColorRed, s.ForeColorGreen, s.ForeColorBlue); styleFormatCondition.ApplyToRow = s.ApplyToRow; styleFormatCondition.Condition = s.Condition; if (s.Value1 != null) { styleFormatCondition.Value1 = s.Value1.ToString() != "<Null>" ? GetValueByTypeName(s.Type1, s.Value1) : "<Null>"; } if (s.Value2 != null) { styleFormatCondition.Value2 = s.Value2.ToString() != "<Null>" ? GetValueByTypeName(s.Type2, s.Value2) : "<Null>"; } viewEntity.FormatConditions.Add(styleFormatCondition); } switch (temp.FieldsList[i].FieldType.ToUpper()) { case "TIMESTAMP": case "DATETIME": gridColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime; break; case "DECIMAL": if (temp.FieldsList[i].DecimalDigits == 0 && temp.FieldsList[i].DecimalDigits > 6) { temp.FieldsList[i].DecimalDigits = 2; } string tempstr = "0."; for (int j = 0; j < temp.FieldsList[i].DecimalDigits; j++) { tempstr += "0"; } gridColumn.DisplayFormat.FormatString = tempstr; gridColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom; break; case "INT": gridColumn.DisplayFormat.FormatString = "0"; gridColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom; break; } viewEntity.Columns.Add(gridColumn); } if (File.Exists(FileName + grdEntity.Text + ".xml")) { viewEntity.RestoreLayoutFromXml(FileName + grdEntity.Text + ".xml"); } } grdEntity.MainView = viewEntity; newObj = grdEntity; _componentContainer.Add(newObj); } else { newObj = type.Assembly.CreateInstance(type.FullName); _componentContainer.Add(newObj); } string componentName = null; if (xmlElement["Name"] != null && xmlElement["Name"].Attributes["value"] != null) { componentName = xmlElement["Name"].Attributes["value"].InnerText; } bool hasSuspended = false; if (suspend && newObj is ContainerControl) { hasSuspended = true; ((Control)newObj).SuspendLayout(); } foreach (XmlNode subNode in xmlElement.ChildNodes) { if (subNode is XmlElement) { XmlElement subElement = (XmlElement)subNode; if (subElement.Attributes["value"] != null) { try { SetValue(newObj, subElement.Name, subElement.Attributes["value"].InnerText); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { PropertyInfo propertyInfo = newObj.GetType().GetProperty(subElement.Name); object pList = propertyInfo.GetValue(newObj, null); if (pList is IList) { foreach (XmlNode node in subElement.ChildNodes) { if (node is XmlElement) { XmlElement cNode = node as XmlElement; object collectionObj = CreateObject(cNode, false); if (collectionObj != null) { try { ((IList)pList).Add(collectionObj); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } } } } } if (_acceptButton != null && newObj is Form) { ((Form)newObj).AcceptButton = (IButtonControl)Container.Components[_acceptButton]; _acceptButton = null; } if (_cancelButton != null && newObj is Form) { ((Form)newObj).CancelButton = (IButtonControl)Container.Components[_cancelButton]; _cancelButton = null; } if (hasSuspended) { ((Control)newObj).ResumeLayout(false); } return(newObj); }
protected override IGridViewDataRowDoubleClickAdapter CreateGridViewDataRowDoubleClickAdapter(GridControl grid, DevExpress.XtraGrid.Views.Grid.GridView gridView) { return(new GridViewDataRowDoubleClickAdapter(grid, gridView)); }
private void toolCard_Click(object sender, EventArgs e) { Cursor currentCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; IEnumerator enumGridControl = _componentContainer.GetEnumerator(); while (enumGridControl.MoveNext()) { GridControl grd = enumGridControl.Current as GridControl; if (grd != null) { BaseView oldView = grd.MainView; DevExpress.XtraGrid.StyleFormatCondition[] styles = new DevExpress.XtraGrid.StyleFormatCondition[grd.MainView.FormatConditions.Count]; for (int i = 0; i < styles.Length; i++) { styles[i] = grd.MainView.FormatConditions[i]; } grd.MainView = grd.CreateView(toolCard.Text == "卡片" ? "CardView" : "GridView"); if (grd.MainView is GridView) { GridView gv = grd.MainView as GridView; gv.OptionsView.ColumnAutoWidth = false; gv.OptionsView.ShowGroupPanel = false; gv.OptionsCustomization.AllowFilter = false; gv.OptionsBehavior.Editable = false; gv.OptionsView.ShowDetailButtons = false; gv.OptionsView.ShowFooter = true; gv.FocusRectStyle = DrawFocusRectStyle.RowFocus; gv.OptionsSelection.EnableAppearanceFocusedCell = false; gv.PaintStyleName = "WindowsXP"; gv.RowHeight = 25; gv.ColumnPanelRowHeight = 30; } else if (grd.MainView is CardView) { CardView gv = grd.MainView as CardView; gv.OptionsBehavior.Editable = false; gv.PaintStyleName = "WindowsXP"; } grd.MainView.FormatConditions.AddRange(styles); if (toolCard.Text == "卡片") { toolCard.Text = "表格"; } else { toolCard.Text = "卡片"; } if (oldView != null) { oldView.Dispose(); } Cursor.Current = currentCursor; } } }
protected bool ShouldReorderGroup(GridControl grid) { return(grid.SortInfo.Count <= grid.GroupCount); }
private void LanguageTransform(Control control, string parentName) { string controlName = parentName + "." + control.Name; Type type = control.GetType(); string typeName = type.Name; if (control is Form) { typeName = "Form"; } string text = string.Empty; switch (typeName) { case "Form": case "Button": case "CheckBox": case "Label": case "LabelControl": case "RadioButton": case "GroupBox": case "SimpleButton": case "GroupControl": case "XtraTabPage": case "LockCheckButton": case "StateButton": case "CheckEdit": case "LinkLabel": text = LanguageHelper.GetText(controlName, control.Text); if (text != null) { control.Text = text; } break; case "GridControl": GridControl grid = control as GridControl; GridView gv = grid.MainView as GridView; foreach (GridColumn column in gv.Columns) { var columnName = controlName + "." + column.Name; text = LanguageHelper.GetText(columnName, column.Caption); if (text != null) { column.Caption = text; } } break; case "RadioGroup": RadioGroup rg = control as RadioGroup; for (int i = 0; i < rg.Properties.Items.Count; i++) { RadioGroupItem item = rg.Properties.Items[i]; var columnName = controlName + ".item" + i; text = LanguageHelper.GetText(columnName, item.Description); if (text != null) { item.Description = text; } } break; default: break; } foreach (Control item in control.Controls) { LanguageTransform(item, parentName); } }
public BillsAglTransitions_Print() { InitializeComponent(); mGridControl = new GridControl(); }
private void InitGridControl(GridControl grid) { var gridListProperties = new List <GridListControlProperties>(); gridListProperties.Add(new GridListControlProperties { Header = "No", Width = 30 }); gridListProperties.Add(new GridListControlProperties { Header = "Nota Beli", Width = 100 }); gridListProperties.Add(new GridListControlProperties { Header = "Total", Width = 100, IsEditable = false, HorizontalAlignment = GridHorizontalAlignment.Right }); gridListProperties.Add(new GridListControlProperties { Header = "Kekurangan", Width = 100, IsEditable = false, HorizontalAlignment = GridHorizontalAlignment.Right }); gridListProperties.Add(new GridListControlProperties { Header = "Pembayaran", Width = 100, HorizontalAlignment = GridHorizontalAlignment.Right }); gridListProperties.Add(new GridListControlProperties { Header = "Keterangan", Width = 200 }); gridListProperties.Add(new GridListControlProperties { Header = "Aksi" }); GridListControlHelper.InitializeGridListControl <ItemPembayaranHutangProduk>(grid, _listOfItemPembayaranHutang, gridListProperties); grid.PushButtonClick += delegate(object sender, GridCellPushButtonClickEventArgs e) { if (e.ColIndex == 7) { if (grid.RowCount == 1) { MsgHelper.MsgWarning("Minimal 1 nota harus diinputkan !"); return; } if (MsgHelper.MsgDelete()) { var pembayaranHutang = _listOfItemPembayaranHutang[e.RowIndex - 1]; pembayaranHutang.entity_state = EntityState.Deleted; _listOfItemPembayaranHutangDeleted.Add(pembayaranHutang); _listOfItemPembayaranHutang.Remove(pembayaranHutang); grid.RowCount = _listOfItemPembayaranHutang.Count(); grid.Refresh(); RefreshTotal(); } } }; grid.QueryCellInfo += delegate(object sender, GridQueryCellInfoEventArgs e) { // Make sure the cell falls inside the grid if (e.RowIndex > 0) { if (!(_listOfItemPembayaranHutang.Count > 0)) { return; } double grand_total = 0; double sisaNota = 0; var itemPembayaran = _listOfItemPembayaranHutang[e.RowIndex - 1]; var beli = itemPembayaran.BeliProduk; if (beli != null) { grand_total = beli.grand_total; sisaNota = beli.sisa_nota; } switch (e.ColIndex) { case 1: // no urut e.Style.CellValue = e.RowIndex.ToString(); break; case 2: // nota beli if (beli != null) { e.Style.CellValue = beli.nota; } if (beli != null) { if (beli.tanggal_tempo.IsNull()) // nota tunai nominalnya tidak bisa diedit { e.Style.Enabled = false; e.Style.BackColor = ColorCollection.DEFAULT_FORM_COLOR; base.SetButtonSimpanToFalse(true); } } break; case 3: // total e.Style.CellValue = NumberHelper.NumberToString(grand_total); break; case 4: // kekurangan e.Style.CellValue = NumberHelper.NumberToString(sisaNota); break; case 5: // pembayaran if (beli != null) { if (beli.tanggal_tempo.IsNull()) // nota tunai nominalnya tidak bisa diedit { e.Style.Enabled = false; e.Style.BackColor = ColorCollection.DEFAULT_FORM_COLOR; } } e.Style.CellValue = NumberHelper.NumberToString(itemPembayaran.nominal); break; case 6: // keterangan e.Style.CellValue = itemPembayaran.keterangan; break; case 7: // button hapus e.Style.CellType = GridCellTypeName.PushButton; e.Style.HorizontalAlignment = GridHorizontalAlignment.Center; e.Style.Description = "Hapus"; if (beli != null) { e.Style.Enabled = !beli.tanggal_tempo.IsNull(); } break; default: break; } e.Handled = true; // we handled it, let the grid know } }; var colIndex = 2; // kolom nama produk grid.CurrentCell.MoveTo(1, colIndex, GridSetCurrentCellOptions.BeginEndUpdate); }
protected bool IsGrouped(GridControl grid) { return(grid.GroupCount > 0); }
private void InitializeComponent() { ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(PersonList)); this.imageList1 = new ImageList(); this.panel1 = new Panel(); this.btn_export = new SimpleButton(); this.txt_name = new TextEdit(); this.txt_Nunber = new TextEdit(); this.btn_select = new SimpleButton(); this.gridControl1 = new GridControl(); this.gridView1 = new GridView(); this.PersonID = new GridColumn(); this.PersonType = new GridColumn(); this.PersonNumber = new GridColumn(); this.PersonName = new GridColumn(); this.PersonImage = new GridColumn(); this.PersonAge = new GridColumn(); this.PersonSex = new GridColumn(); this.label2 = new Label(); this.label1 = new Label(); this.gridColumn1 = new GridColumn(); this.panel1.SuspendLayout(); ((ISupportInitialize)this.txt_name.Properties).BeginInit(); ((ISupportInitialize)this.txt_Nunber.Properties).BeginInit(); ((ISupportInitialize)this.gridControl1).BeginInit(); ((ISupportInitialize)this.gridView1).BeginInit(); base.SuspendLayout(); this.imageList1.ImageStream = (ImageListStreamer)componentResourceManager.GetObject("imageList1.ImageStream"); this.imageList1.TransparentColor = Color.Transparent; this.imageList1.Images.SetKeyName(0, "video.png"); this.panel1.Controls.Add(this.btn_export); this.panel1.Controls.Add(this.txt_name); this.panel1.Controls.Add(this.txt_Nunber); this.panel1.Controls.Add(this.btn_select); this.panel1.Controls.Add(this.gridControl1); this.panel1.Controls.Add(this.label2); this.panel1.Controls.Add(this.label1); this.panel1.Dock = DockStyle.Fill; this.panel1.Location = new Point(1, 1); this.panel1.Name = "panel1"; this.panel1.Padding = new Padding(10); this.panel1.Size = new Size(898, 659); this.panel1.TabIndex = 3; this.btn_export.Image = (Image)componentResourceManager.GetObject("btn_export.Image"); this.btn_export.ImageToTextAlignment = ImageAlignToText.LeftCenter; this.btn_export.Location = new Point(681, 17); this.btn_export.Name = "btn_export"; this.btn_export.Size = new Size(82, 23); this.btn_export.TabIndex = 15; this.btn_export.Text = "导出"; this.btn_export.Click += new EventHandler(this.btn_export_Click); this.txt_name.Location = new Point(381, 18); this.txt_name.Name = "txt_name"; this.txt_name.Size = new Size(162, 20); this.txt_name.TabIndex = 14; this.txt_Nunber.Location = new Point(104, 18); this.txt_Nunber.Name = "txt_Nunber"; this.txt_Nunber.Size = new Size(162, 20); this.txt_Nunber.TabIndex = 13; this.btn_select.Image = (Image)componentResourceManager.GetObject("btn_select.Image"); this.btn_select.ImageToTextAlignment = ImageAlignToText.LeftCenter; this.btn_select.Location = new Point(582, 17); this.btn_select.Name = "btn_select"; this.btn_select.Size = new Size(82, 23); this.btn_select.TabIndex = 12; this.btn_select.Text = "查 询"; this.btn_select.Click += new EventHandler(this.btn_Select_Click); this.gridControl1.Location = new Point(3, 58); this.gridControl1.LookAndFeel.SkinName = "Office 2010 Black"; this.gridControl1.MainView = this.gridView1; this.gridControl1.Name = "gridControl1"; this.gridControl1.Size = new Size(892, 598); this.gridControl1.TabIndex = 11; this.gridControl1.ViewCollection.AddRange(new BaseView[] { this.gridView1 }); this.gridView1.Columns.AddRange(new GridColumn[] { this.PersonID, this.PersonType, this.PersonNumber, this.PersonName, this.PersonImage, this.PersonAge, this.PersonSex }); this.gridView1.GridControl = this.gridControl1; this.gridView1.Name = "gridView1"; this.gridView1.OptionsBehavior.Editable = false; this.gridView1.OptionsView.ShowGroupPanel = false; this.gridView1.RowHeight = 60; this.PersonID.Caption = "人员ID"; this.PersonID.FieldName = "PersonID"; this.PersonID.Name = "PersonID"; this.PersonID.Visible = true; this.PersonID.VisibleIndex = 0; this.PersonType.Caption = "人员类别"; this.PersonType.FieldName = "PersonType"; this.PersonType.Name = "PersonType"; this.PersonType.Visible = true; this.PersonType.VisibleIndex = 1; this.PersonNumber.Caption = "人员编号"; this.PersonNumber.FieldName = "PersonNumber"; this.PersonNumber.Name = "PersonNumber"; this.PersonNumber.Visible = true; this.PersonNumber.VisibleIndex = 2; this.PersonName.Caption = "人员名称"; this.PersonName.FieldName = "PersonName"; this.PersonName.Name = "PersonName"; this.PersonName.Visible = true; this.PersonName.VisibleIndex = 3; this.PersonImage.Caption = "照片"; this.PersonImage.FieldName = "PersonImage"; this.PersonImage.Name = "PersonImage"; this.PersonImage.Visible = true; this.PersonImage.VisibleIndex = 4; this.PersonAge.Caption = "年龄"; this.PersonAge.FieldName = "PersonAge"; this.PersonAge.Name = "PersonAge"; this.PersonAge.Visible = true; this.PersonAge.VisibleIndex = 5; this.PersonSex.Caption = "人员性别"; this.PersonSex.FieldName = "PersonSex"; this.PersonSex.Name = "PersonSex"; this.PersonSex.Visible = true; this.PersonSex.VisibleIndex = 6; this.label2.AutoSize = true; this.label2.Font = new Font("微软雅黑", 9f, FontStyle.Regular, GraphicsUnit.Point, 134); this.label2.ForeColor = Color.White; this.label2.Location = new Point(25, 20); this.label2.Name = "label2"; this.label2.Size = new Size(68, 17); this.label2.TabIndex = 6; this.label2.Text = "人员编号:"; this.label1.AutoSize = true; this.label1.Font = new Font("微软雅黑", 9f, FontStyle.Regular, GraphicsUnit.Point, 134); this.label1.ForeColor = Color.White; this.label1.Location = new Point(292, 20); this.label1.Name = "label1"; this.label1.Size = new Size(68, 17); this.label1.TabIndex = 7; this.label1.Text = "人员名称:"; this.gridColumn1.Name = "gridColumn1"; this.gridColumn1.Visible = true; this.gridColumn1.VisibleIndex = 0; base.Appearance.Options.UseFont = true; base.AutoScaleMode = AutoScaleMode.None; base.ClientSize = new Size(900, 661); base.Controls.Add(this.panel1); this.Font = new Font("微软雅黑", 9f, FontStyle.Regular, GraphicsUnit.Point, 134); base.FormBorderStyle = FormBorderStyle.SizableToolWindow; base.MaximizeBox = false; base.MinimizeBox = false; base.Name = "PersonList"; base.Padding = new Padding(1); base.ShowIcon = false; base.ShowInTaskbar = false; base.StartPosition = FormStartPosition.CenterScreen; this.Text = "人员名单查询"; this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); ((ISupportInitialize)this.txt_name.Properties).EndInit(); ((ISupportInitialize)this.txt_Nunber.Properties).EndInit(); ((ISupportInitialize)this.gridControl1).EndInit(); ((ISupportInitialize)this.gridView1).EndInit(); base.ResumeLayout(false); }
private void InitializeComponent() { this.components = (IContainer) new Container(); this.atButtonsPanel1 = new atButtonsPanel(); this.panelControlDialog = new PanelControl(); this.simpleButtonOk = new SimpleButton(); this.simpleButtonCancel = new SimpleButton(); this.contextMenuStrip1 = new ContextMenuStrip(this.components); this.toolStripMenuItemAdd = new ToolStripMenuItem(); this.toolStripMenuItemDouble = new ToolStripMenuItem(); this.toolStripMenuItemDelete = new ToolStripMenuItem(); this.gridControlDocState = new GridControl(); this.gridViewDocState = new GridView(); this.coliddocstate = new GridColumn(); this.colnumpos = new GridColumn(); this.colname = new GridColumn(); this.colcomment = new GridColumn(); this.colbeginstate = new GridColumn(); this.colendstate = new GridColumn(); this.coldocappearance_name = new GridColumn(); this.repositoryItemComboBoxDocAppearance = new RepositoryItemComboBox(); this.atButtonsPanel1.BeginInit(); this.panelControlDialog.BeginInit(); this.panelControlDialog.SuspendLayout(); this.contextMenuStrip1.SuspendLayout(); this.gridControlDocState.BeginInit(); this.gridViewDocState.BeginInit(); this.repositoryItemComboBoxDocAppearance.BeginInit(); this.SuspendLayout(); this.atButtonsPanel1.AcceptButton = atButtonsPanel.bpButtons.None; this.atButtonsPanel1.CancelButton = atButtonsPanel.bpButtons.None; this.atButtonsPanel1.CancelButtonText = ""; this.atButtonsPanel1.CancelButtonUseCancelSelect = true; this.atButtonsPanel1.CancelButtonVisible = true; this.atButtonsPanel1.CloseButtonText = ""; this.atButtonsPanel1.CloseButtonUseCancelSelect = false; this.atButtonsPanel1.CloseButtonVisible = false; this.atButtonsPanel1.DataMember = (string)null; this.atButtonsPanel1.DataSource = (DataSet)null; this.atButtonsPanel1.Dock = DockStyle.Bottom; this.atButtonsPanel1.EnabledCancelButton = true; this.atButtonsPanel1.EnabledCloseButton = true; this.atButtonsPanel1.EnabledPrintButton = true; this.atButtonsPanel1.EnabledRefreshButton = true; this.atButtonsPanel1.EnabledSaveButton = true; this.atButtonsPanel1.EnabledScriptButton = true; this.atButtonsPanel1.IdDocAppearance = 0; this.atButtonsPanel1.Location = new Point(0, 468); this.atButtonsPanel1.Name = "atButtonsPanel1"; this.atButtonsPanel1.PrintButtonText = ""; this.atButtonsPanel1.PrintButtonVisible = false; this.atButtonsPanel1.ProcessedIsDialog = false; this.atButtonsPanel1.RefreshButtonText = "Обновить"; this.atButtonsPanel1.RefreshButtonUseSelectItem = true; this.atButtonsPanel1.RefreshButtonVisible = true; this.atButtonsPanel1.SaveButtonText = "Выбрать"; this.atButtonsPanel1.SaveButtonUseSelectItem = true; this.atButtonsPanel1.SaveButtonVisible = true; this.atButtonsPanel1.ScriptButtonText = ""; this.atButtonsPanel1.ScriptButtonVisible = false; this.atButtonsPanel1.Size = new Size(744, 33); this.atButtonsPanel1.TabIndex = 0; this.atButtonsPanel1.TextCancelButton = "Отменить"; this.atButtonsPanel1.TextCloseButton = "Закрыть"; this.atButtonsPanel1.TextPrintButton = "Печать..."; this.atButtonsPanel1.TextRefreshButton = "Обновить"; this.atButtonsPanel1.TextSaveButton = "Применить"; this.atButtonsPanel1.TextScriptButton = "Скрипты..."; this.atButtonsPanel1.VisibleCancelButton = true; this.atButtonsPanel1.VisibleCloseButton = true; this.atButtonsPanel1.VisiblePrintButton = false; this.atButtonsPanel1.VisibleRefreshButton = false; this.atButtonsPanel1.VisibleSaveButton = true; this.atButtonsPanel1.VisibleScriptButton = false; this.atButtonsPanel1.WidthPrintButton = 75; this.panelControlDialog.BorderStyle = BorderStyles.NoBorder; this.panelControlDialog.Controls.Add((Control)this.simpleButtonOk); this.panelControlDialog.Controls.Add((Control)this.simpleButtonCancel); this.panelControlDialog.Dock = DockStyle.Bottom; this.panelControlDialog.Location = new Point(0, 435); this.panelControlDialog.LookAndFeel.Style = LookAndFeelStyle.Flat; this.panelControlDialog.LookAndFeel.UseDefaultLookAndFeel = false; this.panelControlDialog.Name = "panelControlDialog"; this.panelControlDialog.Size = new Size(744, 33); this.panelControlDialog.TabIndex = 1; this.simpleButtonOk.Anchor = AnchorStyles.Top | AnchorStyles.Right; this.simpleButtonOk.ButtonStyle = BorderStyles.Simple; this.simpleButtonOk.DialogResult = DialogResult.OK; this.simpleButtonOk.Location = new Point(578, 6); this.simpleButtonOk.LookAndFeel.Style = LookAndFeelStyle.UltraFlat; this.simpleButtonOk.LookAndFeel.UseDefaultLookAndFeel = false; this.simpleButtonOk.Name = "simpleButtonOk"; this.simpleButtonOk.Size = new Size(73, 23); this.simpleButtonOk.TabIndex = 1; this.simpleButtonOk.Text = "Выбрать"; this.simpleButtonOk.Click += new EventHandler(this.simpleButton1_Click); this.simpleButtonCancel.Anchor = AnchorStyles.Top | AnchorStyles.Right; this.simpleButtonCancel.ButtonStyle = BorderStyles.Simple; this.simpleButtonCancel.DialogResult = DialogResult.Cancel; this.simpleButtonCancel.Location = new Point(657, 6); this.simpleButtonCancel.LookAndFeel.Style = LookAndFeelStyle.UltraFlat; this.simpleButtonCancel.LookAndFeel.UseDefaultLookAndFeel = false; this.simpleButtonCancel.Name = "simpleButtonCancel"; this.simpleButtonCancel.Size = new Size(73, 23); this.simpleButtonCancel.TabIndex = 0; this.simpleButtonCancel.Text = "Отменить"; this.simpleButtonCancel.Click += new EventHandler(this.simpleButtonCancel_Click); this.contextMenuStrip1.Items.AddRange(new ToolStripItem[3] { (ToolStripItem)this.toolStripMenuItemAdd, (ToolStripItem)this.toolStripMenuItemDouble, (ToolStripItem)this.toolStripMenuItemDelete }); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new Size(220, 70); this.toolStripMenuItemAdd.Name = "toolStripMenuItemAdd"; this.toolStripMenuItemAdd.ShortcutKeys = Keys.Insert | Keys.Control; this.toolStripMenuItemAdd.Size = new Size(219, 22); this.toolStripMenuItemAdd.Text = "Добавить"; this.toolStripMenuItemAdd.Click += new EventHandler(this.toolStripMenuItemAdd_Click); this.toolStripMenuItemDouble.Name = "toolStripMenuItemDouble"; this.toolStripMenuItemDouble.ShortcutKeys = Keys.Insert | Keys.Shift | Keys.Control; this.toolStripMenuItemDouble.Size = new Size(219, 22); this.toolStripMenuItemDouble.Text = "Дублировать"; this.toolStripMenuItemDouble.Click += new EventHandler(this.toolStripMenuItemDouble_Click); this.toolStripMenuItemDelete.Name = "toolStripMenuItemDelete"; this.toolStripMenuItemDelete.ShortcutKeys = Keys.Delete | Keys.Control; this.toolStripMenuItemDelete.Size = new Size(219, 22); this.toolStripMenuItemDelete.Text = "Удалить"; this.toolStripMenuItemDelete.Click += new EventHandler(this.toolStripMenuItemDelete_Click); this.gridControlDocState.ContextMenuStrip = this.contextMenuStrip1; this.gridControlDocState.DataMember = "docstate"; this.gridControlDocState.Dock = DockStyle.Fill; this.gridControlDocState.EmbeddedNavigator.Name = ""; this.gridControlDocState.Location = new Point(0, 0); this.gridControlDocState.LookAndFeel.Style = LookAndFeelStyle.Flat; this.gridControlDocState.LookAndFeel.UseDefaultLookAndFeel = false; this.gridControlDocState.MainView = (BaseView)this.gridViewDocState; this.gridControlDocState.Name = "gridControlDocState"; this.gridControlDocState.RepositoryItems.AddRange(new RepositoryItem[1] { (RepositoryItem)this.repositoryItemComboBoxDocAppearance }); this.gridControlDocState.Size = new Size(744, 435); this.gridControlDocState.TabIndex = 3; this.gridControlDocState.ViewCollection.AddRange(new BaseView[1] { (BaseView)this.gridViewDocState }); this.gridViewDocState.Appearance.GroupPanel.BackColor = Color.FromArgb(128, 128, (int)byte.MaxValue); this.gridViewDocState.Appearance.GroupPanel.BackColor2 = Color.FromArgb(192, 192, (int)byte.MaxValue); this.gridViewDocState.Appearance.GroupPanel.Options.UseBackColor = true; this.gridViewDocState.BorderStyle = BorderStyles.Simple; this.gridViewDocState.Columns.AddRange(new GridColumn[7] { this.coliddocstate, this.colnumpos, this.colname, this.colcomment, this.colbeginstate, this.colendstate, this.coldocappearance_name }); this.gridViewDocState.GridControl = this.gridControlDocState; this.gridViewDocState.GroupPanelText = "Панель группировки"; this.gridViewDocState.Name = "gridViewDocState"; this.gridViewDocState.OptionsView.ShowIndicator = false; this.coliddocstate.Caption = "#"; this.coliddocstate.FieldName = "iddocstate"; this.coliddocstate.Name = "coliddocstate"; this.coliddocstate.Visible = true; this.coliddocstate.VisibleIndex = 0; this.colnumpos.Caption = "Номер"; this.colnumpos.FieldName = "numpos"; this.colnumpos.Name = "colnumpos"; this.colnumpos.Visible = true; this.colnumpos.VisibleIndex = 1; this.colname.Caption = "Наименование"; this.colname.FieldName = "name"; this.colname.Name = "colname"; this.colname.Visible = true; this.colname.VisibleIndex = 2; this.colcomment.Caption = "Коментарий"; this.colcomment.FieldName = "comment"; this.colcomment.Name = "colcomment"; this.colcomment.Visible = true; this.colcomment.VisibleIndex = 3; this.colbeginstate.Caption = "Начальный статус"; this.colbeginstate.FieldName = "beginstate"; this.colbeginstate.Name = "colbeginstate"; this.colbeginstate.Visible = true; this.colbeginstate.VisibleIndex = 4; this.colendstate.Caption = "Конечный статус"; this.colendstate.FieldName = "endstate"; this.colendstate.Name = "colendstate"; this.colendstate.Visible = true; this.colendstate.VisibleIndex = 5; this.coldocappearance_name.Caption = "Вид документа"; this.coldocappearance_name.ColumnEdit = (RepositoryItem)this.repositoryItemComboBoxDocAppearance; this.coldocappearance_name.FieldName = "docappearance_name"; this.coldocappearance_name.Name = "coldocappearance_name"; this.coldocappearance_name.Visible = true; this.coldocappearance_name.VisibleIndex = 6; this.repositoryItemComboBoxDocAppearance.AutoHeight = false; this.repositoryItemComboBoxDocAppearance.Buttons.AddRange(new EditorButton[1] { new EditorButton(ButtonPredefines.Combo) }); this.repositoryItemComboBoxDocAppearance.Name = "repositoryItemComboBoxDocAppearance"; this.repositoryItemComboBoxDocAppearance.TextEditStyle = TextEditStyles.DisableTextEditor; this.AutoScaleDimensions = new SizeF(6f, 13f); this.AutoScaleMode = AutoScaleMode.Font; this.Controls.Add((Control)this.gridControlDocState); this.Controls.Add((Control)this.panelControlDialog); this.Controls.Add((Control)this.atButtonsPanel1); this.Name = "DocStateForm"; this.Size = new Size(744, 501); this.Text = "Статусы документов"; this.atButtonsPanel1.EndInit(); this.panelControlDialog.EndInit(); this.panelControlDialog.ResumeLayout(false); this.contextMenuStrip1.ResumeLayout(false); this.gridControlDocState.EndInit(); this.gridViewDocState.EndInit(); this.repositoryItemComboBoxDocAppearance.EndInit(); this.ResumeLayout(false); }
private void ConditionsColumnView(GridControl grd) { try { StyleFormatCondition[] cnArr = new StyleFormatCondition[14]; cnArr[0] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[0].Column = ((ColumnView)grd.MainView).Columns["INJ"]; cnArr[0].Expression = @"[INJ] > 0 AND [ASSIGN_QTY] > [INJ]"; cnArr[0].Appearance.ForeColor = Color.Red; cnArr[0].Appearance.Options.UseBackColor = true; cnArr[0].Appearance.Options.UseForeColor = true; cnArr[0].ApplyToRow = false; cnArr[1] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[1].Column = ((ColumnView)grd.MainView).Columns["TRM"]; cnArr[1].Expression = @"[TRM] > 0 AND [ASSIGN_QTY] > [TRM]"; cnArr[1].Appearance.ForeColor = Color.Red; cnArr[1].ApplyToRow = false; cnArr[2] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[2].Column = ((ColumnView)grd.MainView).Columns["ELC"]; cnArr[2].Expression = @"[ELC] > 0 AND [ASSIGN_QTY] > [ELC]"; cnArr[2].Appearance.ForeColor = Color.Red; cnArr[2].ApplyToRow = false; cnArr[3] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[3].Column = ((ColumnView)grd.MainView).Columns["ALL_"]; cnArr[3].Expression = @"[ALL_] > 0 AND [ASSIGN_QTY] > [ALL_]"; cnArr[3].Appearance.ForeColor = Color.Red; cnArr[3].ApplyToRow = false; cnArr[4] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[4].Column = ((ColumnView)grd.MainView).Columns["QC"]; cnArr[4].Expression = @"[QC] > 0 AND [ASSIGN_QTY] > [QC]"; cnArr[4].Appearance.ForeColor = Color.Red; cnArr[4].ApplyToRow = false; cnArr[5] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[5].Column = ((GridView)grd.MainView).Columns["FINISH"]; cnArr[5].Expression = @"[FINISH] > 0 AND [ASSIGN_QTY] > [FINISH]"; cnArr[5].Appearance.ForeColor = Color.Red; cnArr[5].ApplyToRow = false; cnArr[6] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[6].Column = ((ColumnView)grd.MainView).Columns["STOCK_IN"]; cnArr[6].Expression = @"[STOCK_IN] > 0 AND [FINISH] > [STOCK_IN]"; cnArr[6].Appearance.ForeColor = Color.Red; cnArr[6].ApplyToRow = false; cnArr[7] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[7].Column = ((ColumnView)grd.MainView).Columns["LOAD"]; cnArr[7].Expression = @"[LOAD] > 0 AND [PICK] > [LOAD]"; cnArr[7].Appearance.ForeColor = Color.Red; cnArr[7].ApplyToRow = false; cnArr[8] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[8].Column = ((ColumnView)grd.MainView).Columns["INJ_WIP"]; cnArr[8].Expression = @"[INJ_WIP] > 0"; cnArr[8].Appearance.ForeColor = Color.Red; cnArr[8].ApplyToRow = false; cnArr[9] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[9].Column = ((ColumnView)grd.MainView).Columns["TRM_WIP"]; cnArr[9].Expression = @"[TRM_WIP] > 0"; cnArr[9].Appearance.ForeColor = Color.Red; cnArr[9].ApplyToRow = false; cnArr[10] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[10].Column = ((ColumnView)grd.MainView).Columns["ELC_WIP"]; cnArr[10].Expression = @"[ELC_WIP] > 0"; cnArr[10].Appearance.ForeColor = Color.Red; cnArr[10].ApplyToRow = false; cnArr[11] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[11].Column = ((ColumnView)grd.MainView).Columns["PRQ_WIP"]; cnArr[11].Expression = @"[PRQ_WIP] > 0"; cnArr[11].Appearance.ForeColor = Color.Red; cnArr[11].ApplyToRow = false; cnArr[12] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[12].Column = ((ColumnView)grd.MainView).Columns["QC_WIP"]; cnArr[12].Expression = @"[QC_WIP] > 0"; cnArr[12].Appearance.ForeColor = Color.Red; cnArr[12].ApplyToRow = false; cnArr[13] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[13].Column = ((ColumnView)grd.MainView).Columns["FG_WIP"]; cnArr[13].Expression = @"[FG_WIP] > 0"; cnArr[13].Appearance.ForeColor = Color.Red; cnArr[13].ApplyToRow = false; ((ColumnView)grd.MainView).FormatConditions.AddRange(cnArr); } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }