|
-
Aug 20th, 2021, 08:20 AM
#1
Thread Starter
Member
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)?
-
Aug 20th, 2021, 08:25 AM
#2
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.
-
Aug 20th, 2021, 08:45 AM
#3
Thread Starter
Member
Re: Small trouble with PowerPacks in Visual Studio 2019 Community
 Originally Posted by jmcilhinney
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.
-
Aug 20th, 2021, 09:58 AM
#4
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
 
-
Aug 20th, 2021, 10:00 AM
#5
Re: Small trouble with PowerPacks in Visual Studio 2019 Community
 Originally Posted by VisualBeginner.NET
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.
 Originally Posted by VisualBeginner.NET
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.
-
Aug 20th, 2021, 11:34 AM
#6
Thread Starter
Member
Re: Small trouble with PowerPacks in Visual Studio 2019 Community
 Originally Posted by Shaggy Hiker
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|