Get it on Google Play


Wm뮤 :: 윈폼 오류 모음

블로그 이미지
가끔 그림그리거나 3D모델링하거나
취미로 로봇만드는
퇴직한 전자과 게임프로그래머
2020.3.48f1 , 2022.3.6f1 주로 사용
모카쨩
@Ahzkwid

Recent Comment

Archive


2023. 7. 25. 09:18 윈도우폼

 

 

 

 

------------------------------------------------------------------------------------------------------------------------------

모든 차트 영역 요소의 위치를 계산하기 전에는 PositionToValue 메서드를 호출할 수 없습니다

PositionToValue method cannot be called prior to calculating position of all chart area elements.

 

 

MouseMove 이벤트중에 PixelPositionToValue를 호출해서 발생했는데

아래와 같이 HitTest를 먼저 진행해서 하면 해결된다

var result = chart.HitTest(e.X, e.Y);
if (result.ChartArea != null)
{
    var xValue = chartArea.AxisX.PixelPositionToValue(e.X);
}

 

 

 

------------------------------------------------------------------------------------------------------------------------------

System.ArgumentException: '이름이 '차트이름'인 차트 요소를 'SeriesCollection'에서 찾을 수 없습니다.'

chart.ChartAreas[0].CursorX.SetCursorPixelPosition(mousePosition, true);

할때 발생했는데 이거도 역시 이벤트 충돌로 인해 발생한 결과로 다음과 같이 수정했다


//X커서 표시(실수)
{
    var x = mousePosition.X;
    x = Math.Max(0, x);
    x = Math.Min(x, chart.Width);
    double xValue = chart.ChartAreas[0].AxisX.PixelPositionToValue(x);
    chart.ChartAreas[0].CursorX.Position = xValue;
    position = chart.ChartAreas[0].CursorX.Position;
}

 

 

 

 

 

 

 

 

 

 

 

 

'윈도우폼' 카테고리의 다른 글

윈도우용 대화형 프로그램 설정  (0) 2023.09.26
C# 환경변수 설정  (0) 2022.02.16
잘 안 쓰는 윈폼코드 모음  (0) 2021.07.19
posted by 모카쨩

  • total
  • today
  • yesterday

Recent Post

저사양 유저용 블로그 진입