dr-jb / finansu

Automatically exported from code.google.com/p/finansu
MIT License
0 stars 0 forks source link

Using Office 10 PIA - Ambiguous references when compiling source code and IPictureDisp missing directive #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Using SharpDevelop IDE, ExcelDna version 0.28.3958.28648, finansu 0.9.3
2. change Microsoft.Office.Interop.Excel version 12 for version 14 (Office 
2010), change "office" version 12 for version 14
3. Compile the application and 2 types of error occur as below 
Error 1:
'IRibbonControl' is an ambiguous reference between 
'Microsoft.Office.Core.IRibbonControl' and 
'ExcelDna.Integration.CustomUI.IRibbonControl' (CS0104) - 
C:\data\Trading\Workspaces\TradeLog\FinAnSu\FinAnSu\Controls\Ribbon.cs:49,34
Error 2:
The type or namespace name 'IPictureDisp' could not be found (CS0246)

What is the expected output? What do you see instead?
Application should compile

What version of the product are you using? On what operating system?
0.9.3

Please provide any additional information below.

Original issue reported on code.google.com by paulbees...@googlemail.com on 22 May 2011 at 9:51

GoogleCodeExporter commented 8 years ago
The whole ImageConverter and IPictureDisp story can be removed from Ribbon.cs, 
and replaced by just:

    public Bitmap Logo(IRibbonControl control)
    {
        return FinAnSu.Properties.Resources.logo_abbrev;
    }

The getImage handler in the ribbon .xml can return:
1. An IPictureDisp, or
2. A System.Drawing.Bitmap, or
3. A string containing an imageMso identifier.

The .NET Bitmap class has a member called GetHBitmap() that is called via the 
Dispatch interface. This is enough to support the ribbon image callback.

More info here: 
http://blogs.msdn.com/b/jensenh/archive/2006/11/27/ribbonx-image-faq.aspx.

Original comment by gov...@icon.co.za on 24 May 2011 at 7:20

GoogleCodeExporter commented 8 years ago
Thanks, Govert. Honestly, I'm not sure why I didn't just do that in the first 
place, aside from a set-it-and-forget-it attitude toward Ribbon.cs. Anyway, I 
wound up using something like your code with a minor change to make it easier 
if I want to add different icons in the future.

    public Bitmap GetImage(IRibbonControl control)
    {
        return (Bitmap)FinAnSu.Properties.Resources.ResourceManager.GetObject(control.Tag);
    }

If it fails to find whatever's specified in the Ribbon control's tag attribute 
the user just sees a blank image.

The other issue should also be resolved.

Original comment by Bryan.McKelvey on 25 May 2011 at 3:31

GoogleCodeExporter commented 8 years ago

Original comment by Bryan.McKelvey on 25 May 2011 at 3:32