From 5d8b95b69c1bf800f2a2ebee62c6f7181c0bd7c8 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期三, 27 十一月 2024 16:35:46 +0800 Subject: [PATCH] 冲突 --- Desktop/HStation.Desktop.PBS.Core/MainForm.cs | 142 +++++++++++++++++++---------------------------- 1 files changed, 57 insertions(+), 85 deletions(-) diff --git a/Desktop/HStation.Desktop.PBS.Core/MainForm.cs b/Desktop/HStation.Desktop.PBS.Core/MainForm.cs index 3cead9d..e379baa 100644 --- a/Desktop/HStation.Desktop.PBS.Core/MainForm.cs +++ b/Desktop/HStation.Desktop.PBS.Core/MainForm.cs @@ -4,12 +4,10 @@ using DevExpress.XtraBars.Navigation; using DevExpress.XtraBars.Ribbon; using DevExpress.XtraEditors; -using HStation.WinFrmUI; -using HStation.WinFrmUI.Assets; -using HStation.WinFrmUI.Basic; -using HStation.WinFrmUI.PBS; -using HStation.WinFrmUI.WE; +using DevExpress.XtraTab; +using DevExpress.XtraTab.ViewInfo; using HStation.WinFrmUI.Xhs.PumpProduct; +using System.Drawing.Drawing2D; using System.IO; using Yw.WinFrmUI; using Yw.WinFrmUI.Page; @@ -30,29 +28,21 @@ this.accordionControlFunction.Appearance.AccordionControl.BackColor = Color.White; this.accordionControlFunction.Appearance.AccordionControl.BorderColor = Color.White; - //this.accordionControlFunction.ResizeMode = AccordionControlResizeMode.None; this.accordionControlFunction.AllowHtmlText = true; this.accordionControlFunction.HtmlTemplates.HamburgerHeaderPanel.Template = @"<div class='hamburger-header-background'></div>"; this.accordionControlFunction.HtmlTemplates.HamburgerHeaderPanel.Styles = @".hamburger-header-background {background-color: #ffffff; height: 100%;width: 100%;}"; - this.tabbedView1.Style = DockingViewStyle.Classic; - this.tabbedView1.Appearance.BackColor = Color.White; - this.tabbedView1.AppearancePage.Header.BackColor = Color.White; - this.tabbedView1.AppearancePage.HeaderSelected.Font = new Font("微软雅黑", 10f, FontStyle.Bold); + this.xtraTabContrl.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; } + HatchBrush myHatchBrush1 = new HatchBrush(HatchStyle.BackwardDiagonal, Color.LightGray, Color.AliceBlue); private void TabbedView1_CustomDrawTabHeader(object sender, DevExpress.XtraTab.TabHeaderCustomDrawEventArgs e) { - // 阻止默认绘制 - e.Handled = true; - - // 设置圆角为0,去除圆角效果 - //e.Cache.RoundRect = false; - - // 使用默认绘制方法绘制其他元素,如背景、文本和按钮 - e.DefaultDrawBackground(); + e.Cache.FillRectangle(myHatchBrush1, e.Bounds); e.DefaultDrawText(); + e.DefaultDrawImage(); e.DefaultDrawButtons(); + e.Handled = true; } #region TileNavPane 相关处理 @@ -122,9 +112,9 @@ if (btn.Tag is not string tag) return; PageGuid pguid = null; - if (this.tabbedView1.ActiveDocument != null) + if (this.xtraTabContrl.SelectedTabPage != null) { - pguid = this.tabbedView1.ActiveDocument.Tag as PageGuid; + pguid = this.xtraTabContrl.SelectedTabPage.Tag as PageGuid; } SelectModular(tag, pguid); } @@ -188,40 +178,26 @@ #region TabbedView 相关事件处理程序 //选中 - private void tabbedView1_DocumentSelected(object sender, DocumentEventArgs e) + private void xtraTabContrl_SelectedPageChanged(object sender, TabPageChangedEventArgs e) { - if (e.Document == null) + if (e.Page == null) return; - var pguid = e.Document.Tag as PageGuid; + var pguid = e.Page.Tag as PageGuid; if (pguid == null) return; SelectModular(pguid.Modular, pguid); } - //添加 - private void tabbedView1_DocumentAdded(object sender, DocumentEventArgs e) + //关闭 + private void xtraTabContrl_CloseButtonClick(object sender, EventArgs e) { - if (this.tabbedView1.Documents.Count > 1) + var arg = e as ClosePageButtonEventArgs; + var last_index = this.xtraTabContrl.SelectedTabPageIndex - 1; + this.xtraTabContrl.TabPages.Remove(arg.Page as XtraTabPage); + if (last_index > 0) { - if (!this.tabbedView1.DocumentGroupProperties.ShowTabHeader) - { - } + this.xtraTabContrl.SelectedTabPageIndex = last_index; } - } - - //激活 - private void tabbedView1_DocumentActivated(object sender, DocumentEventArgs e) - { - var page = e.Document.Control as DocumentPage; - if (page == null) - { - return; - } - } - - //关闭 此时控件已经为空 - private void tabbedView1_DocumentClosed(object sender, DocumentEventArgs e) - { } #endregion TabbedView 相关事件处理程序 @@ -256,9 +232,9 @@ } } - if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0) + if (this.xtraTabContrl.TabPages != null && this.xtraTabContrl.TabPages.Count > 0) { - foreach (BaseDocument doc in this.tabbedView1.Documents) + foreach (XtraTabPage doc in this.xtraTabContrl.TabPages) { if (doc.Tag != null) { @@ -268,7 +244,7 @@ { if (isActivePage) { - this.tabbedView1.Controller.Activate(doc); + this.xtraTabContrl.SelectedTabPage = doc; } return true; } @@ -304,12 +280,12 @@ } } - if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0) + if (this.xtraTabContrl.TabPages != null && this.xtraTabContrl.TabPages.Count > 0) { - var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == pguid.ToString()); + var doc = this.xtraTabContrl.TabPages.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == pguid.ToString()); if (doc != null) { - var page = doc.Control as DocumentPage; + var page = doc.Controls[0] as DocumentPage; if (page != null) { page.RefreshData(); @@ -346,16 +322,16 @@ } } - if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0) + if (this.xtraTabContrl.TabPages != null && this.xtraTabContrl.TabPages.Count > 0) { - var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == pguid.ToString()); + var doc = this.xtraTabContrl.TabPages.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == pguid.ToString()); if (doc != null) { - doc.Caption = title.Caption; + doc.Text = title.Caption; doc.ImageOptions.Image = title.HeaderImage; doc.ImageOptions.SvgImage = title.HeaderSvgImage; doc.ImageOptions.SvgImageSize = title.SvgImageSize; - var page = doc.Control as DocumentPage; + var page = doc.Controls[0] as DocumentPage; if (page != null) { page.PageTitle = title; @@ -413,20 +389,20 @@ case eMoudingType.Tab: { - this.tabbedView1.BeginUpdate(); - var doc = this.tabbedView1.AddDocument(page); - doc.Footer = Directory.GetCurrentDirectory(); + var sel_page = new XtraTabPage(); + page.Dock = DockStyle.Fill; + sel_page.Controls.Add(page); + this.xtraTabContrl.TabPages.Add(sel_page); if (page.PageTitle != null) { - doc.Caption = page.PageTitle.Caption; - doc.ImageOptions.Image = page.PageTitle.HeaderImage; - doc.ImageOptions.SvgImage = page.PageTitle.HeaderSvgImage; - doc.ImageOptions.SvgImageSize = page.PageTitle.SvgImageSize; - doc.Properties.AllowClose = page.PageTitle.AllowClose ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False; + sel_page.Text = page.PageTitle.Caption; + sel_page.ImageOptions.Image = page.PageTitle.HeaderImage; + sel_page.ImageOptions.SvgImage = page.PageTitle.HeaderSvgImage; + sel_page.ImageOptions.SvgImageSize = page.PageTitle.SvgImageSize; + //doc.Properties.AllowClose = page.PageTitle.AllowClose ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False; } - doc.Tag = pguid; - this.tabbedView1.EndUpdate(); - this.tabbedView1.Controller.Activate(doc); + sel_page.Tag = pguid; + this.xtraTabContrl.SelectedTabPage = sel_page; } break; @@ -458,12 +434,12 @@ case eMoudingType.Tab: { - if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0) + if (this.xtraTabContrl.TabPages != null && this.xtraTabContrl.TabPages.Count > 0) { - var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == pguid.ToString()); + var doc = this.xtraTabContrl.TabPages.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == pguid.ToString()); if (doc != null) { - this.tabbedView1.Controller.Close(doc);//会触发正在关闭和关闭事件 + this.xtraTabContrl.TabPages.Remove(doc); } } } @@ -492,7 +468,7 @@ { if (tag == modular) { - btn.Appearance.BackColor = Color.FromArgb(1, 96, 188); + btn.Appearance.BackColor = Color.FromArgb(50, 121, 197); btn.Appearance.ForeColor = Color.White; } else @@ -586,6 +562,7 @@ return false; } + //获取 private List<AccordionElement> GetAccordionElementList(string modular) { @@ -672,8 +649,6 @@ { if (!IsExistPage(guid, true)) { - var page = new WaterUtensilMainPage(); - CreatePage(page, guid); } }), Get("用水当量",new PageGuid() @@ -707,8 +682,12 @@ { if (!IsExistPage(guid, true)) { - var page = new AssetsManufacturerMainPage(); - CreatePage(page, guid); + var page = new DocumentPage(); + page.PageGuid = guid; + page.PageTitle.Caption = caption; + page.PageTitle.HeaderSvgImage = svg; + page.PageTitle.SvgImageSize = size; + CreatePage(page, guid); } }), Get("水泵管理",new PageGuid() @@ -737,9 +716,7 @@ { if (!IsExistPage(guid, true)) { - var page = new PackageManageMainPage(); - CreatePage(page, guid); - } + } }) } }; @@ -761,9 +738,7 @@ { if (!IsExistPage(guid, true)) { - var page=new SysTypeManageMainPanel(); - CreatePage(page,guid); - } + } }), Get("分类管理",new PageGuid() { @@ -774,8 +749,6 @@ { if (!IsExistPage(guid, true)) { - var page=new SysCatalogManageMainPanel(); - CreatePage(page,guid); } }), Get("属性管理",new PageGuid() @@ -787,8 +760,6 @@ { if (!IsExistPage(guid, true)) { - var page=new SysPropManageMainPanel(); - CreatePage(page,guid); } }), Get("字典类型",new PageGuid() @@ -800,8 +771,6 @@ { if (!IsExistPage(guid, true)) { - var page=new HStation.WinFrmUI.Dict.DictManageMainPanel(); - CreatePage(page,guid); } }), } @@ -881,5 +850,8 @@ } #endregion Modular + + + } } \ No newline at end of file -- Gitblit v1.9.3