/// <summary> /// 刷新按钮状态 /// </summary> private void RefreshToolBar() { BeginUpdate(); try { mshtml.IHTMLDocument2 document = (mshtml.IHTMLDocument2)webBrowserBody.Document.DomDocument; cboFontName.Text = document.queryCommandValue("FontName").ToString(); cboFontSize.SelectedItem = FontSize.Find((int)document.queryCommandValue("FontSize")); btnBold.Checked = document.queryCommandState("Bold"); btnItalic.Checked = document.queryCommandState("Italic"); btnUnderline.Checked = document.queryCommandState("Underline"); btnNumbers.Checked = document.queryCommandState("InsertOrderedList"); btnBullets.Checked = document.queryCommandState("InsertUnorderedList"); btnLeft.Checked = document.queryCommandState("JustifyLeft"); btnCenter.Checked = document.queryCommandState("JustifyCenter"); btnRight.Checked = document.queryCommandState("JustifyRight"); btnFull.Checked = document.queryCommandState("JustifyFull"); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e); } finally { EndUpdate(); } }