Get it on Google Play


Wm뮤 :: 잘 안 쓰는 윈폼코드 모음

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

Recent Comment

Archive


2021. 7. 19. 11:36 윈도우폼

 

 

 

 

비프

System.Console.Beep();

 

 

 

차트에 가로선 긋기

근데 너무 후져서 안 씀

var stripLine = new StripLine();
stripLine.Interval = 0; //0으로 설정하여 축 전체에 걸쳐 가로선을 그립니다
stripLine.IntervalOffset = value; // 가로선의 y값
stripLine.StripWidth = (chart.ChartAreas[0].AxisY.Maximum - chart.ChartAreas[0].AxisY.Minimum )/ chart1.ClientSize.Height * 8; // 가로선의 두께


stripLine.BackColor = color; // 가로선의 색상
stripLine.IntervalOffsetType = DateTimeIntervalType.Number;
chart.ChartAreas[0].AxisY.StripLines.Add(stripLine);

 

 

 

차트 그래디언트 배경


{
    //그래디언트 배경
    chart1.ChartAreas[0].AxisY.StripLines.Clear();

    var count = 4;
    var colorDepth =10;
    for (int i = 0; i < count; i++)
    {
        var stripLine = new StripLine();
        stripLine.Interval = 0; // 가로선 간격 (0으로 설정하여 축 전체에 걸쳐 가로선을 그립니다)
        stripLine.StripWidth = 0.5 / count;
        stripLine.IntervalOffset = 0.5 + stripLine.StripWidth * i; // 가로선의 y값
        var gradiantColor = 255 - colorDepth + (colorDepth / count) * i;
        stripLine.BackColor = Color.FromArgb(gradiantColor, 255, gradiantColor); // 가로선의 색상
        stripLine.IntervalOffsetType = DateTimeIntervalType.Number; // y축 값의 타입 (Number로 설정)
        chart1.ChartAreas[0].AxisY.StripLines.Add(stripLine);
    }
    for (int i = 0; i < count; i++)
    {
        var stripLine = new StripLine();
        stripLine.Interval = 0; // 가로선 간격 (0으로 설정하여 축 전체에 걸쳐 가로선을 그립니다)
        stripLine.StripWidth = 0.5 / count;
        stripLine.IntervalOffset = 1 + stripLine.StripWidth * i; // 가로선의 y값
        var gradiantColor = 255 - colorDepth + (colorDepth / count) * (count-1-i);
        stripLine.BackColor = Color.FromArgb(255, gradiantColor, gradiantColor); // 가로선의 색상
        stripLine.IntervalOffsetType = DateTimeIntervalType.Number; // y축 값의 타입 (Number로 설정)
        chart1.ChartAreas[0].AxisY.StripLines.Add(stripLine);
    }
    {
        var stripLine = new StripLine();
        stripLine.Interval = 0; // 가로선 간격 (0으로 설정하여 축 전체에 걸쳐 가로선을 그립니다)
        stripLine.StripWidth = 0.01; 
        stripLine.IntervalOffset = 1.5; // 가로선의 y값
        stripLine.BackColor = Color.Red; // 가로선의 색상
        stripLine.IntervalOffsetType = DateTimeIntervalType.Number; // y축 값의 타입 (Number로 설정)
        chart1.ChartAreas[0].AxisY.StripLines.Add(stripLine);
    }
    {
        var stripLine = new StripLine();
        stripLine.Interval = 0; // 가로선 간격 (0으로 설정하여 축 전체에 걸쳐 가로선을 그립니다)
        stripLine.StripWidth = 0.01; 
        stripLine.IntervalOffset = 0.5 - stripLine.StripWidth; // 가로선의 y값
        stripLine.BackColor = Color.Green; // 가로선의 색상
        stripLine.IntervalOffsetType = DateTimeIntervalType.Number; // y축 값의 타입 (Number로 설정)
        chart1.ChartAreas[0].AxisY.StripLines.Add(stripLine);
    }
}

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

C# 환경변수 설정  (0) 2022.02.16
DLL 생성 예제  (0) 2021.02.11
윈폼 키보드마우스  (0) 2021.01.17
posted by 모카쨩

  • total
  • today
  • yesterday

Recent Post

저사양 유저용 블로그 진입