ASP.NET窗体对话框的实现(4)
2008-02-22 09:27:00来源:互联网 阅读 ()
在下列代码中,通过 Button 控件的 Click 事件调用 PrintPreviewDialog 控件。被打印文档在 Document 属性中指定。注意:代码中没有指定被打印文档。
本例假设存在名为 Button1 的 Button 控件,名为 myDocument 的 PrintDocument 组件和名为 PrintPreviewDialog1 的 PrintPreviewDialog 控件。
' Visual Basic
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
' The print document 'myDocument' used below
' is merely for an example.
' You will have to specify your own print document.
PrintPreviewDialog1.Document = myDocument
PrintPreviewDialog1.ShowDialog()
End Sub
// C#
private void button1_Click(object sender, System.EventArgs e)
{
// The print document 'myDocument' used below
// is merely for an example.
// You will have to specify your own print document.
printPreviewDialog1.Document = myDocument;
printPreviewDialog1.ShowDialog()
}
小结
.NET 框架里包含了 Windows 用户所熟悉的各种公共对话框,于是在应用程序中提供交互功能变得更加容易。通常,对话框的用途是多种多样的;.NET 框架对此提供了开放支持,你可以选择最佳方案以适合应用程序的需要。我们介绍了与对话框组件有关的一些简单应用。你可以直接使用这些代码,也可以对其稍加修改用于你的应用程序。
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:ASP.NET中的状态管理
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash
