Infragistics 15.2 WorksheetImage.SetBoundsInTwips编译错误 [英] Infragistics 15.2 WorksheetImage.SetBoundsInTwips compilation error

查看:83
本文介绍了Infragistics 15.2 WorksheetImage.SetBoundsInTwips编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码

System.Drawing.Image logo = ... (getting logo)
WorksheetImage worksheetImage = new WorksheetImage(logo);
worksheetImage.PositioningMode = ShapePositioningMode.DontMoveOrSizeWithCells;

// Original code (works with Infragistics 13.1)
Rectangle imageRect = new Rectangle(100, 100, 10 * logo.Width, 10 * logo.Height);
worksheetImage.SetBoundsInTwips(worksheet, imageRect, true); // Breaks here

以下代码可用于Infragistics 13.1库.但是,当迁移到15.2时,编译器会吐出一个错误:

The following code works with Infragistics 13.1 library. However, when migrating to 15.2, compiler spits out an error:

与之匹配的最佳重载方法 'Infragistics.Documents.Excel.WorksheetImage.SetBoundsInTwips(Infragistics.Documents.Excel.Worksheet, System.Windows.Rect,bool)'有一些无效的参数

The best overloaded method match for 'Infragistics.Documents.Excel.WorksheetImage.SetBoundsInTwips(Infragistics.Documents.Excel.Worksheet, System.Windows.Rect, bool)' has some invalid arguments

参数2:无法从"System.Drawing.Rectangle"转换为 'System.Windows.Rect'

Argument 2: cannot convert from 'System.Drawing.Rectangle' to 'System.Windows.Rect'

因此,基本上说第二个参数应该是System.Windows.Rect类型,而不是System.Drawing.Rectangle类型.信息

So basically it says that the second argument should be of type System.Windows.Rect and not System.Drawing.Rectangle. The information here indicates that the type I am passing in is correct, but compiler disagrees. Why is that the case?

推荐答案

Infragistics WindowsForms Excel引擎的SetBoundsInTwips方法确实使用System.Drawing.Rect作为其参数之一.但是WPF

The Infragistics WindowsForms Excel engine's SetBoundsInTwips method indeed uses System.Drawing.Rect as one of its parameters. However the WPF implementation uses System.Windows.Rect. If this call doesn't compile then you are probably using the WPF library. Please check the references of your project and see if they use the WPF Assembly (InfragisticsWPF4.Documents.Excel.v15.2) and substitute it with the WF one (Infragistics4.Documents.Excel.v15.2).

这篇关于Infragistics 15.2 WorksheetImage.SetBoundsInTwips编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆