splitcontainer.panel 내에 웹 브라우저 컨트롤을 구현하는 데 이상한 문제가 있습니다. 위의 오류가 발생합니다. splitcontainer.panel 외부에서 가져 오는 동일한 코딩을 시도했습니다. 모두 잘 작동합니다.splitcontainer.panel 내의 WebBrowser Doubleclick에서 오류가 발생합니다. System.Runtime.InteropServices.COMException HRESULT : 0x800A025E
웹 페이지를로드 할 때 웹 페이지에서 단어를 클릭 할 것으로 예상되면 두 번 클릭 한 단어를 선택하여 메시지 상자에 표시해야합니다.
우리 전문가 중 누구라도이 문제를 해결해 주시면 감사하겠습니다.
PS : range1.select()
업데이트에서 그것의 충돌 : 여기
public partial class Form1 : Form
{
public static string lbname;
public WebBrowser br1 = new WebBrowser();
public WebBrowser br2 = new WebBrowser();
public Form1()
{
InitializeComponent();
}
private void button1_Click_1(object sender, System.EventArgs e)
{
var tab = new TabPage("1");
tabControl1.Controls.Add(tab);
tabControl1.SelectedTab = tab;
tab.Select();
var pnl = new Panel();
tab.Controls.Add(pnl);
pnl.Controls.Add(br1);
Uri url1 = new Uri("http://www.google.com");
br1.Url = url1;
br1.DocumentCompleted += Browser1_DocumentCompleted;
}
private void Browser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
br1.Document.DetachEventHandler("ondblclick", Document_DoubleClick);
br1.Document.AttachEventHandler("ondblclick", Document_DoubleClick);
}
private void Document_DoubleClick(object sender, EventArgs e)
{
IHTMLDocument2 doc1 = br1.Document.DomDocument as IHTMLDocument2;
IHTMLSelectionObject currentSelection = doc1.selection;
if (currentSelection != null)
{
IHTMLTxtRange range1 = currentSelection.createRange() as IHTMLTxtRange;
if (range1 != null)
{
range1.expand("word");
range1.select();
MessageBox.Show("selected text" + range1.text);
}
}
}
===== 물론 난 이미 MSHTML을 참조 있고, SHDOCVW가 splitcontainer.panel 제외하고 노력하고 있기 때문이다.