diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index 4f35623f..d5bbbe49 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index 69bba6da..4143aa35 100644 Binary files a/Bin/SunnyUI.pdb and b/Bin/SunnyUI.pdb differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe index 8ee2b818..3d4d958f 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe and b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll index 4f35623f..d5bbbe49 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FAvatar.Designer.cs b/SunnyUI.Demo/Controls/FAvatar.Designer.cs index f4b0865a..f42eb690 100644 --- a/SunnyUI.Demo/Controls/FAvatar.Designer.cs +++ b/SunnyUI.Demo/Controls/FAvatar.Designer.cs @@ -61,15 +61,18 @@ // // uiAvatar1 // + this.uiAvatar1.AvatarSize = 55; this.uiAvatar1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiAvatar1.Location = new System.Drawing.Point(102, 50); this.uiAvatar1.Name = "uiAvatar1"; this.uiAvatar1.Size = new System.Drawing.Size(60, 60); + this.uiAvatar1.SymbolSize = 48; this.uiAvatar1.TabIndex = 0; this.uiAvatar1.Text = "uiAvatar1"; // // uiAvatar2 // + this.uiAvatar2.AvatarSize = 55; this.uiAvatar2.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiAvatar2.Icon = Sunny.UI.UIAvatar.UIIcon.Image; this.uiAvatar2.Image = global::Sunny.UI.Demo.Properties.Resources.SunnyUISmall; @@ -81,6 +84,7 @@ // // uiAvatar3 // + this.uiAvatar3.AvatarSize = 55; this.uiAvatar3.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiAvatar3.Icon = Sunny.UI.UIAvatar.UIIcon.Text; this.uiAvatar3.Location = new System.Drawing.Point(174, 50); @@ -91,6 +95,7 @@ // // uiAvatar4 // + this.uiAvatar4.AvatarSize = 55; this.uiAvatar4.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiAvatar4.Location = new System.Drawing.Point(362, 50); this.uiAvatar4.Name = "uiAvatar4"; diff --git a/SunnyUI.Demo/FMain.Designer.cs b/SunnyUI.Demo/FMain.Designer.cs index 2a9585ad..de340402 100644 --- a/SunnyUI.Demo/FMain.Designer.cs +++ b/SunnyUI.Demo/FMain.Designer.cs @@ -87,7 +87,7 @@ this.uiAvatar.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiAvatar.Location = new System.Drawing.Point(943, 25); this.uiAvatar.Name = "uiAvatar"; - this.uiAvatar.Size = new System.Drawing.Size(65, 65); + this.uiAvatar.Size = new System.Drawing.Size(66, 70); this.uiAvatar.TabIndex = 4; this.uiAvatar.Text = "uiAvatar1"; // diff --git a/SunnyUI/Controls/UIAvatar.cs b/SunnyUI/Controls/UIAvatar.cs index b79b0116..d70c3135 100644 --- a/SunnyUI/Controls/UIAvatar.cs +++ b/SunnyUI/Controls/UIAvatar.cs @@ -68,6 +68,19 @@ namespace Sunny.UI foreColor = UIStyles.Blue.AvatarForeColor; } + private int avatarSize = 60; + + [DefaultValue(60)] + public int AvatarSize + { + get => avatarSize; + set + { + avatarSize = value; + Invalidate(); + } + } + /// /// 填充颜色,当值为背景色或透明色或空值则不填充 /// @@ -210,7 +223,7 @@ namespace Sunny.UI protected override void OnPaintFill(Graphics g, GraphicsPath path) { int size = Math.Min(Width, Height) - 3; - Rectangle rect = new Rectangle(2, 2, size - 2, size - 2); + Rectangle rect = new Rectangle((Width-avatarSize)/2, (Height - avatarSize) / 2, avatarSize, avatarSize); switch (Shape) { @@ -232,11 +245,6 @@ namespace Sunny.UI { base.OnPaint(e); - if (Height != Width) - { - Height = Width; - } - if (Width <= 0 || Height <= 0) { return; @@ -280,13 +288,13 @@ namespace Sunny.UI if (Icon == UIIcon.Symbol) { - e.Graphics.DrawFontImage(symbol, symbolSize, ForeColor, new Rectangle(0, 0, Width, Height)); + e.Graphics.DrawFontImage(symbol, symbolSize, ForeColor, new Rectangle((Width - avatarSize) / 2+1, (Height - avatarSize) / 2+1, avatarSize, avatarSize)); } if (Icon == UIIcon.Text) { SizeF sf = e.Graphics.MeasureString(Text, Font); - e.Graphics.DrawString(Text, Font, foreColor, 2 + (size - 4 - sf.Width + 7) / 2.0f, 2 + (size - 4 - sf.Height + 2) / 2.0f); + e.Graphics.DrawString(Text, Font, foreColor, 2 + (Width - sf.Width ) / 2.0f, (Height- sf.Height ) / 2.0f); } } } diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index 5efe4d37..8951a29f 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -61,6 +61,11 @@ namespace Sunny.UI Version = UIGlobal.Version; } + public void Render() + { + SetStyle(UIStyles.Style); + } + /// /// 显示进度窗口 /// diff --git a/SunnyUI/Frames/UIMainFrame.cs b/SunnyUI/Frames/UIMainFrame.cs index 4a7f4768..a15df320 100644 --- a/SunnyUI/Frames/UIMainFrame.cs +++ b/SunnyUI/Frames/UIMainFrame.cs @@ -32,6 +32,12 @@ namespace Sunny.UI MainContainer.BringToFront(); } + protected override void OnShown(EventArgs e) + { + MainContainer.BringToFront(); + base.OnShown(e); + } + public UIPage AddPage(UIPage page, int index) { page.PageIndex = index; diff --git a/SunnyUI/Pages/UIPage.cs b/SunnyUI/Pages/UIPage.cs index 3572ed40..19e6da7b 100644 --- a/SunnyUI/Pages/UIPage.cs +++ b/SunnyUI/Pages/UIPage.cs @@ -59,6 +59,11 @@ namespace Sunny.UI Version = UIGlobal.Version; } + public void Render() + { + SetStyle(UIStyles.Style); + } + private int _symbolSize = 24; [DefaultValue(24)] diff --git a/SunnyUI/Resources/Browse.plb b/SunnyUI/Resources/Browse.plb deleted file mode 100644 index b734b07b..00000000 Binary files a/SunnyUI/Resources/Browse.plb and /dev/null differ diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj index 9b437de7..07cd9455 100644 --- a/SunnyUI/SunnyUI.csproj +++ b/SunnyUI/SunnyUI.csproj @@ -629,7 +629,6 @@ -