PrintDialog AllowSelection and make checked

  • Thread starter Thread starter David
  • Start date Start date
D

David

Does anybody know how to check the AllowSelection radio button in the
PrintDialog Dialog? I want to set this to checked if the user has
selected a subset of text.
 
Hi David,

Thank you for posting in the community!

Based on my understanding, you use PrintDialog class to display a print
dialog. If the user have selected some text for print, you want the print
dialog to select the "selection" option.

===========================================
Actually, .Net PrintDialog class does not expose the way to select this
option button.

I think the workaround is in the initialize period P/invoke FindWindow
win32 API function to get the window handle of "selection" option button.
Then send a BM_SETCHECK message to this option button to set it checked.

Because PrintDialog is a sealed class, to hook into the initialize period
of PrintDialog, you should inherit from CommonDialog, do like follow steps:
1. Create a new class inheriting from CommonDialog
http://www.dotnet247.com/247reference/System/Windows/Forms/CommonDialog.aspx
2. Override the RunDialog method and call the standard windows API
functions to bring up a common dialog
3. Handle the WM_INITDIALOG messages in the HookProc the adding the
functionality to the common dialog

So the entire process is too complex and cost too much for you. I think it
is a good idea to leave away from this complex, leave this selection to the
user.

==========================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Have a nice day!!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi David,

Does my reply make sense to you?

If you still have anything unclear, please feel free to post, I will help
you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top