chenjianye1989
chenjianye1989
2015-04-21 00:11

C# 多线程 webbrowser 调用不显示

  • c#

private void OnCalc(LatLng val)
{
m_position = val;

        Object[] list = { this, System.EventArgs.Empty };
        //this.label1.BeginInvoke(new EventHandler(lableClick), list);            
        this.webBrowser1.BeginInvoke(new EventHandler(webBrowser1show), list); 

    }

private void webBrowser1show(object sender, EventArgs e)
{
if (this.IsHandleCreated)
{
//调用JavaScript的函数,并传入参数
object[] objects_Position = new object[2];
objects_Position[0] = m_position.Lng;
objects_Position[1] = m_position.Lat;
webBrowser1.Document.InvokeScript("line", objects_Position);

                object[] objects_Angle = new object[1];
                objects_Angle[0] = _wheelAngle;
                webBrowser1.Document.InvokeScript("setRotation", objects_Angle);
                this.timer1.Enabled = true;
            }

        }
 在这里书写代码片  
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答

为你推荐