* UIForm:增加IFrame接口

- UIMainFrame:删除IFrame接口,移到父类UIForm
This commit is contained in:
Sunny 2021-10-16 16:30:49 +08:00
parent 42b77f2119
commit 030db76dd8
7 changed files with 63 additions and 119 deletions

Binary file not shown.

Binary file not shown.

View File

@ -737,7 +737,7 @@ namespace Sunny.UI
}
}
private bool IsZoom;
public bool IsZoom { get; private set; }
private readonly List<ZoomArea> ZoomAreas = new List<ZoomArea>();
private ZoomArea BaseArea;

View File

@ -26,6 +26,7 @@
* 2021-05-06: V3.0.3
* 2021-08-17: V3.0.6 TitleFont属性
* 2021-08-17: V3.0.6
* 2021-08-17: V3.0.8 IFrame接口
******************************************************************************/
using System;
@ -38,7 +39,7 @@ using System.Windows.Forms;
namespace Sunny.UI
{
public partial class UIForm : Form, IStyleInterface, ITranslate
public partial class UIForm : Form, IStyleInterface, ITranslate, IFrame
{
private readonly UIButton btn = new UIButton();
@ -533,7 +534,7 @@ namespace Sunny.UI
{
rectColor = value;
AfterSetRectColor(value);
RectColorChanged?.Invoke(this, null);
RectColorChanged?.Invoke(this, EventArgs.Empty);
_style = UIStyle.Custom;
Invalidate();
}
@ -570,7 +571,7 @@ namespace Sunny.UI
}
else
{
ExtendBoxClick?.Invoke(this, null);
ExtendBoxClick?.Invoke(this, EventArgs.Empty);
}
}
}
@ -1800,5 +1801,55 @@ namespace Sunny.UI
}
#endregion
#region IFrame实现
public UITabControl MainTabControl { get; set; }
public UIPage AddPage(UIPage page, int index)
{
page.PageIndex = index;
return AddPage(page);
}
public UIPage AddPage(UIPage page, Guid guid)
{
page.PageGuid = guid;
return AddPage(page);
}
public UIPage AddPage(UIPage page)
{
page.Frame = this;
MainTabControl?.AddPage(page);
return page;
}
public virtual void SelectPage(int pageIndex)
{
MainTabControl?.SelectPage(pageIndex);
}
public virtual void SelectPage(Guid guid)
{
MainTabControl?.SelectPage(guid);
}
public bool RemovePage(int pageIndex)
{
return MainTabControl?.RemovePage(pageIndex) ?? false;
}
public bool RemovePage(Guid guid)
{
return MainTabControl?.RemovePage(guid) ?? false;
}
public virtual void Feedback(object sender, int pageIndex, params object[] objects)
{
}
#endregion IFrame实现
}
}

View File

@ -40,14 +40,16 @@
this.MainContainer.Controls.Add(this.tabPage2);
this.MainContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.MainContainer.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;
this.MainContainer.Font = new System.Drawing.Font("微软雅黑", 12F);
this.MainContainer.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.MainContainer.ItemSize = new System.Drawing.Size(150, 40);
this.MainContainer.Location = new System.Drawing.Point(0, 35);
this.MainContainer.MainPage = "";
this.MainContainer.Name = "MainContainer";
this.MainContainer.SelectedIndex = 0;
this.MainContainer.Size = new System.Drawing.Size(800, 415);
this.MainContainer.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.MainContainer.TabIndex = 0;
this.MainContainer.TabUnSelectedForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
this.MainContainer.Selecting += new System.Windows.Forms.TabControlCancelEventHandler(this.MainContainer_Selecting);
//
// tabPage1
@ -64,7 +66,7 @@
this.tabPage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.tabPage2.Location = new System.Drawing.Point(0, 40);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(450, 230);
this.tabPage2.Size = new System.Drawing.Size(200, 60);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "tabPage2";
//
@ -73,6 +75,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.MainContainer);
this.MainTabControl = this.MainContainer;
this.Name = "UIMainFrame";
this.Text = "UIMainFrame";
this.MainContainer.ResumeLayout(false);

View File

@ -17,6 +17,7 @@
* : 2020-05-05
*
* 2020-05-05: V2.2.5
* 2021-08-17: V3.0.8 IFrame接口UIForm
******************************************************************************/
using System;
@ -26,7 +27,7 @@ using System.Windows.Forms;
namespace Sunny.UI
{
public partial class UIMainFrame : UIForm, IFrame
public partial class UIMainFrame : UIForm
{
public UIMainFrame()
{
@ -99,56 +100,5 @@ namespace Sunny.UI
[Description("页面选择事件"), Category("SunnyUI")]
public event OnSelecting Selecting;
#region IFrame实现
[Browsable(false)]
public UITabControl MainTabControl => MainContainer;
public UIPage AddPage(UIPage page, int index)
{
page.PageIndex = index;
return AddPage(page);
}
public UIPage AddPage(UIPage page, Guid guid)
{
page.PageGuid = guid;
return AddPage(page);
}
public UIPage AddPage(UIPage page)
{
page.Frame = this;
MainTabControl.AddPage(page);
return page;
}
public virtual void SelectPage(int pageIndex)
{
MainTabControl.SelectPage(pageIndex);
}
public virtual void SelectPage(Guid guid)
{
MainTabControl.SelectPage(guid);
}
public bool RemovePage(int pageIndex)
{
return MainTabControl.RemovePage(pageIndex);
}
public bool RemovePage(Guid guid)
{
return MainTabControl.RemovePage(guid);
}
public virtual void Feedback(object sender, int pageIndex, params object[] objects)
{
}
#endregion IFrame实现
}
}

View File

@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">