본문 바로가기

SoftWare/Visual C#33

파이썬 c# 연동 IronPython var engine = IronPython.Hosting.Python.CreateEngine(); var scope = engine.CreateScope(); var paths = engine.GetSearchPaths(); /* paths.Add(@".\python"); paths.Add(@".\python\venv"); paths.Add(@".\python\venv\Lib"); paths.Add(@".\python\venv\Lib\site-packages"); paths.Add(@"D:\OneDrive\2.CREEDSOFT\1.PrintCheckVision\Source\LineTrigger\LineTrigger\Lib"); */ paths.Add(@"C:\Python27"); paths.Add(@"C.. 2021. 11. 28.
C# <-> JSP (Tomcat) 간 파일 업로드 C# public static string UploadFilesToRemoteUrl(string url, string[] files, NameValueCollection formFields = null) { try { string boundary = "----------------------------" + DateTime.Now.Ticks.ToString("x"); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.ContentType = "multipart/form-data; boundary=" + boundary; request.Method = "POST"; request.KeepAlive = true; Stream m.. 2018. 9. 8.
C# RTSP Client Demo - 삼성 Camera SNH-P6410BN 유선 : rtsp://192.168.0.139:554/profile2/media.smp무선 : rtsp://192.168.0.139:554/profile2/media.smp외부 : rtsp://bwsmiwon.iptime.org:554/profile2/media.smprtsp://admin:1234@192.168.0.139:554/profile2/media.smp 2017. 8. 12.
C# 우선순위 큐 Heap.cs class Heap { int _lastIndex = -1; int _capacity = 0; HeapItem[] _array = new HeapItem[0]; public bool IsEmpty{get {return _lastIndex == -1;}} public int RemainItems { get { return _lastIndex + 1; } } public Heap() { } public void InsertItem(HeapItem item) { if(_lastIndex +1 == _capacity) { _capacity += 2; Array.Resize(ref _array, _capacity); } _array[++_lastIndex] = item; int currentPosi.. 2014. 9. 20.
병렬처리 Parallel.For(0, 249999, (i) =>{ rename_file(i + ".tif", i + "B.tif"); Console.WriteLine(i + ".tif" + " -> " + i + "B.tif");}); 2013. 3. 18.
C# TextBox 컨트롤+A Ctrl+A 동작하게 하기.. protected override bool ProcessDialogKey(Keys keyData) { switch (keyData) { case Keys.A | Keys.Control: if (this.ActiveControl is TextBox) { TextBox txt = (TextBox)this.ActiveControl; txt.SelectionStart = 0; txt.SelectionLength = txt.Text.Length; return true; } break; } return base.ProcessDialogKey(keyData); } 2012. 9. 13.
C# 코드 시간 측정하기 Stopwatch sw = new Stopwatch(); sw.Start(); --------코드------------- sw.Stop(); Debug.WriteLine("시간 : " + sw.ElapsedMilliseconds.ToString() + "ms"); 2011. 12. 30.
C# WPF 핸들 사용하기 IntPtr mainWindowPtr = new WindowInteropHelper(this).Handle; HwndSource mainWindowSrc = HwndSource.FromHwnd(mainWindowPtr); mainWindowSrc.CompositionTarget.BackgroundColor = Color.FromArgb(0, 0, 0, 0); http://msdn.microsoft.com/ko-kr/library/ms748975.aspx 2011. 11. 3.
C# 시리얼통신 소스 System.IO.Ports.SerialPort serialPort1 = new System.IO.Ports.SerialPort(); Thread Thread_Serial = null; int[] Platform_iEncoder = new int[4]; public bool Serial_Init() { try { serialPort1.ReadTimeout = 200; serialPort1.BaudRate = 115200; serialPort1.PortName = "COM1"; serialPort1.RtsEnable = true; serialPort1.Open(); serialPort1.DiscardInBuffer(); serialPort1.DiscardOutBuffer(); //Thread_SerialA.. 2011. 8. 11.
MSChart 사용하기 http://www.microsoft.com/downloads/ko-kr/details.aspx?familyid=130f7986-bf49-4fe5-9ca8-910ae6ea442c&displaylang=ko 2011. 7. 28.
C# 더블버퍼링 사용하기 컨트롤에 더블버퍼링 사용 방법 this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); 2010. 9. 11.
C# Form간의 Data 공유.. //GraphicForm 생성자 private Form1 wnd = null; public GraphicForm(Form1 wnd) { InitializeComponent(); this.wnd = wnd; } public GraphicForm m_graphic = null; private GraphicForm_Show() { if (!m_graphic.Created) { m_graphic = new GraphicForm(this); m_graphic.MdiParent = this; m_graphic.Show(); } } 2010. 8. 9.
C# Thread 사용하기 Thread _thread=null; private void Thread_APC() { if (!(_thread== null)) _thread.Abort(); //TiroShow Thread 리소스 해제 _thread= new Thread(Thread_Proc); _thread.Start(); } private void Thread_Proc() { } 2010. 6. 26.
C# Thread 에서 UI 또는 Control 접근하기 Visual Studio 2008 Sp1 개발환경이다.. Visual Studio 2005 까지만해도 Thread에서 Control을 접근하면 Warring 은 있었지만 Error는 없었다.. 하지만 2008 Sp1 부터 바뀐듯하다.. Realse 로는 Error가 나지 않지만 디버깅을 하면 Error 가 생긴다. 해결방법 -> this.Invoke(new MethodInvoker(delegate() { 여기서 컨트롤을 사용하면된다~~ })); 2010. 5. 27.
C# TextBox Auto Scroll txtDebug.Select(txtDebug.TextLength, 0); txtDebug.ScrollToCaret(); 2009. 12. 16.