* UIAvator: 增加缩放
This commit is contained in:
parent
696c36c9e9
commit
b6554b162c
Binary file not shown.
@ -73,6 +73,7 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int avatarSize = 60;
|
private int avatarSize = 60;
|
||||||
|
private int baseAvatorSize = 60;
|
||||||
|
|
||||||
[DefaultValue(60), Description("头像大小"), Category("SunnyUI")]
|
[DefaultValue(60), Description("头像大小"), Category("SunnyUI")]
|
||||||
public int AvatarSize
|
public int AvatarSize
|
||||||
@ -80,6 +81,7 @@ namespace Sunny.UI
|
|||||||
get => avatarSize;
|
get => avatarSize;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
baseAvatorSize = value;
|
||||||
avatarSize = value;
|
avatarSize = value;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
@ -177,6 +179,7 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int symbolSize = 45;
|
private int symbolSize = 45;
|
||||||
|
private int baseSymbolSize = 45;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 图标大小
|
/// 图标大小
|
||||||
@ -191,6 +194,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
symbolSize = Math.Max(value, 16);
|
symbolSize = Math.Max(value, 16);
|
||||||
symbolSize = Math.Min(value, 128);
|
symbolSize = Math.Min(value, 128);
|
||||||
|
baseSymbolSize = symbolSize;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -354,7 +358,9 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
public void SetControlScale(float scale)
|
public void SetControlScale(float scale)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
avatarSize = UIDPIScale.Calc(baseAvatorSize, scale);
|
||||||
|
symbolSize = UIDPIScale.Calc(baseSymbolSize, scale);
|
||||||
|
Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -106,7 +106,7 @@ namespace Sunny.UI
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int Calc(int size, float scale)
|
internal static int Calc(int size, float scale)
|
||||||
{
|
{
|
||||||
return (int)(size * scale + 0.5);
|
return (int)(size * scale + 0.5);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user