GcSpreadSheet控件的FontSize和excel的不一致
GcSpreadSheet控件的FontSize和excel的不一致,比如,同样设置11号,控件中的字体大小明显要比excel里面的字体大小要小很多,怎么可以保持一致 回复 1楼huchunyan的帖子请通过以下代码转换:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.gcSpreadSheet1.ActiveSheet.Cells.FontSize = UnitHelper.PointToPixel(11);
this.gcSpreadSheet1.ActiveSheet.Cells.Text = "测试";
}
}
internal static class UnitHelper
{
private static double? _dpi;
private static readonly double PointsPerInch = 72;
public static double PointToPixel(double point)
{
return point * GetDPI() / PointsPerInch;
}
public static double PixelToPoint(double pixel)
{
return pixel * PointsPerInch / GetDPI();
}
public static double GetDPI()
{
if (_dpi.HasValue)
return _dpi.Value;
else
{
_dpi = GetSystemDPI();
return _dpi.Value;
}
}
private static double GetSystemDPI()
{
return 96; //Look like excel always use DPI=96.
}
}
回复 1楼huchunyan的帖子
请问问题是否解决?为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢
http://gcdn.gcpowertools.com.cn/attachment.aspx?attachmentid=10062
页:
[1]