본문 바로가기
728x90
반응형

c#5

.NetCore 배포 폴더 만들기 C# .netcore3.1 배포 및 게시 방법 한번 알아봄 프로젝트 우클릭 후 게시 클릭 게시에서 폴더 클릭 후 다음 클릭 다음 게시에서도 폴더 클릭 후 다음 클릭 마침 클릭 게시 클릭 하면 프로젝트 빌드되기 시작함 빌드가 끝나면 해당 경로에 publish 폴더가 생성 되고 그 안에 프로젝트 생성됨 2023. 6. 12.
C# List Generic Struct/txt Save 리스트 배열 구조체 텍스트 저장 C#에서 Generic List를 텍스트 또는 구조체로 저장하는 방법 1. txt 저장 List val = new List(); private void test() { string time = DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss"); StreamWriter sw = new StreamWriter(time + ".txt"); for (int i = 0; i < val.Count; i++) { sw.Write(val[i]); } sw.Close(); } 위 방법으로 저장 시 for문이 돌기 때문에 배열 개수가 많을수록 시간이 많이 걸림 2. 구조체 저장 public struct DataList { public string data; } DataList dl = new.. 2022. 9. 29.
C# 텍스트 파일(txt) 쓰기 읽기 C#에서 사용가능 한 아주 간단한 txt 파일 읽기 쓰기 private void btn_Save_Click(object sender, RoutedEventArgs e) { string save_data = string.Format("{0},{1},{2},{3},{4},{5}", txt_X.Text, txt_Y.Text, txt_Z.Text, txt_A.Text, txt_B.Text, txt_C.Text); System.IO.File.WriteAllText("test.txt", save_data, Encoding.ASCII); string read = System.IO.File.ReadAllText("test.txt"); MessageBox.Show(read); } 버튼 클릭 시 데이터가 저장되고 저장된 .. 2022. 9. 27.
Vieworks Camera 연결 1PC 2Program 1대의 PC에서 카메라 여러 대를 연결한 후 2개의 프로그램으로 나누어 실행할 경우 1번 프로그램에서는 카메라가 연결되고 2번 프로그램에서는 카메라가 연결되지 않는 경우가 발생 아래의 코드에서 num 부분의 숫자를 차례대로 넣어야 하지만 프로그램을 2개로 나누어 중복되어 들어감 따라서 카메라가 4개인 경우 순서대로 0, 1, 2, 3로 넣어주어여함 Vieworks.VwGigE.VwOpenCameraByIndex(m_pvwGigE, num, ref pCamera, m_imagebuffernumber, 0, 0,0, MainWindow.m_pobjectInfo[num], ptrCallback, IntPtr.Zero); 끝 2022. 9. 21.
C#/WPF MainWindow Dual monitor setup 듀얼모니터 사용시 프로그램 화면 설정 MonitorCount 가 2 이상이면 설정가능 아래의 배열로 설정가능 AllScreens[0] AllScreens[1] if (System.Windows.Forms.SystemInformation.MonitorCount > 1) { System.Drawing.Rectangle secondaryScreenRectangle = System.Windows.Forms.Screen.AllScreens[0].WorkingArea; Window w = sender as Window; w.WindowState = WindowState.Normal; w.WindowStyle = WindowStyle.None; w.WindowStartupLocation = WindowStartupL.. 2022. 9. 16.
728x90
반응형