private void print_btn_Click(object sender, EventArgs e) { OnPrintClick(EventArgs.Empty); object em = null; GF.showLoading((this.Parent as Panel).Parent as Form); using (AxSHDocVw.AxWebBrowser wb = new AxSHDocVw.AxWebBrowser()) { wb.CreateControl(); wb.Left = -1000; wb.Top = -1000; wb.Navigate(Properties.Settings.Default.webserver_url + url); for (; wb.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE;) { System.Windows.Forms.Application.DoEvents(); } GF.closeLoading(); try { SHDocVw.OLECMDF eQuery = wb.QueryStatusWB(SHDocVw.OLECMDID.OLECMDID_PAGESETUP); wb.ExecWB(SHDocVw.OLECMDID.OLECMDID_PAGESETUP, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER, ref em, ref em); wb.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER, ref em, ref em); } catch (Exception err) { MessageBox.Show(err.Message); } } }
void MenuFile_Click(object sender, EventArgs e) { // Query the status of the Save As command SHDocVw.OLECMDF saveAsQuery = Browser.QueryStatusWB(SHDocVw.OLECMDID.OLECMDID_SAVEAS); // If the command is currently allowed (enabled), enable // the menu item; if not, disable it MenuFileSaveAs.Enabled = ((saveAsQuery & SHDocVw.OLECMDF.OLECMDF_ENABLED) != 0) ? true : false; }
void PrintButton_Click(object sender, EventArgs e) { // Query the status of the print command SHDocVw.OLECMDF printQuery = Browser.QueryStatusWB(SHDocVw.OLECMDID.OLECMDID_PRINT); // If the command is enabled, display the print dialog if ((printQuery & SHDocVw.OLECMDF.OLECMDF_ENABLED) != 0) { Browser.ExecWB( SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER ); } }