에러 메시지
Additional information: Cross-thread operation not valid: Control 'textbox1'
accessed from a thread other than the thread it was created on.
결과 찾은 곳
http://stackoverflow.com/questions/10775367/cross-thread-operation-not-
valid-control-textbox1-accessed-from-a-thread-othe
//내가 해결한 소스
delegate void SetTextCallback(string text,TextBox t);
private void SetText(string text, TextBox t)
{
// InvokeRequired required compares the thread ID of the
// calling thread to the thread ID of the creating thread.
// If these threads are different, it returns true.
if (t.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetText);
this.Invoke(d, new object[] { text,t });
}
else
{
t.Text = text;
}
}
SetText(Math.Round(color.GetHue(),1).ToString(), textBox_h);
SetText(Math.Round((color.GetSaturation() * 255.0f), 0).ToString(), textBox_s);
SetText(Math.Round((color.GetBrightness() * 255.0f), 0).ToString(), textBox_v);
'컴퓨터 과학 & 영상처리 관련 > C# / .NET / JAVA' 카테고리의 다른 글
바이트 배열 문자열로 변환 (0) | 2014.02.12 |
---|---|
종료 버튼 이벤트 처리하기 (0) | 2014.02.12 |
작업 표시줄 깜빡거리게 하기 + 폴더 열기 (0) | 2013.07.09 |
c# 해당 폴더의 하위 폴더를 얻어오기 DirectoryInfo 클래스 (0) | 2013.04.22 |
c# 파일 크기 확인 (0) | 2012.12.07 |