This method retrieves a list of supported resolutions for the printer designated by the printer name.
Parameters
Name | Explanation |
---|---|
XResolutions | An array containing the list of retrieved X resolutions |
YResolutions | An array containing the list of retrieved Y resolutions |
* NOTE for retrieving array values: In Visual Basic, if the array is defined as Dim XRes(0 To 2) As Integer, then the arguments are returned in XRes(0). In Visual C++, pass the pointer to the first element in the array. In VB.NET, the arguments are returned in XRes(0). In C#.NET, the arguments are returned in XRes[0]. |
Return Value
Returns the number of retrieved items. Returns 0 if unsuccessful.
Explanation
The EnumResolutions method retrieves a list of supported resolutions for the printer designated by the printer name. If you need to know the number of elements in the array, the GetArrayNum method can be used to retrieve this. The XResolutions and YResolutions parameters contains the retrieved (horizontal and vertical) resolution values in units of dots per inch (dpi)
For scripting languages, other programs that require variant types, or when using 64 bit builds in VB.NET or C#, please refer to the EnumResolutionsVariant method.
Sample code:
Visual Basic
Dim Size As Long
Dim XResolutions() As Long
Dim YResolutions() As Long
Dim Ret As Long
ImageKit1.PrintDraw.PrinterName = "EPSON LP-8200C"
Size = ImageKit1.PrintDraw.GetArrayNum(2)
If Size < 1 Then Exit Sub
ReDim XResolutions(Size)
ReDim YResolutions(Size)
Ret = ImageKit1.PrintDraw.EnumResolutions(XResolutions(0), YResolutions(0))
' various programming code
..............
Visual C++
long Size;
long *XResolutions;
long *YResolutions;
ImageKit1.GetPrintDraw().SetPrinterName("EPSON LP-8200C");
Size = ImageKit1.GetPrintDraw().GetArrayNum(2);
if (Size < 1) return;
XResolutions = (long *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(long) * Size);
YResolutions = (long *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(long) * Size);
__try {
ImageKit1.GetPrintDraw().EnumResolutions(XResolutions, YResolutions);
// various programming code
..............
} __finally {
HeapFree(GetProcessHeap(), 0, XResolutions);
HeapFree(GetProcessHeap(), 0, YResolutions);
}
VB.NET
Dim Size As Integer
Dim Ret As Integer
ImageKit1.PrintDraw.PrinterName = "EPSON LP-8200C"
Size = ImageKit1.PrintDraw.GetArrayNum(2)
If Size < 1 Then Exit Sub
Dim XResolutions As Integer() = New Integer(Size - 1) {}
Dim YResolutions As Integer() = New Integer(Size - 1) {}
Ret = ImageKit1.PrintDraw.EnumResolutions(XResolutions(0), YResolutions(0))
' various programming code
..............
C#.NET
ImageKit1.PrintDraw.PrinterName = "EPSON LP-8200C";
// When using the ANSI version, ImageKit10ALib.PrinterCapabilityConstants.ikPrinterResolution
Size = ImageKit1.PrintDraw.GetArrayNum(ImageKit10Lib.PrinterCapabilityConstants.ikPrinterResolution);
if (Size < 1) return;
int Ret;
int[] XResolutions = new int[Size];
int[] YResolutions = new int[Size];
Ret = ImageKit1.PrintDraw.EnumResolutions(ref XResolutions[0], ref YResolutions[0]);
// various programming code
..............