打印按钮未显示 [英] Print button not appearing

查看:65
本文介绍了打印按钮未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows应用程序中,我使用以下javascript代码打印datagridview'gvuserinfo'。

表单运行没有错误,但我看不到'print'按钮。与网页相同的JavaScript代码工作正常。如何解决这个问题?



In windows application I use the following javascript code to print a datagridview 'gvuserinfo'.
The form runs without error but I could not see the 'print' button. The same javascript code with web page works fine. How to solve this?

public MaterialsToBeReadyReport()
        {
con.ConnectionString = Constring;
InitializeComponent();
webBrowser1.DocumentText =
@"<html><head>
<script type='text/javascript'>
function PrintGridData() {
var prtGrid = document.getElementById('<%=gvUserInfo.ClientID %>');
prtGrid.border = 0;
var prtwin = window.open('', 'PrintGridViewData', 'left=100,top=100,width=500,height=500,tollbar=0,scrollbars=1,status=0,resizable=1');
prtwin.document.write(prtGrid.outerHTML);
prtwin.document.close();
prtwin.focus();
prtwin.print();
prtwin.close();
}
</script>
</head><body></body></html>";
webBrowser1.Document.InvokeScript("PrintGridData");

推荐答案

您无法在Windows中使用JavaScript代码表单 - 至少不是直接的。

您可以在html控件中运行JavaScript。
You cannot use JavaScript code in windows forms - at least not directly.
You can run JavaScript in an html control.


这篇关于打印按钮未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆