'We assume that the GdViewer1 control has been properly integrated.
Dim message As String = ""
Dim CurPrinter As String = GdViewer1.PrintGetActivePrinter()
If GdViewer1.GetStat() = GdPictureStatus.OK Then
Dim PrintersCount As Integer = GdViewer1.PrintGetPrintersCount()
If GdViewer1.GetStat() = GdPictureStatus.OK Then
For i As Integer = 1 To PrintersCount
Dim PrinterName As String = GdViewer1.PrintGetPrinterName(i)
If GdViewer1.GetStat() = GdPictureStatus.OK Then
If GdViewer1.PrintSetActivePrinter(PrinterName) = True Then
Dim prnSettings As System.Drawing.Printing.PrinterSettings
prnSettings = GdViewer1.PrintGetPrinterSettings()
If GdViewer1.GetStat() = GdPictureStatus.OK Then
message = message + "Printer: " + PrinterName + vbCrLf + "Settings: " + prnSettings.ToString() + vbCrLf + vbCrLf
Else
message = message + "Printer: " + PrinterName + " Error getting settings: " + GdViewer1.PrintGetStat().ToString() + vbCrLf
End If
Else
Exit For
End If
Else
Exit For
End If
Next
If GdViewer1.GetStat() = GdPictureStatus.OK Then
MessageBox.Show(message, "GdViewer.PrintSetActivePrinter")
Else
MessageBox.Show("The example has NOT been followed successfully. The last status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintSetActivePrinter")
End If
If GdViewer1.PrintSetActivePrinter(CurPrinter) = False Then MessageBox.Show("The PrintSetActivePrinter() method has failed with the status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintSetActivePrinter")
Else
MessageBox.Show("The PrintGetPrintersCount() method has failed with the status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintSetActivePrinter")
End If
Else
MessageBox.Show("The PrintGetActivePrinter() method has failed with the status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintSetActivePrinter")
End If
//We assume that the GdViewer1 control has been properly integrated.
string message = "";
string CurPrinter = GdViewer1.PrintGetActivePrinter();
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
int PrintersCount = GdViewer1.PrintGetPrintersCount();
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
for (int i = 1; i <= PrintersCount; i++)
{
string PrinterName = GdViewer1.PrintGetPrinterName(i);
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
if (GdViewer1.PrintSetActivePrinter(PrinterName) == true)
{
System.Drawing.Printing.PrinterSettings prnSettings;
prnSettings = GdViewer1.PrintGetPrinterSettings();
if (GdViewer1.GetStat() == GdPictureStatus.OK)
message = message + "Printer: " + PrinterName + "\nSettings: " + prnSettings.ToString() + "\n\n";
else
message = message + "Printer: " + PrinterName + " Error getting settings: " + GdViewer1.PrintGetStat().ToString() + "\n";
}
else
break;
}
else
break;
}
if (GdViewer1.GetStat() == GdPictureStatus.OK)
MessageBox.Show(message, "GdViewer.PrintSetActivePrinter");
else
MessageBox.Show("The example has NOT been followed successfully. The last status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintSetActivePrinter");
if (GdViewer1.PrintSetActivePrinter(CurPrinter) == false)
MessageBox.Show("The PrintSetActivePrinter() method has failed with the status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintSetActivePrinter");
}
else
MessageBox.Show("The PrintGetPrintersCount() method has failed with the status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintSetActivePrinter");
}
else
MessageBox.Show("The PrintGetActivePrinter() method has failed with the status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintSetActivePrinter");