본문 바로가기
다양한 실전소스코드/WPF(C#)

[Solved] C# WPF WebBrowser에 사이트 띄우기

by aibattle 2021. 6. 29.
728x90
반응형

아래의 코드로, xaml의 webBrowser 컨트롤에 원하는 웹사이트를 띄울수있다

<WebBrowser   x:Name="web_1"  />
 
 
Dispatcher.Invoke(new Action(() =>
            {
                string add1 = @"http://www.kmedinfo.co.kr/news/articleList.html?sc_section_code=S1N4&view_type=sm";
                web_1.Navigate(add1);
            }));
cs

 

나 아래와 같이 원하는 사이트를 한번에 볼때도 쓰고, 여러가지로 쓴다.

 

 

아래처럼 하면 마우스를 올리면 해당 신문이 크게보이겠지.....

private void Border_news1_MouseEnter(object sender, MouseEventArgs e)
{
this.web_grid1.Width = new GridLength(1100);
this.web_grid2.Width = new GridLength(50, GridUnitType.Star);
this.web_grid3.Width = new GridLength(50, GridUnitType.Star);
}
 
private void Border_news2_MouseEnter(object sender, MouseEventArgs e)
{
this.web_grid1.Width = new GridLength(50, GridUnitType.Star);
this.web_grid2.Width = new GridLength(1100);
this.web_grid3.Width = new GridLength(50, GridUnitType.Star);
}
 
private void Border_news3_MouseEnter(object sender, MouseEventArgs e)
{
this.web_grid1.Width = new GridLength(50, GridUnitType.Star);
this.web_grid2.Width = new GridLength(50, GridUnitType.Star);
this.web_grid3.Width = new GridLength(1100);
}
 
cs
728x90
반응형

댓글