diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index 19021a21..0582132b 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index bd454749..425f847a 100644 Binary files a/Bin/SunnyUI.pdb and b/Bin/SunnyUI.pdb differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll index 19021a21..0582132b 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI/Controls/UICheckBox.cs b/SunnyUI/Controls/UICheckBox.cs index bf0a1dbe..32b8eb3f 100644 --- a/SunnyUI/Controls/UICheckBox.cs +++ b/SunnyUI/Controls/UICheckBox.cs @@ -106,14 +106,28 @@ namespace Sunny.UI protected override void OnPaintFore(Graphics g, GraphicsPath path) { - //设置按钮标题位置 - Padding = new Padding(_imageSize + _imageInterval * 2, Padding.Top, Padding.Right, Padding.Bottom); + if (RightToLeft == RightToLeft.Yes) + { + //设置按钮标题位置 + Padding = new Padding(Padding.Left, Padding.Top, Padding.Right- _imageSize - _imageInterval * 2, Padding.Bottom); - //填充文字 - Color color = foreColor; - color = Enabled ? color : UIDisableColor.Fore; + //填充文字 + Color color = foreColor; + color = Enabled ? color : UIDisableColor.Fore; - g.DrawString(Text, Font, color, Size, Padding, ContentAlignment.MiddleLeft); + g.DrawString(Text, Font, color, Size, Padding, ContentAlignment.MiddleLeft); + } + else + { + //设置按钮标题位置 + Padding = new Padding(_imageSize + _imageInterval * 2, Padding.Top, Padding.Right, Padding.Bottom); + + //填充文字 + Color color = foreColor; + color = Enabled ? color : UIDisableColor.Fore; + + g.DrawString(Text, Font, color, Size, Padding, ContentAlignment.MiddleLeft); + } } protected override void OnPaintFill(Graphics g, GraphicsPath path) diff --git a/SunnyUI/Controls/UIToolTip.cs b/SunnyUI/Controls/UIToolTip.cs index 52658b08..54353f49 100644 --- a/SunnyUI/Controls/UIToolTip.cs +++ b/SunnyUI/Controls/UIToolTip.cs @@ -164,38 +164,57 @@ namespace Sunny.UI } SizeF textSize = g.MeasureString(tooltip.Description, Font); - - TitleHeight = (int)Math.Max(symbolHeight, titleSize.Height); - - e.ToolTipSize = new Size((int)Math.Max(textSize.Width, symbolWidth + titleSize.Width) + 10, (int)textSize.Height + TitleHeight + 10); + int allWidth = (int) Math.Max(textSize.Width, titleSize.Width) + 10; + if (symbolWidth > 0) allWidth = allWidth + symbolWidth + 5; + int allHeight = titleSize.Height > 0 ? + (int)titleSize.Height + (int)textSize.Height + 15 : + (int)textSize.Height + 10; + e.ToolTipSize = new Size(allWidth, allHeight); bmp.Dispose(); } } } } - private int TitleHeight; - private void ToolTipExDraw(object sender, DrawToolTipEventArgs e) { if (ToolTipControls.ContainsKey(e.AssociatedControl)) { var tooltip = ToolTipControls[e.AssociatedControl]; - var bounds = new Rectangle(e.Bounds.Left, e.Bounds.Top, e.Bounds.Width - 1, e.Bounds.Height - 1); e.Graphics.FillRectangle(BackColor, bounds); e.Graphics.DrawRectangle(RectColor, bounds); if (tooltip.Symbol > 0) + { e.Graphics.DrawFontImage(tooltip.Symbol, tooltip.SymbolSize, tooltip.SymbolColor, new Rectangle(5, 5, tooltip.SymbolSize, tooltip.SymbolSize)); + } + + int symbolWidth = tooltip.Symbol > 0 ? tooltip.SymbolSize : 0; + int symbolHeight = tooltip.Symbol > 0 ? tooltip.SymbolSize : 0; + SizeF titleSize = new SizeF(0, 0); if (tooltip.Title.IsValid()) { - SizeF sf = e.Graphics.MeasureString(tooltip.Title, TitleFont); - e.Graphics.DrawString(tooltip.Title,TitleFont,ForeColor, tooltip.Symbol>0?tooltip.SymbolSize+5:5, (TitleHeight-sf.Height)/2); + if (tooltip.Title.IsValid()) + { + titleSize = e.Graphics.MeasureString(tooltip.Title, TitleFont); + } + + e.Graphics.DrawString(tooltip.Title,TitleFont,ForeColor, + tooltip.Symbol>0?tooltip.SymbolSize+5:5, 5); } - - e.Graphics.DrawString(e.ToolTipText, Font, ForeColor, 6, TitleHeight + 6); + + if (titleSize.Height > 0) + { + e.Graphics.DrawLine(ForeColor, + symbolWidth==0?5:symbolWidth+5, 5+ titleSize.Height + 3, + e.Bounds.Width - 5, 5 + titleSize.Height + 3); + } + + e.Graphics.DrawString(e.ToolTipText, Font, ForeColor, + tooltip.Symbol > 0 ? tooltip.SymbolSize + 5 : 5, + titleSize.Height > 0? 10+ titleSize.Height : 5); } else { diff --git a/Updates.txt b/Updates.txt index d01f2191..a3004bc9 100644 --- a/Updates.txt +++ b/Updates.txt @@ -1,5 +1,22 @@ + ӣ - ɾ * ޸ +2020-07-21 ++ UIToolTipؼ޸ +* UIForm.cs ֵ֧ͼ꣬ԽС + +2020-07-20 ++ UIWaitingBarȴؼ + +2020-07-18 +* UIDataGridViewػˮƽ ++ UIHorScrollBarˮƽ + +2020-07-15 +* UIDataGridViewĬΪԭؼ + +2020-07-10 +* UIFormӱICONͼ + 2020-07-08 * UIDateTimePickerд壬̴ʱ