Results 1 to 6 of 6

Thread: Small trouble with PowerPacks in Visual Studio 2019 Community

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2021
    Posts
    46

    Small trouble with PowerPacks in Visual Studio 2019 Community

    I have used PowerPacks in another project and it seems to be working all right for printing forms. Now I have started with another project and it is not being found. This means it has probably been installed properly. Still, I have kept the DLL file of PowerPacks also in the folder where the .exe is being created. What do I have to do so that the solution includes the PowerPacks and does not complain about the code for PrintForm?

    And by the way, is there a better way of printing a form (active client rectangle area only)?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Small trouble with PowerPacks in Visual Studio 2019 Community

    The PrintForm component is a bit of a hack really. Generally speaking, you should not be printing a form but rather the data that the form contains, formatted appropriately. If you really need to print the actual UI then you can still do that without a PrintForm, as all controls have a DrawToBitmap method. I suspect that that is what PrintForm uses internally. Use a PrintDocument to do your printing and print the data is that's all you need or call DrawToBitmap and print that result if you really need it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2021
    Posts
    46

    Re: Small trouble with PowerPacks in Visual Studio 2019 Community

    Quote Originally Posted by jmcilhinney View Post
    The PrintForm component is a bit of a hack really. Generally speaking, you should not be printing a form but rather the data that the form contains, formatted appropriately. If you really need to print the actual UI then you can still do that without a PrintForm, as all controls have a DrawToBitmap method. I suspect that that is what PrintForm uses internally. Use a PrintDocument to do your printing and print the data is that's all you need or call DrawToBitmap and print that result if you really need it.
    Still what bugs me is that PowerPacks works fine for another project on the same computer. It could be an issue of just the reference to it. I know too little to be able to figure out what to add and from where.

    PrintDocument might need a lot of code because the form has a lot of text boxes and labels besides one image.

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,102

    Re: Small trouble with PowerPacks in Visual Studio 2019 Community

    Frankly, any time I have used PowerPacks, I've ended up regretting it. That always felt like something of a clunky afterthought of an add on, to me. It had some very convenient functionality (shapes, mostly), but also added some complexity that often ended up being awkward. I always ended up removing the PowerPacks because I found a way to accomplish the same task without that clunky addition.

    So, while I can understand that it would bug you that PowerPacks worked fine for another project, perhaps you might come around to the view that PowerPacks wasn't great, and you may be better off not using it even if it did work well one time. That's pretty much where I always ended up with that.
    My usual boring signature: Nothing

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Small trouble with PowerPacks in Visual Studio 2019 Community

    Quote Originally Posted by VisualBeginner.NET View Post
    Still what bugs me is that PowerPacks works fine for another project on the same computer. It could be an issue of just the reference to it. I know too little to be able to figure out what to add and from where.
    I don't think that we can really help with that based on the information available.
    Quote Originally Posted by VisualBeginner.NET View Post
    PrintDocument might need a lot of code because the form has a lot of text boxes and labels besides one image.
    You should always write as much code as is necessary to do what's required. Printing a picture of your UI is very poor form if what you are trying to convey is the data. That said, if you're determined to go with a picture of your UI then you can do that in a few lines.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Member
    Join Date
    Jul 2021
    Posts
    46

    Re: Small trouble with PowerPacks in Visual Studio 2019 Community

    Quote Originally Posted by Shaggy Hiker View Post
    Frankly, any time I have used PowerPacks, I've ended up regretting it. That always felt like something of a clunky afterthought of an add on, to me. It had some very convenient functionality (shapes, mostly), but also added some complexity that often ended up being awkward. I always ended up removing the PowerPacks because I found a way to accomplish the same task without that clunky addition.

    So, while I can understand that it would bug you that PowerPacks worked fine for another project, perhaps you might come around to the view that PowerPacks wasn't great, and you may be better off not using it even if it did work well one time. That's pretty much where I always ended up with that.
    I think I like this idea of giving up on legacy classes. Otherwise, I could as well continue with VB6.

    For the time being, I can even give up printing forms (and claim to save a couple of trees) and the shapes I have used can be drawn easily.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width