public CalcGrid() : base() { //Avoid the complexity of sorting: this.ApplyVisualStyles = true; this.ThemesEnabled = true; this.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; GridMetroColors color = new GridMetroColors(); color.HeaderColor.HoverColor = ColorTranslator.FromHtml("#003B51"); color.HeaderColor.NormalColor = Color.FromArgb(48, 126, 156); //Color.FromArgb(51, 153, 255); color.HeaderTextColor.NormalTextColor = Color.White; color.HeaderTextColor.HoverTextColor = Color.White; color.HeaderBottomBorderWeight = GridBottomBorderWeight.None; this.SetMetroStyle(color); //this.VScrollBehavior = GridScrollbarMode.AutoScroll; //this.HScrollBehavior = GridScrollbarMode.AutoScroll; this.RowHeights[0] = 55; this.DefaultRowHeight = 50; this.QueryCellInfo += CalcGrid_QueryCellInfo; this.Properties.BackgroundColor = Color.Transparent; this.ForeColor = Color.White; this.TableStyle.TextColor = Color.White; this.BackColor = ColorTranslator.FromHtml("#003B51"); this.GridVisualStyles = GridVisualStyles.Metro; this.BorderStyle = BorderStyle.FixedSingle; this.TableStyle.HorizontalAlignment = GridHorizontalAlignment.Center; this.TableStyle.VerticalAlignment = GridVerticalAlignment.Middle; this.TableStyle.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, Color.FromArgb(0, 59, 100), GridBorderWeight.ExtraThin); this.TableStyle.Borders.Right = new GridBorder(GridBorderStyle.Solid, Color.FromArgb(0, 59, 100), GridBorderWeight.ExtraThin); }
/// <summary> /// GridGrouping control getting started customization. /// </summary> private void GridSettings() { this.gridGroupingControl1.AllowProportionalColumnSizing = true; this.gridGroupingControl1.Table.DefaultRecordRowHeight = 20; this.gridGroupingControl1.Table.DefaultColumnHeaderRowHeight = 20; this.gridGroupingControl1.TableDescriptor.Name = "Products"; this.gridGroupingControl1.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell; this.gridGroupingControl1.TableDescriptor.VisibleColumns.Move(4, 1); this.gridGroupingControl1.TableDescriptor.VisibleColumns.Move(4, 3); this.gridGroupingControl1.TableOptions.GridVisualStyles = GridVisualStyles.Metro; this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false; this.gridGroupingControl1.TopLevelGroupOptions.ShowCaption = false; this.gridGroupingControl1.GridVisualStyles = GridVisualStyles.Metro; this.gridGroupingControl1.GridOfficeScrollBars = OfficeScrollBars.Metro; this.gridGroupingControl1.UseRightToLeftCompatibleTextBox = true; this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One; this.gridGroupingControl1.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.DrawAlphablend; GridMetroColors metro = new GridMetroColors(); metro.HeaderBottomBorderWeight = GridBottomBorderWeight.None; this.gridGroupingControl1.SetMetroStyle(metro); stream = new System.IO.MemoryStream(); this.gridGroupingControl1.WriteXmlSchema(new XmlTextWriter(stream, null)); this.gridGroupingControl1.TableDescriptor.Columns["ProductID"].HeaderText = "Product ID"; this.gridGroupingControl1.TableDescriptor.Columns["UnitPrice"].HeaderText = "Unit Price"; this.gridGroupingControl1.TableDescriptor.Columns["ProductName"].HeaderText = "Product Name"; this.gridGroupingControl1.TableDescriptor.Columns["SupplierID"].HeaderText = "Supplier ID"; }
private void GridSetting() { GridConditionalFormatDescriptor format1 = new GridConditionalFormatDescriptor(); format1.Appearance.AnyRecordFieldCell.TextColor = Color.Black; format1.Appearance.AnyRecordFieldCell.Interior = new BrushInfo(Color.LightPink); format1.Expression = "[DOS1_5]='' OR [DOS1_5]='0'" + "OR [DOS1_5]='' OR [DOS1_5]='0'" + "OR [DOS6_10]='' OR [DOS6_10]='0'" + "OR [DOS11_15]='' OR [DOS11_15]='0'" + "OR [DOS16_20]='' OR [DOS16_20]='0'" + "OR [DOS21_25]='' OR [DOS21_25]='0'" + "OR [DOS26_31]='' OR [DOS26_31]='0'"; DG2.TableDescriptor.ConditionalFormats.Add(format1); DG2.ThemesEnabled = false; DG2.Appearance.ColumnHeaderCell.Themed = false; DG2.Appearance.ColumnHeaderCell.Interior = new BrushInfo(GradientStyle.Vertical, Color.LightSkyBlue, Color.White); DG2.Appearance.ColumnHeaderCell.TextColor = Color.Black; DG2.TableDescriptor.VisibleColumns.Remove("VendorID"); DG2.TableDescriptor.Appearance.AnyCell.TextColor = Color.Black; DG2.TableDescriptor.Appearance.AnyRecordFieldCell.Font = new Syncfusion.Windows.Forms.Grid.GridFontInfo(new Font("Arial", 10f, FontStyle.Regular)); DG2.TableDescriptor.Columns["Product_Name"].Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Left; DG2.TableDescriptor.Columns["Product_Name"].Appearance.AnyRecordFieldCell.WrapText = true; DG2.TableDescriptor.Columns["Product_Name"].Width = 365; DG2.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false; DG2.TopLevelGroupOptions.ShowCaption = false; DG2.AllowProportionalColumnSizing = false; DG2.TableDescriptor.Columns["DOS1_5"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.ComboBox; DG2.TableDescriptor.Columns["DOS6_10"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.OriginalTextBox; DG2.TableDescriptor.Columns["DOS11_15"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.FormulaCell; DG2.TableDescriptor.Columns["DOS16_20"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.TextBox; DG2.TableDescriptor.Columns["DOS1_5"].Appearance.AnyCell.ReadOnly = false; DG2.TableDescriptor.Columns["DOS6_10"].Appearance.AnyCell.ReadOnly = false; DG2.TableDescriptor.Columns["DOS11_15"].Appearance.AnyCell.ReadOnly = false; DG2.TableDescriptor.Columns["DOS16_20"].Appearance.AnyCell.ReadOnly = false; DG2.TableDescriptor.Columns["DOS21_25"].Appearance.AnyCell.ReadOnly = false; DG2.TableDescriptor.Columns["DOS26_31"].Appearance.AnyCell.ReadOnly = false; GridMetroColors colors = new GridMetroColors(); colors.PushButtonColor.NormalBackColor = Color.FromArgb(22, 165, 220); colors.PushButtonColor.HoverBackColor = Color.FromArgb(26, 198, 255); colors.PushButtonColor.PushedBackColor = Color.FromArgb(120, 191, 217); this.DG2.SetMetroStyle(colors); DG2.TableDescriptor.AllowNew = false; DG2.Refresh(); DG2.Invalidate(); DG2.TableControl.RefreshRange(GridRangeInfo.Table()); }
private void Form2_Load(object sender, EventArgs e) { this.tabBarSplitterControl1.AddButtonHoverColor = ColorTranslator.FromHtml("#217346"); this.tabBarSplitterControl1.ControlAdded += new ControlEventHandler(tabBarSplitterControl1_ControlAdded); this.gridControl1.Dock = DockStyle.Fill; this.gridControl1.AlphaBlendSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(94)))), ((int)(((byte)(171)))), ((int)(((byte)(222))))); this.gridControl1.ColCount = 40; this.gridControl1.DefaultGridBorderStyle = Syncfusion.Windows.Forms.Grid.GridBorderStyle.Solid; this.gridControl1.DefaultRowHeight = 20; this.gridControl1.GridOfficeScrollBars = Syncfusion.Windows.Forms.OfficeScrollBars.Metro; // this.gridControl1.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; this.gridControl1.Location = new System.Drawing.Point(189, 136); this.gridControl1.MetroScrollBars = true; this.gridControl1.Name = "gridControl1"; this.gridControl1.Properties.ForceImmediateRepaint = false; this.gridControl1.Properties.GridLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(212)))), ((int)(((byte)(212))))); this.gridControl1.Properties.MarkColHeader = false; this.gridControl1.Properties.MarkRowHeader = false; this.gridControl1.RowCount = 50; this.gridControl1.RowHeightEntries.AddRange(new Syncfusion.Windows.Forms.Grid.GridRowHeight[] { new Syncfusion.Windows.Forms.Grid.GridRowHeight(0, 29) }); this.gridControl1.SerializeCellsBehavior = Syncfusion.Windows.Forms.Grid.GridSerializeCellsBehavior.SerializeAsRangeStylesIntoCode; this.gridControl1.Size = new System.Drawing.Size(321, 189); this.gridControl1.SmartSizeBox = false; this.gridControl1.TabIndex = 2; this.gridControl1.Text = "gridControl1"; this.gridControl1.ThemesEnabled = true; this.gridControl1.UseRightToLeftCompatibleTextBox = true; this.tabBarSplitterControl1.ActivePageBorderColor = ColorTranslator.FromHtml("#217346"); this.tabBarSplitterControl1.ForeColor = ColorTranslator.FromHtml("#444444"); GridMetroColors theme = new GridMetroColors(); theme.HeaderBottomBorderWeight = GridBottomBorderWeight.Thick; theme.HeaderBottomBorderColor = ColorTranslator.FromHtml("#217346"); theme.HeaderColor.HoverColor = ColorTranslator.FromHtml("#9fd5b7"); theme.HeaderTextColor.NormalTextColor = Color.Black; this.gridControl1.SetMetroStyle(theme); this.gridControl1.QueryCellInfo += new Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventHandler(gridControl1_QueryCellInfo); this.superAccelerator1.SetAccelerator(this.HyperLinkBtn, "sd"); this.tabBarSplitterControl1.ShowAddNewTabBarPageOption = false; }
private void GridSetting() { GridConditionalFormatDescriptor format1 = new GridConditionalFormatDescriptor(); format1.Appearance.AnyRecordFieldCell.TextColor = Color.Black; format1.Appearance.AnyRecordFieldCell.Interior = new BrushInfo(Color.LightGreen); format1.Expression = "[Status]='Sent' OR [Status]='SENT' "; DG2.TableDescriptor.ConditionalFormats.Add(format1); DG2.ThemesEnabled = false; DG2.Appearance.ColumnHeaderCell.Themed = false; DG2.Appearance.ColumnHeaderCell.Interior = new BrushInfo(GradientStyle.Vertical, Color.LightSkyBlue, Color.White); DG2.Appearance.ColumnHeaderCell.TextColor = Color.Black; DG2.TableDescriptor.VisibleColumns.Remove("VendorID"); DG2.TableDescriptor.Appearance.AnyCell.TextColor = Color.Black; DG2.TableDescriptor.Appearance.AnyRecordFieldCell.Font = new Syncfusion.Windows.Forms.Grid.GridFontInfo(new Font("Arial", 10f, FontStyle.Regular)); DG2.TableDescriptor.Columns["Vendor"].Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Left; DG2.TableDescriptor.Columns["Vendor"].Appearance.AnyRecordFieldCell.WrapText = true; DG2.TableDescriptor.Columns["Vendor"].Width = 250; DG2.TableDescriptor.Columns["Email"].Width = 150; DG2.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false; DG2.TopLevelGroupOptions.ShowCaption = false; DG2.AllowProportionalColumnSizing = false; GridMetroColors colors = new GridMetroColors(); colors.PushButtonColor.NormalBackColor = Color.FromArgb(22, 165, 220); colors.PushButtonColor.HoverBackColor = Color.FromArgb(26, 198, 255); colors.PushButtonColor.PushedBackColor = Color.FromArgb(120, 191, 217); this.DG2.SetMetroStyle(colors); DG2.TableDescriptor.AllowNew = false; DG2.Refresh(); DG2.Invalidate(); DG2.TableControl.RefreshRange(GridRangeInfo.Table()); }
/// <summary> /// Event will be triggered when control is added in tabBarSplitterControl1. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void tabBarSplitterControl1_ControlAdded(object sender, ControlEventArgs e) { if (e.Control is TabBarPage) { e.Control.Text = "片" + sheetnumber.ToString(); sheetnumber++; Syncfusion.Windows.Forms.Grid.GridControl gridControl = new Syncfusion.Windows.Forms.Grid.GridControl(); gridControl.Dock = DockStyle.Fill; gridControl.AlphaBlendSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(94)))), ((int)(((byte)(171)))), ((int)(((byte)(222))))); gridControl.ColCount = 100; gridControl.DefaultGridBorderStyle = Syncfusion.Windows.Forms.Grid.GridBorderStyle.Solid; gridControl.DefaultRowHeight = 20; gridControl.Location = new System.Drawing.Point(189, 136); gridControl.Name = "gridControl1"; gridControl.Properties.ForceImmediateRepaint = false; gridControl.Properties.GridLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(212)))), ((int)(((byte)(212))))); gridControl.Properties.MarkColHeader = false; gridControl.Properties.MarkRowHeader = false; gridControl.RowCount = 100; gridControl.RowHeightEntries.AddRange(new Syncfusion.Windows.Forms.Grid.GridRowHeight[] { new Syncfusion.Windows.Forms.Grid.GridRowHeight(0, 29) }); gridControl.SerializeCellsBehavior = Syncfusion.Windows.Forms.Grid.GridSerializeCellsBehavior.SerializeAsRangeStylesIntoCode; gridControl.Size = new System.Drawing.Size(321, 189); gridControl.SmartSizeBox = false; gridControl.TabIndex = 2; gridControl.Text = "gridControl1"; gridControl.ThemesEnabled = true; GridMetroColors theme = new GridMetroColors(); theme.HeaderBottomBorderWeight = GridBottomBorderWeight.Thick; theme.HeaderBottomBorderColor = ColorTranslator.FromHtml("#217346"); theme.HeaderColor.HoverColor = ColorTranslator.FromHtml("#9fd5b7"); theme.HeaderTextColor.NormalTextColor = Color.Black; gridControl.SetMetroStyle(theme); e.Control.Controls.Add(gridControl); } }
/// <summary> /// Setting Grid control Properties /// </summary> private void GridSettings() { String commandstring1 = "select * from Customers"; DataSet1 ds = new DataSet1(); this.gridControl1.ColCount = 10; SqlCeDataAdapter da1 = new SqlCeDataAdapter(commandstring1, connString); try { da1.Fill(ds, "Customers"); } catch (SqlException ex) { ShowErrorMessage(ex); } for (int i = 1; i <= this.gridControl1.RowCount; ++i) { for (int j = 1; j <= this.gridControl1.ColCount; ++j) { this.gridControl1[i, j].CellValue = ds.Tables["Customers"].Rows[i][j - 1].ToString(); } } for (int j = 1; j <= this.gridControl1.ColCount; ++j) { this.gridControl1[0, j].Text = ds.Tables["Customers"].Columns[j - 1].Caption; } this.gridControl1.Model.ColWidths.ResizeToFitOptimized(GridRangeInfo.Table(), GridResizeToFitOptions.NoShrinkSize); this.gridControl1.Refresh(); GridMetroColors colors = new GridMetroColors(); colors.HeaderColor.PressedColor = Color.LightGray; this.gridControl1.SetMetroStyle(colors); this.gridControl1.DefaultRowHeight = 22; //tab key navigation set as false to move the next control this.gridControl1.WantTabKey = false; }
public Form1() { LocalizationProvider.Provider = new localization(); InitializeComponent(); this.pictureBox1.Height += 5; this.ribbonControlAdv1.QuickPanelVisible = true; this.ribbonControlAdv1.MenuColor = ColorTranslator.FromHtml("#217346"); this.statusStripEx1.BackColor = ColorTranslator.FromHtml("#217346"); this.statusStripLabel1.ForeColor = Color.White; this.ribbonControlAdv1.MenuButtonText = "File"; this.ribbonControlAdv1.UseDefaultHighlightColor = false; this.trackBarItem1.TrackBarExControl.Style = TrackBarEx.Theme.Metro; this.trackBarItem1.TrackBarExControl.BackColor = ColorTranslator.FromHtml("#217346"); this.trackBarItem1.TrackBarExControl.ButtonSignColor = ColorTranslator.FromHtml("#09542b"); this.trackBarItem1.TrackBarExControl.ForeColor = Color.White; this.trackBarItem1.TrackBarExControl.ShowButtons = true; this.backStageButton1.Click += new EventHandler(backStage1_Click); foreach (ToolStripTabItem items in this.ribbonControlAdv1.Header.MainItems) { foreach (ToolStripEx item in items.Panel.Controls) { item.LauncherClick += new EventHandler(item_LauncherClick); } } this.ribbonControlAdv1.MenuButtonText = "文件"; this.page.Dock = DockStyle.Fill; this.WindowState = FormWindowState.Maximized; page.Text = "TabBarPage1"; this.gridControl1.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; this.gridControl1.Dock = DockStyle.Fill; this.gridControl1.GridVisualStyles = GridVisualStyles.Metro; this.gridControl1.Dock = DockStyle.Fill; this.gridControl1.AlphaBlendSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(94)))), ((int)(((byte)(171)))), ((int)(((byte)(222))))); this.gridControl1.ColCount = 100; this.gridControl1.DefaultGridBorderStyle = Syncfusion.Windows.Forms.Grid.GridBorderStyle.Solid; this.gridControl1.DefaultRowHeight = 20; this.gridControl1.GridOfficeScrollBars = Syncfusion.Windows.Forms.OfficeScrollBars.Metro; this.gridControl1.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; this.gridControl1.Location = new System.Drawing.Point(189, 136); this.gridControl1.MetroScrollBars = true; this.gridControl1.Name = "gridControl1"; this.gridControl1.Properties.ForceImmediateRepaint = false; this.gridControl1.Properties.GridLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(212)))), ((int)(((byte)(212))))); this.gridControl1.Properties.MarkColHeader = false; this.gridControl1.Properties.MarkRowHeader = false; this.gridControl1.RowCount = 100; this.gridControl1.RowHeightEntries.AddRange(new Syncfusion.Windows.Forms.Grid.GridRowHeight[] { new Syncfusion.Windows.Forms.Grid.GridRowHeight(0, 29) }); this.gridControl1.SerializeCellsBehavior = Syncfusion.Windows.Forms.Grid.GridSerializeCellsBehavior.SerializeAsRangeStylesIntoCode; this.gridControl1.Size = new System.Drawing.Size(321, 189); this.gridControl1.SmartSizeBox = false; this.gridControl1.TabIndex = 2; this.gridControl1.Text = "gridControl1"; this.gridControl1.ThemesEnabled = true; this.gridControl1.UseRightToLeftCompatibleTextBox = true; GridMetroColors theme = new GridMetroColors(); this.gridControl1.QueryCellInfo += new Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventHandler(gridControl1_QueryCellInfo); theme.HeaderBottomBorderWeight = GridBottomBorderWeight.Thick; theme.HeaderBottomBorderColor = ColorTranslator.FromHtml("#217346"); theme.HeaderColor.HoverColor = ColorTranslator.FromHtml("#9fd5b7"); theme.HeaderTextColor.NormalTextColor = Color.Black; this.gridControl1.SetMetroStyle(theme); this.tabBarSplitterControl2.ActivePageBorderColor = ColorTranslator.FromHtml("#217346"); this.tabBarSplitterControl2.ShowAddNewTabBarPageOption = true; this.panel3.MouseDown += new MouseEventHandler(panel3_MouseDown); foreach (Control ctrl in this.panel3.Controls) { ctrl.MouseDown += new MouseEventHandler(panel3_MouseDown); } this.ribbonControlAdv1.ShowRibbonDisplayOptionButton = true; this.ribbonControlAdv1.TouchMode = false; this.ribbonControlAdv1.SetRibbon2013OptionValues(ControlItems.AutoHide, "自动隐藏丝带", "隐藏功能区。点击顶部的应用程序来显示它。", new Font("Segoe UI", 12), this.Font); this.ribbonControlAdv1.SetRibbon2013OptionValues(ControlItems.RibbonMinimizePanel, "显示卡", "仅显示功能区选项卡。点击标签,显示命令", new Font("Segoe UI", 12), this.Font); this.ribbonControlAdv1.SetRibbon2013OptionValues(ControlItems.RibbonPanel, "显示标签和命令", "显示功能区选项卡和注释的所有时间", new Font("Segoe UI", 12), this.Font); }
private void GridStyle() { Color verdeClaro = Color.FromArgb(0, 192, 177); Color verdeEscuro = Color.FromArgb(0, 163, 150); this.dgConsultas.TableDescriptor.TableOptions.ListBoxSelectionMode = SelectionMode.One; this.dgConsultas.TableDescriptor.TableOptions.SelectionBackColor = verdeClaro; this.dgConsultas.GridVisualStyles = GridVisualStyles.Metro; GridMetroColors theme = new GridMetroColors(); theme.HeaderBottomBorderColor.GetBrightness(); theme.HeaderBottomBorderColor = verdeClaro; theme.HeaderColor.HoverColor = verdeClaro; theme.HeaderTextColor.NormalTextColor = SystemColors.GrayText; theme.ComboboxColor.NormalBorderColor = verdeEscuro; theme.ComboboxColor.HoverBackColor = Color.White; theme.ComboboxColor.HoverBorderColor = verdeEscuro; theme.ComboboxColor.PressedBackColor = verdeEscuro; theme.ComboboxColor.PresedBorderColor = verdeEscuro; this.dgConsultas.SetMetroStyle(theme); }
public Form1() { InitializeComponent(); this.panel3.Padding = new Padding(50, 20, 50, 1); this.superAccelerator1.SetAccelerator(this.toolStripTabItem2, "R"); this.gradientPanel1.Visible = false; this.richTextBox1.Visible = false; this.gridControl1.Visible = false; this.ribbonControlAdv1.SelectedTab = toolStripTabItem6; this.ribbonControlAdv1.ShowMinimizeButton = true; this.statusStripEx1.ContextMenuStrip = null; this.toolStripPanelItem24.BackColor = Color.FromArgb(205, 230, 247); this.toolStripButton35.BackColor = Color.FromArgb(205, 230, 247); // To host any .Net control into ToolStripEx, StatusStrip, // User can make use of ToolStripControlHost class // and host the control inside it and add the host // to item collection. this.treeViewAdv1.Style = TreeStyle.Metro; ToolStripControlHost host1 = new ToolStripControlHost(this.treeViewAdv1); this.toolStripEx25.Items.Add(host1); GridMetroColors theme = new GridMetroColors(); theme.HeaderBottomBorderWeight = GridBottomBorderWeight.Thick; theme.HeaderBottomBorderColor = ColorTranslator.FromHtml("#217346"); theme.HeaderColor.HoverColor = ColorTranslator.FromHtml("#9fd5b7"); theme.HeaderTextColor.NormalTextColor = Color.Black; this.gridControl1.SetMetroStyle(theme); ToolStripControlHost host2 = new ToolStripControlHost(this.gridControl1); this.toolStripEx26.Items.Add(host2); ToolStripControlHost host3 = new ToolStripControlHost(this.panel1); this.panel1.Visible = false; this.toolStripSplitButton1.DropDown = new CustomDropdown(this.colorPickerUIAdv1); try { System.Drawing.Icon ico = new System.Drawing.Icon(GetIconFile(@"common\Images\Grid\Icon\sfgrid.ico")); this.Icon = ico; } catch { } foreach (ToolStripTabItem items in this.ribbonControlAdv1.Header.MainItems) { foreach (ToolStripEx item in items.Panel.Controls) { item.LauncherClick += new EventHandler(item_LauncherClick); } } this.ribbonControlAdv1.QuickPanelVisible = true; this.HelpButton = false; this.ribbonControlAdv1.ShowRibbonDisplayOptionButton = false; this.WindowState = FormWindowState.Maximized; string path = Application.StartupPath.ToString() + @"..\..\..\Introduction.rtf"; if (File.Exists(path)) { this.richTextBox2.LoadFile(path, RichTextBoxStreamType.RichText); } foreach (ToolStripTabItem item in this.ribbonControlAdv1.Header.MainItems) { foreach (ToolStripEx toolstripex in item.Panel.Controls) { toolstripex.AutoSize = true; if (toolstripex.Text == "Labels") { toolstripex.Padding = new Padding(10, 0, 0, 0); } } } }
/// <summary> /// Used to load the all worksheets and assign those sheets in grid models. /// </summary> /// <param name="Workbook">Exel work book that needs to be imported.</param> public void LoadWorkbook(TabBarSplitterControl formTabBarSplitterControl, IWorkbook Workbook) { tabBarSplitterControl = formTabBarSplitterControl; formTabBarSplitterControl.TabBarPages.Clear(); workbook = Workbook; GridExcelConverterControl extensions = new GridExcelConverterControl(); gridModelCollection = extensions.ExcelToVirtualGrid(Workbook); for (int i = 0; i < Workbook.Worksheets.Count; i++) { GridControl grid = new GridControl(); //Used to calculate the formula values. Workbook.Worksheets[i].EnableSheetCalculations(); #region Adding Tab pages TabBarPage tab = new TabBarPage(); tab.Text = Workbook.Worksheets[i].Name; tab.Controls.Add(grid); if (Workbook.Worksheets[i].Visibility != WorksheetVisibility.Visible) { tab.Visible = false; } #endregion #region GridModel settings grid.Model = gridModelCollection[i]; #endregion #region Grid customization grid.ThemesEnabled = true; GridMetroColors colors = new GridMetroColors(); colors.HeaderBottomBorderColor = Color.FromArgb(208, 208, 208); colors.HeaderBottomBorderWeight = GridBottomBorderWeight.Thin; grid.SetMetroStyle(colors); grid.FloatCellsMode = GridFloatCellsMode.OnDemandCalculation; grid.ExcelLikeAlignment = true; grid.Model.Options.ExcelLikeCurrentCell = true; grid.Model.Options.ExcelLikeSelectionFrame = true; grid.Model.Options.EnterKeyBehavior = GridDirectionType.Down; grid.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell; grid.Model.Options.WrapCell = false; grid.Model.CommandStack.Enabled = true; grid.Properties.ForceImmediateRepaint = true; grid.Model.ColWidths[0] = 35; grid.SmoothMouseWheelScrolling = true; RegisterCellModel.GridCellType(grid, CustomCellTypes.LinkLabelCell); #endregion formTabBarSplitterControl.TabBarPages.Add(tab); } formTabBarSplitterControl.ActivePageIndex = 0; foreach (GridModel gridModel in gridModelCollection) { gridModel.QueryCellInfo += new GridQueryCellInfoEventHandler(Model_QueryCellInfo); gridModel.SaveCellInfo += new GridSaveCellInfoEventHandler(gridModel_SaveCellInfo); } }
public Form1() { WeatherAnalysisData expense = new WeatherAnalysisData(); this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true); this.DoubleBuffered = true; InitializeComponent(); try { System.Drawing.Icon ico = new System.Drawing.Icon(GetIconFile(@"common\Images\Grid\Icon\sfgrid.ico")); this.Icon = ico; } catch { } TrackBallInfo = new TrackBall(); InitializeChart(); SetupStructSizes(); this.DoubleBuffered = true; this.Shown += Form1_Shown; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.HorizontalScroll.Visible = true; #region [events] this.Scroll += new ScrollEventHandler(Form1_Scroll); this.MouseMove += new MouseEventHandler(Form1_MouseMove); this.Load += new EventHandler(Form1_Load); this.gridGroupingControl1.TableControlQueryAllowSortColumn += new GridQueryAllowSortColumnEventHandler(gridGroupingControl1_TableControlQueryAllowSortColumn); this.MouseWheel += new MouseEventHandler(Form1_MouseWheel); #endregion #region [GridGroupingControl] this.gridGroupingControl1.DataSource = expense.Data; this.gridGroupingControl1.AllowProportionalColumnSizing = true; this.gridGroupingControl1.ShowRowHeaders = false; this.gridGroupingControl1.TableModel.EnableLegacyStyle = false; this.gridGroupingControl1.TopLevelGroupOptions.ShowCaption = false; this.gridGroupingControl1.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordAfterDetails = false; this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false; this.gridGroupingControl1.BrowseOnly = true; this.gridGroupingControl1.TableDescriptor.AllowEdit = false; this.gridGroupingControl1.TableOptions.AllowDragColumns = false; this.gridGroupingControl1.TableDescriptor.Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Center; this.gridGroupingControl1.TableDescriptor.Appearance.AnyRecordFieldCell.VerticalAlignment = GridVerticalAlignment.Middle; this.gridGroupingControl1.TableDescriptor.Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Hide; this.gridGroupingControl1.TableDescriptor.Appearance.AnyHeaderCell.Font.Size = 12; this.gridGroupingControl1.TableDescriptor.Appearance.AnyRecordFieldCell.Font.Size = 16; this.gridGroupingControl1.TableDescriptor.Columns[1].HeaderText = "Weather"; this.gridGroupingControl1.TableDescriptor.Columns[0].Appearance.AnyRecordFieldCell.Format = "hh:mm tt"; this.gridGroupingControl1.TableDescriptor.Columns[3].Appearance.AnyRecordFieldCell.Format = "0°C"; this.gridGroupingControl1.ShowCurrentCellBorderBehavior = GridShowCurrentCellBorder.HideAlways; /// Header Customization GridMetroColors headercolor = new GridMetroColors(); headercolor.HeaderBottomBorderWeight = GridBottomBorderWeight.None; headercolor.HeaderColor.HoverColor = Color.FromArgb(79, 156, 66); headercolor.HeaderColor.NormalColor = Color.FromArgb(79, 156, 66); headercolor.HeaderColor.PressedColor = Color.FromArgb(79, 156, 66); headercolor.HeaderTextColor.NormalTextColor = Color.White; this.gridGroupingControl1.SetMetroStyle(headercolor); ///ScrollBar Customization this.gridGroupingControl1.GridOfficeScrollBars = OfficeScrollBars.Metro; this.gridGroupingControl1.TableControl.MetroColorTable.ScrollerBackground = Color.FromArgb(134, 186, 53); /// Label initilization newlbl.Text = ""; newlbl.AutoSize = false; newlbl.NewText = DateTime.Now.Date.DayOfWeek.ToString(); newlbl.ForeColor = Color.White; newlbl.RotateAngle = -90; newlbl.Dock = DockStyle.Fill; newlbl.Font = new System.Drawing.Font("Segoe UI", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.panel7.Controls.Add(newlbl); // Adding Image path pb.Image = Image.FromFile(@"Images\\Umberlla_animate.gif"); pb2.Image = Image.FromFile(@"Images\\Snow_Animation.gif"); pb1.Image = Image.FromFile(@"Images\\Rain_Animate.gif"); pb3.Image = Image.FromFile(@"Images\\Sun_Animation.gif"); #region [label] string s = DateTime.Now.Date.Day + ", " + String.Format("{0:MMMM}", DateTime.Now) + " " + DateTime.Now.Date.Year + ", " + DateTime.Now.ToString("HH:mm tt") + ", " + DateTime.Now.Date.DayOfWeek; this.label5.Text = s; if (this.gridGroupingControl1.TableModel[5, 3].Text.Length > 8) { this.label8.Text = " " + this.gridGroupingControl1.TableModel[5, 3].Text; } else { this.label8.Text = " " + this.gridGroupingControl1.TableModel[5, 3].Text; } this.label7.Text = this.gridGroupingControl1.TableModel[5, 4].Text + "°C"; this.label2.Text = this.gridGroupingControl1.TableModel[5, 5].Text + " %"; this.label3.Text = this.gridGroupingControl1.TableModel[5, 6].Text + " %"; int a = Convert.ToInt32(this.gridGroupingControl1.TableModel[5, 4].Text); if (a <= 3) { this.label8.Text = "Snow"; this.pictureBox6.Image = Image.FromFile(@"Images\\Snowy.png"); } else if (a < 25) { this.label8.Text = "Rainy"; this.pictureBox6.Image = Image.FromFile(@"Images\\Rainy.png"); } else if (a < 15) { this.label8.Text = "Rainy Storm"; this.pictureBox6.Image = Image.FromFile(@"Images\\Rainy.png"); } else { this.label8.Text = "Partly Sunny"; this.pictureBox6.Image = Image.FromFile(@"Images\\Sun.png"); } #endregion #region [panel] this.panel7.BackColor = Color.FromArgb(5, 66, 121); #endregion #endregion #region [Grid Grouping events] this.gridGroupingControl1.TableModel.QueryColWidth += new GridRowColSizeEventHandler(TableModel_QueryColWidth); this.gridGroupingControl1.TableControlResizingRows += new GridTableControlResizingRowsEventHandler(gridGroupingControl1_TableControlResizingRows); this.gridGroupingControl1.TableControlResizingColumns += new GridTableControlResizingColumnsEventHandler(gridGroupingControl1_TableControlResizingColumns); this.gridGroupingControl1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo); #endregion //gif customization Timer t = new Timer() { Interval = 50 }; t.Tick += new EventHandler(t_Tick); t.Start(); this.gridGroupingControl1.TableModel.RowHeights[1] = 40; this.gridGroupingControl1.TableModel.ColWidths[4] = 100; for (int i = 2; i < this.gridGroupingControl1.TableModel.RowCount; i++) { this.gridGroupingControl1.TableModel.RowHeights[i] = 75; } this.gridGroupingControl1.ClientSize = new Size(this.gridGroupingControl1.TableModel.ColWidths.GetTotal(0, this.gridGroupingControl1.TableModel.ColCount), this.gridGroupingControl1.ClientSize.Height); }
private void GridSetting() { DG2.ThemesEnabled = false; DG2.Appearance.ColumnHeaderCell.Themed = false; DG2.Appearance.ColumnHeaderCell.Interior = new BrushInfo(GradientStyle.Vertical, Color.Red, Color.White); DG2.Appearance.ColumnHeaderCell.TextColor = Color.Black; DG2.TableDescriptor.VisibleColumns.Remove("VendorID"); DG2.TableDescriptor.Appearance.AnyCell.BackColor = Color.White; DG2.TableDescriptor.Columns["Email"].Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Left; DG2.TableDescriptor.Columns["Email"].Appearance.AnyRecordFieldCell.WrapText = true; DG2.TableDescriptor.Columns["Email"].Width = 180; DG2.TableDescriptor.Columns["Phone"].Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Left; DG2.TableDescriptor.Columns["Phone"].Appearance.AnyRecordFieldCell.WrapText = true; DG2.TableDescriptor.Columns["Phone"].Width = 95; DG2.TableDescriptor.Columns["MON"].Width = 40; DG2.TableDescriptor.Columns["TUE"].Width = 35; DG2.TableDescriptor.Columns["WED"].Width = 35; DG2.TableDescriptor.Columns["THU"].Width = 35; DG2.TableDescriptor.Columns["FRI"].Width = 35; DG2.TableDescriptor.Columns["SAT"].Width = 35; DG2.TableDescriptor.Columns["SUN"].Width = 35; DG2.TableDescriptor.Columns["Auto_Ordering"].Width = 35; DG2.TableDescriptor.Columns["Set_Dos"].Width = 60; this.DG2.TableDescriptor.Columns["Auto_Ordering"].HeaderText = "Auto"; DG2.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false; DG2.TopLevelGroupOptions.ShowCaption = false; DG2.AllowProportionalColumnSizing = false; DG2.TableDescriptor.Columns["Vendor"].Width = 220; DG2.TableDescriptor.Columns["Vendor"].Appearance.AnyRecordFieldCell.AllowEnter = false; DG2.TableDescriptor.Columns["Vendor"].Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Left; // DG.TableDescriptor.Columns["OrderTime"].Appearance.AnyRecordFieldCell.Format = "dd/MM/yyyy"; // DG.Refresh(); // DG2.TableDescriptor.Columns["OrderTime"].Appearance.AnyRecordFieldCell.ReadOnly = false; DG2.TableDescriptor.Columns["OrderTime"].Appearance.AnyRecordFieldCell.CellValueType = typeof(DateTime); DG2.TableDescriptor.Columns["OrderTime"].Appearance.AnyRecordFieldCell.Format = "HH:ss"; DG2.TableDescriptor.Columns["OrderTime"].Width = 70; DG2.TableDescriptor.Columns["DayOfMonth"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.ComboBox; DG2.TableDescriptor.Columns["DayOfMonth"].Appearance.AnyRecordFieldCell.DataSource = Get_DOM_ArrayList(); // DG2.TableDescriptor.Columns["DayOfMonth"].Appearance.AnyRecordFieldCell.ReadOnly = false; DG2.TableDescriptor.Columns["Method"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.ComboBox; DG2.TableDescriptor.Columns["Method"].Appearance.AnyRecordFieldCell.DataSource = Get_Method_ArrayList(); // DG2.TableDescriptor.Columns["Method"].Appearance.AnyRecordFieldCell.ReadOnly = false; DG2.TableDescriptor.Appearance.AnyRecordFieldCell.Font = new Syncfusion.Windows.Forms.Grid.GridFontInfo(new Font("Arial", 10f, FontStyle.Regular)); DG2.TableDescriptor.Appearance.AnyRecordFieldCell.TextColor = Color.Black; DG2.TableDescriptor.Columns["Auto_Ordering"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.CheckBox; DG2.TableDescriptor.Columns["Auto_Ordering"].Appearance.AnyCell.BackColor = Color.Yellow; DG2.TableDescriptor.Columns["Set_Dos"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.PushButton; DG2.TableDescriptor.Columns["Set_Dos"].Appearance.AnyRecordFieldCell.Description = "Set Dos"; DG2.TableDescriptor.Columns["Set_Dos"].Appearance.AnyRecordFieldCell.BackColor = Color.Yellow; // DG2.TableDescriptor.Columns["Review"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.PushButton; DG2.TableDescriptor.Columns["Remove"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.PushButton; DG2.TableDescriptor.Columns["Remove"].Appearance.AnyRecordFieldCell.Description = "Remove "; DG2.TableDescriptor.Columns["Remove"].Appearance.AnyHeaderCell.Text = "Remove Vendor"; //DG2.TableDescriptor.Columns["MON"].Appearance.AnyRecordFieldCell.ReadOnly = false; //DG2.TableDescriptor.Columns["TUE"].Appearance.AnyRecordFieldCell.ReadOnly = false; //DG2.TableDescriptor.Columns["WED"].Appearance.AnyRecordFieldCell.ReadOnly = false; //DG2.TableDescriptor.Columns["THU"].Appearance.AnyRecordFieldCell.ReadOnly = false; //DG2.TableDescriptor.Columns["FRI"].Appearance.AnyRecordFieldCell.ReadOnly = false; //DG2.TableDescriptor.Columns["SAT"].Appearance.AnyRecordFieldCell.ReadOnly = false; //DG2.TableDescriptor.Columns["SUN"].Appearance.AnyRecordFieldCell.ReadOnly = false; //DG2.TableDescriptor.Columns["Phone"].Appearance.AnyRecordFieldCell.ReadOnly = false; //DG2.TableDescriptor.Columns["Email"].Appearance.AnyRecordFieldCell.ReadOnly = false; //DG2.TableDescriptor.Columns["Auto_Ordering"].Appearance.AnyRecordFieldCell.ReadOnly = false; GridMetroColors colors = new GridMetroColors(); colors.PushButtonColor.NormalBackColor = Color.FromArgb(22, 165, 220); colors.PushButtonColor.HoverBackColor = Color.FromArgb(26, 198, 255); colors.PushButtonColor.PushedBackColor = Color.FromArgb(120, 191, 217); this.DG2.SetMetroStyle(colors); DG2.TableDescriptor.AllowNew = false; DG2.Refresh(); DG2.Invalidate(); DG2.TableControl.RefreshRange(GridRangeInfo.Table()); // DG.TableDescriptor.VisibleColumns.Remove("VendorID"); //InformationGrid.Columns["VendorID"].Visible = false; //InformationGrid.Columns["Vendor"].Width = 150; //InformationGrid.Columns["Email"].Width = 200; //InformationGrid.Columns["Mon"].Width = 35; //InformationGrid.Columns["Tue"].Width = 35; //InformationGrid.Columns["Wed"].Width = 35; //InformationGrid.Columns["Thu"].Width = 35; //InformationGrid.Columns["Fri"].Width = 35; //InformationGrid.Columns["Sat"].Width = 35; //InformationGrid.Columns["Sun"].Width = 35; //InformationGrid.Columns["setDos"].DefaultCellStyle.ForeColor = Color.Blue; //InformationGrid.Columns["Update_Record"].DefaultCellStyle.ForeColor = Color.Black; //InformationGrid.Columns["Update_Record"].DefaultCellStyle.BackColor = Color.Yellow; //InformationGrid.Columns["Update_Record"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; ; //InformationGrid.Columns["Update_Record"].ReadOnly = true; }