The Print Preview Physical Form Attributes

havinablast

Member
Joined
Dec 10, 2009
Messages
14
Programming Experience
Beginner
Hi all,

Very new to programming and to VB.

I'm working on a program that fills a DataGridView with details pulled from a MS Access Database.

At this point, I have the coding that will allow me to print the DataGridView and will also allow me to show a Print Preview screen. Actually, everything is working well...

My ONLY hopes (at this moment) is that I can somehow change the attributes of the Print Preview form itself.

Presently, the actual Print Preview pops up and is very tiny. The user can, of course, stretch the form to enlarge it, but I would like for the form to appear at the same size as the rest of the forms in the project. Also, I'd like to be able to add my Icon to the forms title bar, customize the title bar wording (from Print preview to My Program - Data Search) and change the default background color of the form (to match my other forms).

Is this possible? If so, where do I access the coding to change it? And, is there any special coding to know in order to achieve this?

Any and all help is greatly appreciated.

PS - the coding I'm using for printing the DataGridView is setup as a Public Class AND then called on button click (i.e. my printdialog is not in the class, but in the form).

Thank you
 
VB.NET:
ppvw = New PrintPreviewDialog
ppvw.WindowState = FormWindowState.Maximized
ppvw.PrintPreviewControl.Zoom = 0.85 '0.62 for portrait, 0.9 for landscape
CType(ppvw.Controls(1), ToolStrip).Items(0).Enabled = False 'disables print option from Print Preview window
 
Thank you - Icon and Backcolor ???

Hi Inertia,

Thank you very much for the prompt response. I've managed to adjust the size of the Print Preview Screen and add a Title to the Window Bar (Woohoo!), but I'm still quite lost on the coding for implementing the Icon and Background color change.

Is there any more you (or any willing soul) can give me?

Thank you!
 
Okay...

I got the icon deal.... simple

dlg (name of printpreview dialog)
Form2 (some other form in my project)

in code...
dlg.Icon = Form2.Icon

............ so, my only other issue is...

How to change background color of print preview form (if this is even possible).
 
You could try:-

VB.NET:
dlg.BackColor = Color.Red

but I'm not sure you're going to see much of a change.
 
Thank you, again.

Thanks again for taking the time to help me. I appreciate it!

Unfortunately, that didn't work... it changed only one spot to red.

BUT, I can live with this! At least, I know have the title bar and Icon changed.

Thank you so much.
 
VB.NET:
dlg.Controls(0).BackColor = Color.Green
 
The extra mile...

Thank you so much for taking the time (and spending the energy) to go the extra mile for me.

Everything works perfectly now (at least with my printing and preview :)

You rock!
 
Back
Top