.DrawPicture VB.Net

Posted by: SatishMatani on 11 April 2020, 1:41 pm EST

  • Posted 11 April 2020, 1:41 pm EST

    I am converting old VB6 program to VB.Net. The following worked fine in VB6

    .DrawPicture frmMain.vd.Picture, .CurrentX, .CurrentY, "15%", "33%"

    but following gives error in VB.Net
    .DrawPicture(frmMain.vd.Picture, .CurrentX, .CurrentY, "15%", "33%")
  • Replied 11 April 2020, 1:50 pm EST

    Error image attached
  • Replied 12 April 2020, 11:02 pm EST

    Hi Satish,

    I could replicate the issue at my end as well. Using VSPrinter's DrawPicture method does not allow skipping optional parameters, Align and Shade, in VB.Net. I have forwarded it to the developers [Internal Tracking ID: 430976] and will let you know once there is any information from them.

  • Replied 13 April 2020, 6:30 pm EST


    I discussed the case with the developers. The Interop interfaces are not generated by GrapeCity, but rather by VB.NET. As such GrapeCity has very little control of the overloads generated by the VB.NET software. When dropping the control on a form, 2 overloads are generated by VB.NET - one with 3 arguments and one with 7 arguments. One or the other must be used.

    ActiveX controls (Windows native) are not directly accessible by .NET software. To use them, Visual Studio .NET generates intermediate code to allow operations between the two (.NET and native code) - an Interop. It is the generated interop software that limits the overloads without default values. And, hence the difference from VB6.

  • Replied 14 April 2020, 4:33 am EST


    Thank you for a quick response. Pardon me for my ignorance. But not sure what you are getting at. What is the solution? How can I make this work? How do I use .DrawPicture(frmMain.vd.Picture, .CurrentX, .CurrentY, "15%", "33%"). Please help.
  • Replied 14 April 2020, 10:27 pm EST

    Hi Satish,

    The solution is to either use the overload with 3 arguments (Picture As Picture, Left As Variant, Top As Variant) or the one with 7 arguments (Picture As Picture, Left As Variant, Top As Variant, [ Width As Variant ], [ Height As Variant ], [ Align As Variant ], [ Shade As Variant ]) in VB.Net.

  • Replied 15 April 2020, 11:58 am EST


    What value do I assign for Align and Shade variant? The documentation does not say anything about it
  • Replied 15 April 2020, 10:41 pm EST

    Hi Satish,

    Here is the correct link from the documentation:

    It is VSPrinter's DrawPicture method.

  • Replied 17 April 2020, 8:31 am EST


    Thanks. One step closer. Above with EnhancedMatafile does not work.

    VB6 code:
    frmChart.ChartV.CopyToClipboard oc2dFormatEnhMetafile
    .DrawPicture Clipboard.GetData(3), .CurrentX, .CurrentY "60%", "60%"

    VB.Net code frmChart.ChartV.CopyToClipboard(C1Chart2D8.FormatConstants.oc2dFormatEnhMetafile) .DrawPicture(Clipboard.GetDataObject().GetData(DataFormats.EnhancedMetafile), .CurrentX, .CurrentY, "60%", "60%", 10, False)

    but it works with Bitmap
    .DrawPicture(Clipboard.GetDataObject().GetData(DataFormats.Bitmap), .CurrentX, .CurrentY, "60%", "60%", 10, False)

    What am I doing wrong?
  • Marked as Answer

    Replied 21 April 2020, 9:07 pm EST


    Can you please give me a small sample replicating this? That would help me in assisting you further at the earliest.

  • Replied 30 April 2020, 2:03 pm EST

    Attached is the sample. Click on Button 1.

    Also, I have another issue. Following line worked in vb6
    .DrawPicture frmMain.vd.Picture, .CurrentX, .CurrentY, "20%", "33%"
    but following in VB.Net does not work.
    DrawPicture(Form1.vd.Picture, .MarginLeft, .CurrentY, "50%", "50%", "10", False)
    It gives error. It is line 31 in Form2_load which I have REM out.
    ThxVSPrint Ex - Copy.zip
  • Replied 30 April 2020, 10:10 pm EST

    Hi Satish,

    I am discussing both the issues with the developer [tracking ID: 433517]. Will get back to you once there is any information from them.

  • Replied 30 May 2020, 2:42 am EST

    Any update?
  • Replied 2 June 2020, 9:01 pm EST

    Hi Satish,

    I have asked the developer for an update on this. Will notify you once there is any information from him.

  • Replied 14 June 2020, 2:53 am EST

    Just wondering if you heard back from the developer on this?
  • Replied 14 June 2020, 9:09 pm EST

    Not yet, Satish. I will update the thread once there is something.

    I would also like you to know that ActiveX Edition is in maintenance mode and there is no active development going for the product. We only fix critical issues though.

  • Replied 19 July 2020, 2:31 am EST

    Hi Pragati,

    I understand ActiveX Edition is in maintenance mode and you only fix critical issues. I consider being able to print vd picture a critical issue. It is clearly a feature of VSprint and documented in the control and design example VSDraw.

    This item is very critical for me to convert my old VB program to VB.net and the last remaining issue. I beg you to look into it and let me know or provide a work around.

    Thank you for your understanding and stay safe.
  • Replied 22 July 2020, 11:02 pm EST


    I understand the criticality of the issue for you, hence have forwarded your comments to the concerned developer and have requested for a workaround while the issue is under investigation.
    I will get back to you as soon as there is an update.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels