Printer.Width 属性

获取或设置页的宽度。

命名空间:  Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6
程序集:  Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

语法

声明
Public Property Width As Integer
public int Width { get; set; }
public:
property int Width {
    int get ();
    void set (int value);
}
member Width : int with get, set
function get Width () : int
function set Width (value : int)

属性值

类型:System.Int32
返回一个 Integer。

备注

对于 Printer 对象, Height 和 Width 属性。 twips 始终为单位;它们返回打印设备当前设置使用文档的实体大小。 如果设置在运行时,这些特性的值使用而不是设置 PaperSize 属性。

如果设置不允许这些属性设置的打印机驱动程序的 Height 和 Width 属性,则不会发生任何错误。 文档的大小保持不变。

如果设置不允许该值的打印机驱动程序的一个 Height 或 Width 值,则不会发生任何错误。 属性设置为该驱动程序允许的值。 例如,您可以将 Height 为 150,并且该驱动程序将将其设置为 144。

备注

Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 命名空间中的函数和对象是提供给用于将 Visual Basic 6.0 升级到 Visual Basic 的工具使用的。大多数情况下,这些函数和对象可再现 .NET Framework 中其他命名空间的功能。只有 Visual Basic 6.0 代码模型与 .NET Framework 实现有显著区别时才需要这些函数和对象。

示例

下面的示例演示如何检索 Height 和 Width 属性值。

Dim Printer As New Printer
Dim nHeight As Integer = Printer.Height
Dim nWidth As Integer = Printer.Width
Printer.Print("Paper size is " & CStr(nHeight) & " by " _
    & CStr(nWidth) & " twips")
Printer.EndDoc()

.NET Framework 安全性

请参见

参考

Printer 类

Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 命名空间

其他资源

打印机兼容性库

如何:使用打印机兼容性库修复升级错误 (Visual Basic)

部署引用打印机兼容性库的应用程序