PrtInfo() Method
Instead of receiving various parameters and returning strings with various page settings, this function now returns the PageSettings object.
This method is only available in WinForms and not available for ASP.NET WebForms.
[VisualBasic]
Public Shared Function PrtInfo() As System.Drawing.Printing.PageSettings
[C#]
public static System.Drawing.Printing.PageSettings PrtInfo()
Example
[VisualBasic]
'Here are some examples that demonstrate how we can access the PrinterSetting
'object to get printing information
'Specifies if the default page settings are landscape
Dim orientation As Boolean = pd.PrinterSettings.DefaultPageSettings.Landscape
'Get the height, width and Paper from the PaperSize object
Dim h As Integer = pd.PrinterSettings.DefaultPageSettings.PaperSize.Height
Dim w As Integer = pd.PrinterSettings.DefaultPageSettings.PaperSize.Width
Dim pn As String = pd.PrinterSettings.DefaultPageSettings.PaperSize.PaperName
'Source of the paper (tray)
Dim src As String = pd.PrinterSettings.DefaultPageSettings.PaperSource.SourceName
'Indicates if paper is being printed in color
Dim lcolor As Boolean = pd.PrinterSettings.DefaultPageSettings.Color
[C#]
//Here are some examples that demonstrate how we can access the PrinterSetting
//object to get printing information
//Specifies if the default page settings are landscape
bool orientation = pd.PrinterSettings.DefaultPageSettings.Landscape;
//Get the height, width and Paper from the PaperSize object
int h = pd.PrinterSettings.DefaultPageSettings.PaperSize.Height;
int w = pd.PrinterSettings.DefaultPageSettings.PaperSize.Width;
string pn = pd.PrinterSettings.DefaultPageSettings.PaperSize.PaperName;
//Source of the paper (tray)
string src = pd.PrinterSettings.DefaultPageSettings.PaperSource.SourceName;
//Indicates if paper is being printed in color
bool lcolor = pd.PrinterSettings.DefaultPageSettings.Color;
Implementation
[VisualBasic]
Public Shared Function PrtInfo() As System.Drawing.Printing.PageSettings
'A PrintDocument object has to be created to specify it to the PrintDialog object
Dim doc As PrintDocument = New PrintDocument()
Dim pd As PrintDialog = New PrintDialog()
pd.Document = doc
Return pd.PrinterSettings.DefaultPageSettings
End Function
[C#]
public static System.Drawing.Printing.PageSettings PrtInfo()
{
//A PrintDocument object has to be created to specify it to the PrintDialog object
PrintDocument doc = new PrintDocument();
PrintDialog pd = new PrintDialog();
pd.Document = doc;
return pd.PrinterSettings.DefaultPageSettings;
}
Requirements
Namespace:VFPToolkit
Class:VFPToolkit.environment
Platforms:Windows98, WindowsNT4.0, WindowsMillenniumEdition, Windows2000, WindowsXPHomeEdition, WindowsXPProfessional, Windows.NETServerfamily
Assembly:VFPToolkit (in VFPToolkitNET.dll)
See Also
VFPToolkit.environment Members | VFPToolkit Namespace