/// <summary> /// 系统提示信息 /// </summary> /// <param name="msg">信息内容</param> /// <returns>DialogResult</returns> public static DialogResult SystemInfo(string msg) { XtraMessageBox.AllowCustomLookAndFeel = false; DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return XtraMessageBox.Show(ul, msg, "系统信息", MessageBoxButtons.OK, MessageBoxIcon.Information); }
/// <summary> /// 设置窗体样式 /// </summary> public void SetLookAndFeel(DevExpress.LookAndFeel.UserLookAndFeel lf) { childLF.LookAndFeel.SkinName = lf.SkinName; childLF.LookAndFeel.Style = lf.Style; childLF.LookAndFeel.UseDefaultLookAndFeel = lf.UseDefaultLookAndFeel; childLF.LookAndFeel.UseWindowsXPTheme = lf.UseWindowsXPTheme; }
/// <summary> /// 系统提示信息 /// </summary> /// <param name="msg">信息内容</param> /// <returns>DialogResult</returns> public static DialogResult SystemInfo(string msg) { XtraMessageBox.AllowCustomLookAndFeel = false; DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return(XtraMessageBox.Show(ul, msg, "系统信息", MessageBoxButtons.OK, MessageBoxIcon.Information)); }
public override ViewPaintStyle PaintStyleByLookAndFeel(DevExpress.LookAndFeel.UserLookAndFeel lookAndFeel, string name) { if (ps == null) { ps = new CustomGridSkinPaintStyle(); PaintStyles.Add(ps); } return(ps); }
private static void SaveSkin() { DevExpress.LookAndFeel.UserLookAndFeel skin = DevExpress.LookAndFeel.UserLookAndFeel.Default; try { Settings.SetValue("Style", skin.Style.ToString()); Settings.SetValue("SkinName", skin.SkinName); Settings.SetValue("UseWindowsXPTheme", skin.UseWindowsXPTheme.ToString()); Settings.SetValue("UseDefaultLookAndFeel", skin.UseDefaultLookAndFeel.ToString()); } catch { } }
/// <summary> /// 系统提示信息 /// </summary> /// <param name="msg">信息内容</param> /// <param name="button">按钮模式,0-OK,1-OKCancel,2-AbortRetryIgnore,3-YesNoCancel,4-YesNo,5-RetryCancel</param> /// <returns>DialogResult</returns> public static DialogResult SystemInfo(string msg, int button) { if (button == 0) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return(XtraMessageBox.Show(ul, msg, "系统信息", MessageBoxButtons.OK, MessageBoxIcon.Information)); } else if (button == 1) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return(XtraMessageBox.Show(ul, msg, "系统信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)); } else if (button == 2) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return(XtraMessageBox.Show(ul, msg, "系统信息", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Question)); } else if (button == 3) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return(XtraMessageBox.Show(ul, msg, "系统信息", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)); } else if (button == 4) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return(XtraMessageBox.Show(ul, msg, "系统信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question)); } else if (button == 5) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return(XtraMessageBox.Show(ul, msg, "系统信息", MessageBoxButtons.RetryCancel, MessageBoxIcon.Question)); } else { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return(XtraMessageBox.Show(ul, msg, "系统信息", MessageBoxButtons.OK, MessageBoxIcon.Information)); } }
public static Color SetControlColor(this DevExpress.LookAndFeel.UserLookAndFeel LookAndFeel, string ColorName) { Color color = Color.Transparent; DevExpress.Skins.Skin activeSkin; activeSkin = DevExpress.Skins.CommonSkins.GetSkin(LookAndFeel); Object property = activeSkin.Properties[ColorName]; if (property != null && property is Color) { color = (Color)property; } return(color); }
/// <summary> /// 系统提示信息 /// </summary> /// <param name="msg">信息内容</param> /// <param name="iswrong">是否为错误类型</param> /// <returns>DialogResult</returns> public static DialogResult SystemInfo(string msg, bool iswrong) { if (iswrong) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return(XtraMessageBox.Show(ul, msg, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error)); } else { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return(XtraMessageBox.Show(ul, msg, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Information)); } }
public static Color GetControlColor(DevExpress.LookAndFeel.UserLookAndFeel provider) { return(DevExpress.LookAndFeel.LookAndFeelHelper.GetSystemColor(provider, SystemColors.Control)); }
public CustomFormPainter(XtraForm1 owner, DevExpress.LookAndFeel.UserLookAndFeel provider, HorzAlignment captionAlignment) : base(owner, provider) { CaptionAlignment = captionAlignment; }
public static void CustomDrawSubjectColumnGroupRow(RowObjectCustomDrawEventArgs e, GridView view, DevExpress.LookAndFeel.UserLookAndFeel lookAndFeel, ImageList imgList) { var info = e.Info as GridGroupRowInfo; DrawGradientBackground(e, info); DrawExpandButton(e, info, view, lookAndFeel); var textPos = DrawGroupRowCustomImage(e, info, view, imgList); DrawFormattedString(info, textPos); }
/// <summary> /// 数据表格打印预览 /// </summary> /// <param name="ListGrid">数据表格</param> /// <param name="strHead">表头显示信息</param> public static void PrintView(DevExpress.XtraGrid.GridControl ListGrid,DevExpress.XtraGrid.Views.Grid.GridView gridView, string strHead) { Cursor currentCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; //"Report file creating","Read Data, Please waiting..." DevExpress.Utils.WaitDialogForm frmWait = new DevExpress.Utils.WaitDialogForm("正在获取数据,请稍候...", "表格报表"); frmWait.Show(); //以下以前的一种用法,现在改为可加上表头信息的印方式 //if (DevExpress.XtraPrinting.PrintHelper.IsPrintingAvailable) // DevExpress.XtraPrinting.PrintHelper.ShowPreview(ListGrid); //else // //"XtraPrinting Library is not found..." // DevExpress.XtraEditors.XtraMessageBox.Show(common.GetLanguageWord("MESSAGE", "M0028"), "", MessageBoxButtons.OK, MessageBoxIcon.Information); //以下为采用新的打印方式 string middleColumn = strHead; string rightColumn = string.Format("打印时间:{0:g}", DateTime.Now); PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; phf.Header.Content.Clear(); phf.Header.Font = new Font("宋体", 12, FontStyle.Bold); phf.Header.Content.AddRange(new string[] { "打印用户:" + Common._personname, middleColumn, rightColumn }); phf.Footer.Content.AddRange(new string[] { "", "页次[页 #/#]", "" }); gridView.OptionsPrint.AutoWidth = false; //<- 2012-09-18 add link.Component = ListGrid; //link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea); DevExpress.LookAndFeel.UserLookAndFeel lookfeel = new DevExpress.LookAndFeel.UserLookAndFeel(ListGrid); lookfeel.ParentLookAndFeel = ListGrid.LookAndFeel; PrintingSystem printSystem = new PrintingSystem(); PrinterSettingsUsing pst = new PrinterSettingsUsing(); pst.UseMargins = true; pst.UsePaperKind = true; printSystem.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A4; printSystem.PageSettings.PaperName = "A4"; printSystem.PageSettings.LeftMargin = 1; printSystem.PageSettings.RightMargin = 1; printSystem.PageSettings.Landscape = true; printSystem.PageSettings.AssignDefaultPrinterSettings(pst); link.PaperKind = printSystem.PageSettings.PaperKind; link.Margins = printSystem.PageSettings.Margins; link.Landscape = printSystem.PageSettings.Landscape; link.CreateDocument(); link.ShowPreview(lookfeel); Cursor.Current = currentCursor; frmWait.Dispose(); frmWait = null; }
public bool ExportToExcel(DevExpress.XtraGrid.GridControl gridControl, string userId) { DevExpress.LookAndFeel.UserLookAndFeel lookAndFeel = new DevExpress.LookAndFeel.UserLookAndFeel(gridControl); if (XtraMessageBox.Show(lookAndFeel, "엑셀파일로 저장하시겠습니까?", "파일저장", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Cancel) { return(false); } try { SaveFileDialog oSaveFileDialog = new SaveFileDialog(); oSaveFileDialog.Title = "자신의 엑셀 버전에 맞는 버전을 선택해 주세요."; oSaveFileDialog.Filter = "엑셀 파일(6만건이상) [2007~2013](*.xlsx)|*.xlsx|엑셀 파일(6만건한계) [~2003](*.xls)|*.xls"; oSaveFileDialog.FilterIndex = 1; oSaveFileDialog.RestoreDirectory = true; if (oSaveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (oSaveFileDialog.FileName != null) { bool isCellMerge = false; GridView view = (GridView)gridControl.MainView; isCellMerge = view.OptionsView.AllowCellMerge; view.OptionsView.AllowCellMerge = false; System.IO.FileStream fs = new System.IO.FileStream(oSaveFileDialog.FileName, System.IO.FileMode.Create); if (oSaveFileDialog.FileName.EndsWith(".xls")) { gridControl.ExportToXls(fs); } else { gridControl.ExportToXlsx(fs); } view.OptionsView.AllowCellMerge = isCellMerge; fs.Close(); if (userId == string.Empty) { XtraMessageBox.Show(lookAndFeel, "저장되었습니다.", "저장완료", MessageBoxButtons.OK, MessageBoxIcon.Information); return(true); } CESFasoo fasoo = new CESFasoo(); if (fasoo.FSDEncryption(oSaveFileDialog.FileName, oSaveFileDialog.FileName, "DevExpress 엑셀변환 자료", userId)) { XtraMessageBox.Show(lookAndFeel, "저장되었습니다.", "저장완료", MessageBoxButtons.OK, MessageBoxIcon.Information); Process.Start(oSaveFileDialog.FileName); return(true); } else { throw new CESException("엑셀파일 변환중 암호화에 실패하였습니다."); } } } } catch (Exception ex) { throw new CESException(this, "ConvertExcel", new object[] { }, ex.Message, ex); } return(false); }
/// <summary> /// 系统提示信息 /// </summary> /// <param name="msg">信息内容</param> /// <param name="caption">提示标题</param> /// <param name="button">按钮模式</param> /// <returns>DialogResult</returns> public static DialogResult SystemInfo(string msg, string caption, MessageBoxButtons button) { if (button == 0) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return XtraMessageBox.Show(ul,msg, caption, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (button == MessageBoxButtons.OKCancel) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return XtraMessageBox.Show(ul,msg, caption, MessageBoxButtons.OKCancel, MessageBoxIcon.Question); } else if (button == MessageBoxButtons.AbortRetryIgnore) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return XtraMessageBox.Show(ul,msg, caption, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Question); } else if (button == MessageBoxButtons.YesNoCancel) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return XtraMessageBox.Show(ul,msg, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); } else if (button == MessageBoxButtons.YesNo) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return XtraMessageBox.Show(ul,msg, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); } else if (button == MessageBoxButtons.RetryCancel) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return XtraMessageBox.Show(ul,msg, caption, MessageBoxButtons.RetryCancel, MessageBoxIcon.Question); } else { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return XtraMessageBox.Show(ul,msg, caption, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 系统提示信息 /// </summary> /// <param name="msg">信息内容</param> /// <param name="iswrong">是否为错误类型</param> /// <returns>DialogResult</returns> public static DialogResult SystemInfo(string msg, bool iswrong) { if (iswrong) { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return XtraMessageBox.Show(ul, msg, LangCenter.Instance.GetSystemMessage("SystemInfo"), MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DevExpress.LookAndFeel.UserLookAndFeel ul = new DevExpress.LookAndFeel.UserLookAndFeel(null); ul.SkinName = "Blue"; ul.UseDefaultLookAndFeel = false; return XtraMessageBox.Show(ul, msg, LangCenter.Instance.GetSystemMessage("SystemInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void ShowReportPreview(DevExpress.LookAndFeel.UserLookAndFeel lookAndFeel) { ShowPreview(lookAndFeel); }
private static void LoadSkin() { DevExpress.LookAndFeel.UserLookAndFeel skin = DevExpress.LookAndFeel.UserLookAndFeel.Default; DevExpress.LookAndFeel.LookAndFeelStyle Style; skin.SetSkinStyle(""); string styleName, skinName, xpTheme, useDefault; Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); DevExpress.UserSkins.OfficeSkins.Register(); DevExpress.UserSkins.BonusSkins.Register(); DevExpress.Skins.SkinManager.EnableFormSkins(); //DevExpress.Utils.Localization.AccLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressUtilsLocalizationCHS(); DevExpress.XtraBars.Localization.BarLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraBarsLocalizationCHS(); //DevExpress.XtraCharts.Localization.ChartLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraChartsLocalizationCHS(); DevExpress.XtraEditors.Controls.Localizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraEditorsLocalizationCHS(); DevExpress.XtraGrid.Localization.GridLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraGridLocalizationCHS(); DevExpress.XtraLayout.Localization.LayoutLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraLayoutLocalizationCHS(); DevExpress.XtraNavBar.NavBarLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraNavBarLocalizationCHS(); //DevExpress.XtraPivotGrid.Localization.PivotGridLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraPivotGridLocalizationCHS(); DevExpress.XtraPrinting.Localization.PreviewLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraPrintingLocalizationCHS(); DevExpress.XtraReports.Localization.ReportLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraReportsLocalizationCHS(); //DevExpress.XtraRichTextEdit.Localization.XtraRichTextEditLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraRichTextEditLocalizationCHS(); //DevExpress.XtraRichEdit.Localization.XtraRichEditLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraRichEditLocalizationCHS(); DevExpress.XtraScheduler.Localization.SchedulerLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraSchedulerLocalizationCHS(); DevExpress.XtraScheduler.Localization.SchedulerExtensionsLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraSchedulerExtensionsLocalizationCHS(); DevExpress.XtraSpellChecker.Localization.SpellCheckerLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraSpellCheckerLocalizationCHS(); DevExpress.XtraTreeList.Localization.TreeListLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraTreeListLocalizationCHS(); //DevExpress.XtraVerticalGrid.Localization.VGridLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraVerticalGridLocalizationCHS(); //DevExpress.XtraWizard.Localization.WizardLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraWizardLocalizationCHS(); //frmLogin dlg = new frmLogin(); try { styleName = Settings.GetValue("Style"); skinName = Settings.GetValue("SkinName"); xpTheme = Settings.GetValue("UseWindowsXPTheme"); useDefault = Settings.GetValue("UseDefaultLookAndFeel"); //styleName = "Skin"; //skinName = "black"; //xpTheme = "false"; //useDefault = "true"; if (styleName == string.Empty) { styleName = skin.Style.ToString(); } if (skinName == string.Empty) { skinName = skin.SkinName; } if (xpTheme == string.Empty) { xpTheme = skin.UseWindowsXPTheme.ToString(); } if (useDefault == string.Empty) { useDefault = skin.UseDefaultLookAndFeel.ToString(); } Style = (DevExpress.LookAndFeel.LookAndFeelStyle)Enum.Parse(typeof(DevExpress.LookAndFeel.LookAndFeelStyle), styleName, false); //DevExpress.LookAndFeel.UserLookAndFeel.Default.SetStyle(Style, bool.Parse(xpTheme), bool.Parse(useDefault), skinName); DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(skinName); } catch { } }
private static void DrawExpandButton(RowObjectCustomDrawEventArgs e, GridGroupRowInfo info, GridView view, DevExpress.LookAndFeel.UserLookAndFeel lookAndFeel) { Image img = GetExpandButtonImage(e, view, lookAndFeel); if (img == null) { return; } var imgLocation = new Point(info.ButtonBounds.Location.X + (info.ButtonBounds.Width - img.Width) / 2, info.ButtonBounds.Location.Y + (info.ButtonBounds.Height - img.Height) / 2); info.Cache.Paint.DrawImage(e.Cache.Graphics, img, new Rectangle(imgLocation, img.Size)); }
public static void SetControlColor(this Control ctl, DevExpress.LookAndFeel.UserLookAndFeel LookAndFeel) { switch (ctl.GetType().Name) { case "GroupControl": (ctl as GroupControl).LookAndFeel.UseDefaultLookAndFeel = false; if ((ctl as GroupControl).LookAndFeel.SkinName != "QA_Caramel_Smart") { //DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("QA_Caramel"); (ctl as GroupControl).LookAndFeel.SkinName = "QA_Caramel_Smart"; //(ctl as GroupControl).LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Office2003 ; //(ctl as GroupControl).AppearanceCaption.BackColor = System.Drawing.Color.DeepSkyBlue; //(ctl as GroupControl).AppearanceCaption.BackColor2 = System.Drawing.Color.RoyalBlue; // (ctl as GroupControl).AppearanceCaption.ForeColor = System.Drawing.Color.White; //(ctl as GroupControl).AppearanceCaption.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal; //(ctl as GroupControl).AppearanceCaption.ForeColor = System.Drawing.Color.Brown; //đổi caption panel của group control System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml("#F0EEEE"); //(ctl as GroupControl).AppearanceCaption.BackColor = col; //(ctl as GroupControl).AppearanceCaption.BackColor2 = col; //Font //(ctl as GroupControl).AppearanceCaption.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold); // đổi màu nền của group control (ctl as GroupControl).Appearance.BackColor = col; // System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(236)))), ((int)(((byte)(239))))); (ctl as GroupControl).Appearance.BackColor2 = col; //System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(236)))), ((int)(((byte)(239))))); (ctl as GroupControl).AppearanceCaption.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); (ctl as GroupControl).AppearanceCaption.Options.UseFont = true; //(ctl as GroupControl).BackColor = col; //(ctl as GroupControl).Appearance.Options.UseBorderColor = true; //(ctl as GroupControl).Appearance.BorderColor = System.Drawing.Color.Transparent; //thay đổi font chữ của groupcontrol Caption //(ctl as GroupControl).AppearanceCaption.Font=new Font("Times New Roman", 12.0f); } break; case "GridControl": GridView view = (GridView)(ctl as GridControl).MainView; // Cells if ((ctl as GridControl).LookAndFeel.SkinName != "QA_Caramel_Smart") { (ctl as GridControl).LookAndFeel.SkinName = "QA_Caramel_Smart"; //(ctl as GridControl).LookAndFeel.SkinName = ""; //(ctl as GridControl).LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.UltraFlat; (ctl as GridControl).LookAndFeel.UseDefaultLookAndFeel = false; //view.OptionsBehavior.Editable = false; //view.OptionsBehavior.ReadOnly = true; //Set color for Grid HeaderPanel view.Appearance.HeaderPanel.Options.UseBackColor = true; //view.Appearance.HeaderPanel.BackColor = System.Drawing.Color.DeepSkyBlue;//DeepSkyBlue //view.Appearance.HeaderPanel.BackColor2 = System.Drawing.Color.RoyalBlue;//RoyalBlue; //view.Appearance.HeaderPanel.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; view.OptionsView.ShowIndicator = false; view.RowHeight = 26; view.Appearance.GroupFooter.Font = new System.Drawing.Font("Tahoma", 8.5F, System.Drawing.FontStyle.Bold); view.Appearance.FooterPanel.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold); //// Font header //view.Appearance.HeaderPanel.ForeColor = System.Drawing.Color.White; view.Appearance.HeaderPanel.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold); // Font row view.Appearance.Row.Font = new System.Drawing.Font("Arial", 9F); //Set color for Grid selected #C3D3F1 System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml("#A3D867"); Color backcolor = col; Color backcolor2 = col; Color forecolor = Color.Black; Color bordercolor = Color.Transparent; view.Appearance.SelectedRow.BackColor = backcolor; view.Appearance.SelectedRow.BackColor2 = backcolor2; view.Appearance.SelectedRow.ForeColor = forecolor; //view.Appearance.SelectedRow.BorderColor = bordercolor; view.Appearance.FocusedRow.BackColor = backcolor; view.Appearance.FocusedRow.BackColor2 = backcolor2; view.Appearance.FocusedRow.ForeColor = forecolor; //view.Appearance.FocusedRow.BorderColor = bordercolor; view.Appearance.HideSelectionRow.BackColor = backcolor; view.Appearance.HideSelectionRow.BackColor2 = backcolor2; view.Appearance.HideSelectionRow.ForeColor = forecolor; view.Appearance.FocusedCell.BackColor = backcolor; view.Appearance.FocusedCell.BackColor2 = backcolor2; view.Appearance.FocusedCell.ForeColor = forecolor; // view.Appearance.HideSelectionRow.BorderColor = bordercolor; } break; case "PanelControl": (ctl as PanelControl).LookAndFeel.UseDefaultLookAndFeel = false; if ((ctl as PanelControl).LookAndFeel.SkinName != "QA_Caramel_Smart") { (ctl as PanelControl).LookAndFeel.SkinName = "QA_Caramel_Smart"; //(ctl as PanelControl).LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Office2003; //đổi caption panel của group control System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml("#F0EEEE"); //(ctl as GroupControl).AppearanceCaption.BackColor = System.Drawing.Color.Silver; //(ctl as GroupControl).AppearanceCaption.BackColor2 = System.Drawing.Color.Silver; // đổi màu nền của group control (ctl as PanelControl).Appearance.BackColor = col; // System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); (ctl as PanelControl).Appearance.BackColor2 = col; // System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); (ctl as PanelControl).Appearance.Options.UseBorderColor = true; (ctl as PanelControl).Appearance.BorderColor = System.Drawing.Color.Black; //thay đổi font chữ của groupcontrol Caption //(ctl as GroupControl).AppearanceCaption.Font=new Font("Times New Roman", 12.0f); } break; case "XtraTabControl": (ctl as DevExpress.XtraTab.XtraTabControl).LookAndFeel.UseDefaultLookAndFeel = false; if ((ctl as DevExpress.XtraTab.XtraTabControl).LookAndFeel.SkinName != "QA_Caramel_Smart") { (ctl as DevExpress.XtraTab.XtraTabControl).LookAndFeel.SkinName = "QA_Caramel_Smart"; (ctl as DevExpress.XtraTab.XtraTabControl).AppearancePage.Header.Font = new System.Drawing.Font("Tahoma", 9.5F); //(ctl as DevExpress.XtraTab.XtraTabControl).AppearancePage.Header.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; //(ctl as DevExpress.XtraTab.XtraTabControl).SelectedTabPage.Appearance.Header.Font = new System.Drawing.Font("Tahoma", 10F); //(ctl as DevExpress.XtraTab.XtraTabControl).SelectedTabPage.Appearance.HeaderDisabled.Font = new System.Drawing.Font("Tahoma", 10F); //(ctl as DevExpress.XtraTab.XtraTabControl).SelectedTabPage.Appearance.HeaderActive.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; //(ctl as DevExpress.XtraTab.XtraTabControl).SelectedTabPage.Appearance.HeaderActive.Font = new System.Drawing.Font("Tahoma", 8.5F); } break; case "SimpleButton": (ctl as SimpleButton).LookAndFeel.UseDefaultLookAndFeel = false; if ((ctl as SimpleButton).LookAndFeel.SkinName != "QA_Caramel_Smart") { (ctl as SimpleButton).LookAndFeel.SkinName = "QA_Caramel_Smart"; (ctl as SimpleButton).Appearance.Font = new System.Drawing.Font("", 8F, System.Drawing.FontStyle.Bold); (ctl as SimpleButton).Appearance.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal; //(ctl as SimpleButton).Appearance.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal; (ctl as SimpleButton).ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; (ctl as SimpleButton).Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); (ctl as SimpleButton).Appearance.ForeColor = System.Drawing.Color.White; #region none (ctl as SimpleButton).LookAndFeel.SkinName = "Office 2013"; (ctl as SimpleButton).LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Office2003; (ctl as SimpleButton).Appearance.BackColor = System.Drawing.Color.DeepSkyBlue; (ctl as SimpleButton).Appearance.BackColor2 = System.Drawing.Color.RoyalBlue; #endregion none } break; case "LookUpEdit": (ctl as LookUpEdit).LookAndFeel.UseDefaultLookAndFeel = false; if ((ctl as LookUpEdit).LookAndFeel.SkinName != "QA_Caramel_Smart") { (ctl as LookUpEdit).LookAndFeel.SkinName = "QA_Caramel_Smart"; System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml("#A3D867"); Color backcolor = col; Color backcolor2 = col; //(ctl as LookUpEdit).Properties.Appearance.BackColor = backcolor; //(ctl as LookUpEdit).Properties.Appearance.ForeColor = System.Drawing.Color.Black; //(ctl as LookUpEdit).Properties.AppearanceFocused.BackColor = backcolor; //(ctl as LookUpEdit).Properties.AppearanceFocused.ForeColor = System.Drawing.Color.Black; //(ctl as LookUpEdit).LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Office2003; //(ctl as LookUpEdit).Properties.Appearance.BackColor = System.Drawing.Color.LightBlue; //(ctl as LookUpEdit).Properties.Appearance.ForeColor = System.Drawing.Color.Black; //(ctl as LookUpEdit).Properties.AppearanceFocused.BackColor = System.Drawing.Color.SpringGreen; //(ctl as LookUpEdit).Properties.AppearanceFocused.ForeColor = System.Drawing.Color.Black; //(ctl as LookUpEdit).Appearance.BackColor = System.Drawing.Color.DeepSkyBlue; //(ctl as LookUpEdit).Appearance.BackColor2 = System.Drawing.Color.RoyalBlue; //(ctl as LookUpEdit).Appearance.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal; //(ctl as LookUpEdit).Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); //(ctl as LookUpEdit).Appearance.ForeColor = System.Drawing.Color.White; } break; case "MyLookUpEdit": (ctl as LookUpEdit).LookAndFeel.UseDefaultLookAndFeel = false; if ((ctl as LookUpEdit).LookAndFeel.SkinName != "QA_Caramel_Smart") { (ctl as LookUpEdit).LookAndFeel.SkinName = "QA_Caramel_Smart"; System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml("#A3D867"); Color backcolor = col; Color backcolor2 = col; //(ctl as LookUpEdit).Properties.Appearance.BackColor = backcolor; //(ctl as LookUpEdit).Properties.Appearance.ForeColor = System.Drawing.Color.Black; //(ctl as LookUpEdit).Properties.AppearanceFocused.BackColor = backcolor; //(ctl as LookUpEdit).Properties.AppearanceFocused.ForeColor = System.Drawing.Color.Black; //(ctl as LookUpEdit).LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Office2003; //(ctl as LookUpEdit).Properties.Appearance.BackColor = System.Drawing.Color.LightBlue; //(ctl as LookUpEdit).Properties.Appearance.ForeColor = System.Drawing.Color.Black; //(ctl as LookUpEdit).Properties.AppearanceFocused.BackColor = System.Drawing.Color.SpringGreen; //(ctl as LookUpEdit).Properties.AppearanceFocused.ForeColor = System.Drawing.Color.Black; //(ctl as LookUpEdit).Appearance.BackColor = System.Drawing.Color.DeepSkyBlue; //(ctl as LookUpEdit).Appearance.BackColor2 = System.Drawing.Color.RoyalBlue; //(ctl as LookUpEdit).Appearance.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal; //(ctl as LookUpEdit).Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); //(ctl as LookUpEdit).Appearance.ForeColor = System.Drawing.Color.White; } break; case "SearchLookUpEdit": (ctl as SearchLookUpEdit).LookAndFeel.UseDefaultLookAndFeel = false; GridView viewSearch = (GridView)(ctl as SearchLookUpEdit).Properties.View; if ((ctl as SearchLookUpEdit).LookAndFeel.SkinName != "QA_Caramel_Smart") { (ctl as SearchLookUpEdit).LookAndFeel.SkinName = "QA_Caramel_Smart"; System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml("#A3D867"); Color backcolor = col; Color backcolor2 = col; Color forecolor = Color.Black; Color bordercolor = Color.Transparent; // searchLookUpEdit1.Properties.PopupFindMode = //(ctl as SearchLookUpEdit).Properties.PopupFindMode = DevExpress.XtraEditors.FindMode.Always; //(ctl as SearchLookUpEdit).Properties.PopupFilterMode = DevExpress.XtraEditors.PopupFilterMode.Contains; viewSearch.Appearance.SelectedRow.BackColor = backcolor; viewSearch.Appearance.SelectedRow.BackColor2 = backcolor2; viewSearch.Appearance.SelectedRow.ForeColor = forecolor; //view.Appearance.SelectedRow.BorderColor = bordercolor; viewSearch.Appearance.FocusedRow.BackColor = backcolor; viewSearch.Appearance.FocusedRow.BackColor2 = backcolor2; viewSearch.Appearance.FocusedRow.ForeColor = forecolor; //view.Appearance.FocusedRow.BorderColor = bordercolor; viewSearch.Appearance.HideSelectionRow.BackColor = backcolor; viewSearch.Appearance.HideSelectionRow.BackColor2 = backcolor2; viewSearch.Appearance.HideSelectionRow.ForeColor = forecolor; viewSearch.Appearance.FocusedCell.BackColor = backcolor; viewSearch.Appearance.FocusedCell.BackColor2 = backcolor2; viewSearch.Appearance.FocusedCell.ForeColor = forecolor; viewSearch.Appearance.HideSelectionRow.BorderColor = bordercolor; } break; case "ComboBoxEdit": (ctl as ComboBoxEdit).LookAndFeel.UseDefaultLookAndFeel = false; if ((ctl as ComboBoxEdit).LookAndFeel.SkinName != "QA_Caramel_Smart") { (ctl as ComboBoxEdit).LookAndFeel.SkinName = "QA_Caramel_Smart"; //System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml("#A3D867"); //Color backcolor = col; //Color backcolor2 = col; //Color forecolor = Color.Black; //Color bordercolor = Color.Transparent; //(ctl as ComboBoxEdit).Properties.AppearanceFocused.BackColor = col; //(ctl as ComboBoxEdit).Properties.AppearanceFocused.BackColor2 = col; //System.Drawing.Color col = Color.Transparent; //System.Drawing.ColorTranslator.FromHtml("#DADADA"); //(ctl as ComboBoxEdit).BackColor = col; } break; case "LabelControl": (ctl as LabelControl).LookAndFeel.UseDefaultLookAndFeel = false; if ((ctl as LabelControl).LookAndFeel.SkinName != "QA_Caramel_Smart") { (ctl as LabelControl).LookAndFeel.SkinName = "QA_Caramel_Smart"; System.Drawing.Color col = Color.Transparent; //System.Drawing.ColorTranslator.FromHtml("#DADADA"); (ctl as LabelControl).BackColor = col; } break; case "CheckEdit": (ctl as CheckEdit).LookAndFeel.UseDefaultLookAndFeel = false; if ((ctl as CheckEdit).LookAndFeel.SkinName != "QA_Caramel_Smart") { (ctl as CheckEdit).LookAndFeel.SkinName = "QA_Caramel_Smart"; } break; case "RadioGroup": (ctl as RadioGroup).LookAndFeel.UseDefaultLookAndFeel = false; if ((ctl as RadioGroup).LookAndFeel.SkinName != "QA_Caramel_Smart") { (ctl as RadioGroup).LookAndFeel.SkinName = "QA_Caramel_Smart"; } break; //case "MRUEdit": // (ctl as MRUEdit).LookAndFeel.UseDefaultLookAndFeel = false; // if ((ctl as MRUEdit).LookAndFeel.SkinName != "QA_Caramel_Smart") // { // (ctl as MRUEdit).LookAndFeel.SkinName = "Office 2013"; // System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml("#A3D867"); // Color backcolor = col; // Color backcolor2 = col; // Color forecolor = Color.Black; // Color bordercolor = Color.Transparent; // (ctl as MRUEdit).Properties.AppearanceDropDown.BackColor = col; // (ctl as MRUEdit).Properties.AppearanceDropDown.BackColor2 = col; // // (ctl as MRUEdit).Properties.AppearanceDropDown.ForeColor = col; // } // break; // break; } }
public static void SetControlColor(this System.Windows.Forms.Control.ControlCollection controls, DevExpress.LookAndFeel.UserLookAndFeel LookAndFeel) { foreach (Control ctl in controls) { ctl.SetControlColor(LookAndFeel); if (ctl.HasChildren == true) { ctl.Controls.SetControlColor(LookAndFeel); } } }
private static Image GetExpandButtonImage(RowObjectCustomDrawEventArgs e, GridView view, DevExpress.LookAndFeel.UserLookAndFeel lookAndFeel) { var currentSkin = GridSkins.GetSkin(lookAndFeel); var plusMinusButton = currentSkin[GridSkins.SkinPlusMinus]; ImageCollection images = plusMinusButton.Image?.GetImages() ?? plusMinusButton.Glyph?.GetImages(); if (images == null) { return(null); } var rowExpanded = view.GetRowExpanded(e.RowHandle); var imgIndex = rowExpanded ? 1 : 0; var img = images.Images[imgIndex]; return(img); }