Source/ButtonItemLayout.cs
(开头部分) 45KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.Drawing;
using System.Drawing.Text;
using System.Windows.Forms;
using System;
using DevComponents.DotNetBar.Rendering;
namespace DevComponents.DotNetBar
{
/// <summary>
/// Summary description for ButtonItemLayout.
/// </summary>
internal class ButtonItemLayout
{
/// <summary>
/// Arranges the button inner parts when button size has changed externally.
/// </summary>
/// <param name="button">Button to arrange inner parts for.</param>
public static void Arrange(ButtonItem button)
{
int minTextSize = 8;
bool isOnMenu = button.IsOnMenu;
if (isOnMenu && button.Parent is ItemContainer)
isOnMenu = false;
bool hasImage = false;
if (button.GetImage() != null)
hasImage = true;
bool rightToLeft = button.IsRightToLeft;
Size imageSize = GetLayoutImageSize(button, hasImage, isOnMenu, false);
Rectangle bounds = button.DisplayRectangle;
if (isOnMenu)
{
// Add 4 pixel padding to the image size, 2 pixels on each side
imageSize.Height += 2;
imageSize.Width += 7;
// Center image if any...
//if (rightToLeft)
//{
// if (button.IsOnCustomizeMenu)
// button.ImageDrawRect = new Rectangle(bounds.Width - (imageSize.Width + bounds.Height + 2), Math.Max(0, (bounds.Height - imageSize.Height) / 2), imageSize.Width, imageSize.Height);
// else
// button.ImageDrawRect = new Rectangle(bounds.Width - imageSize.Width - 1, Math.Max(0, (bounds.Height - imageSize.Height) / 2), imageSize.Width, imageSize.Height);
//}
//else
{
if (button.IsOnCustomizeMenu && !rightToLeft)
button.ImageDrawRect = new Rectangle(bounds.Height + 2, Math.Max(0, (bounds.Height - imageSize.Height) / 2), imageSize.Width, imageSize.Height);
else
button.ImageDrawRect = new Rectangle(0, Math.Max(0, (bounds.Height - imageSize.Height) / 2), imageSize.Width, imageSize.Height);
}
//if (rightToLeft)
// button.TextDrawRect = new Rectangle(Math.Max(0, button.ImageDrawRect.X - button.TextDrawRect.Width - 2), Math.Max(0, (bounds.Height - button.TextDrawRect.Height) / 2), button.TextDrawRect.Width, button.TextDrawRect.Height);
//else
button.TextDrawRect = new Rectangle(button.ImageDrawRect.Right + 8, Math.Max(0, (bounds.Height - button.TextDrawRect.Height) / 2), button.TextDrawRect.Width, button.TextDrawRect.Height);
return;
}
int x = 0;
if (!button.SubItemsRect.IsEmpty)
后面还有 804 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。