PaperSize 构造函数 (String, Int32, Int32)

初始化 PaperSize 类的新实例。

 

命名空间:  System.Drawing.Printing
程序集:  System.Drawing(在 System.Drawing.dll 中)

 
public PaperSize(
	string name,
	int width,
	int height
)
参数
name
类型: System.String
纸张名称。
width
类型: System.Int32
纸张宽度,以百分之一英寸为单位。
height
类型: System.Int32
纸张高度,以百分之一英寸为单位。

使用此构造函数创建的 PaperSize 始终将其 Kind 属性设置为 Custom 只能为自定义 PaperSize 对象设置 Width  Height 属性值。

下面的代码示例用打印机支持的纸张大小填充 comboPaperSize 组合框。 此外,创建自定义纸张大小并将它添加到组合框中。 PaperName 被标识为一种属性,该属性将向通过组合框的DisplayMember 属性添加的项提供显示字符串。 该示例假定名为 printDoc 的变量 PrintDocument 和特定的组合框都已存在。

 
            // Add list of supported paper sizes found on the printer. 
            // The DisplayMember property is used to identify the property that will provide the display string.
            comboPaperSize.DisplayMember = "PaperName";

            PaperSize pkSize;
            for (int i = 0; i < printDoc.PrinterSettings.PaperSizes.Count; i++){
                pkSize = printDoc.PrinterSettings.PaperSizes[i];
                comboPaperSize.Items.Add(pkSize);
            }

            // Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
            PaperSize pkCustomSize1 = new PaperSize("First custom size", 100, 200);

            comboPaperSize.Items.Add(pkCustomSize1);


转载于:https://www.cnblogs.com/smallsoftfox/archive/2012/06/27/2566334.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值