728x90
반응형
|
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Web.UI.HtmlControls;
using System.Reflection;
using System.Speech.Synthesis;
using Microsoft.Win32;
//참조가 잘 기억안나서 대충 적엇는데
// 위에서필요한것 쓰면된다. 아마 2번째줄..
//아래와 같이 윈도우 위치를 셋팅해줄 함수를 사용하겠다고 함수 외부에 선언
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
//아래는, 버튼을 클릭하면 크롬이 다른 윈도우에 뜬다.
// 소스에 있는건, 주식의 종목값을 읽어서, 해당종목관련된 어떤 정보를 띄워주는것이다.
private void Button_Click_8(object sender, RoutedEventArgs e)
{
DataRowView dataRow = (DataRowView)datagrid_Stock1.SelectedItem;
string site1 = dataRow.Row.ItemArray[0].ToString();
//프로세스를 시작하고,
Process p = new Process();
p.StartInfo.FileName = "chrome.exe";
p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
p.StartInfo.Arguments = "https://finance.naver.com/item/main.nhn?code=" + site1;
p.Start();
//핸들을 얻어서, 윈도 위치를 옮겨준다.
//이때 앞에 0,0이 좌표인데, 모니터 듀얼의 크기에서 절대좌표값을 넣으면된다.
//필자는 두번째 모니터가 좌측에 있고, 0,0을 넣어서 왼쪽에 있는 1000 * 800 크기의 모니터에 창을 띄웠다.
IntPtr id = p.MainWindowHandle;
MoveWindow(p.MainWindowHandle, 0, 0, 1000, 800, true);
this.Focus();
}
|
cs |
728x90
반응형
'다양한 실전소스코드 > WPF(C#)' 카테고리의 다른 글
[Solved] C# WPF Other Window Show (다른 Window 띄우기 ) (0) | 2021.06.29 |
---|---|
[Solved] C# WPF DataGrid Selected Chang Error , DataGrid Load Error (0) | 2021.06.28 |
[Solved] C# WPF RichTextBox Value to MSSQL DB (RichTextbox내용을 String으로) (0) | 2021.06.28 |
[Solved] C# WPF Thread Join 사용방법 (쓰레드 완료까지 대기) (0) | 2021.06.27 |
[Solved] C# WPF Width Height Length Set in code (Xmal 50* 값 입력 방법) (0) | 2021.06.27 |
댓글