public void Drawgrid(System.Windows.Forms.Panel panel, int xstart, int ystart, int Yquantity, int Xquantity)
{
int height = panel.Height;
int width = panel.Width;
m_BaseRGBbmp = new Bitmap(width, height);
Graphics grp = Graphics.FromImage(m_BaseRGBbmp);
Pen p = new Pen(Color.FromArgb(80,100,100,100));
float dx = 1.0f * width / Xquantity;
float dy = 1.0f * height / Yquantity;
List<PointF> vecxp = new List<PointF>();// 가로축 그리기
List<PointF> vecyp = new List<PointF>();// 세로축 그리기
//X=0축 그리기
vecxp.Add(new PointF(xstart - 3, height - ystart));
vecxp.Add(new PointF(width, height - ystart));//
grp.DrawLines(Pens.Black, vecxp.ToArray());
for (int i = 0; i < Yquantity+1;i++ )//
{
vecxp.Clear();
vecxp.Add(new PointF(xstart, height - i * dy));
vecxp.Add(new PointF(width, height - i * dy));
grp.DrawLines(p, vecxp.ToArray());
}
vecyp.Add(new PointF(xstart, height - ystart));
vecyp.Add(new PointF(xstart, 0));
grp.DrawLines(Pens.Black, vecyp.ToArray());
for (int i = 0; i < Xquantity; i++)
{
if (i % 10 == 0)
{
vecyp.Clear();
vecyp.Add(new PointF(xstart + i * dx, height - ystart));
vecyp.Add(new PointF(xstart + i * dx, 0));
Trace.WriteLine(xstart + i * dx +":"+Convert.ToString(350 +i * 0.5) );
grp.DrawLines(p, vecyp.ToArray());
}
}
panel.BackgroundImage = (Image)m_BaseRGBbmp;
}
'프로그래밍 > C#' 카테고리의 다른 글
C# Color scale Wavelength to RGB (0) | 2013.03.22 |
---|---|
C# 이전에 그린 Chart Panel에 XValue YValue 표시하기 (0) | 2013.03.22 |
lock in amplifier 원리 (0) | 2012.07.20 |
C# C++ 마샬링? 랩핑?.. (0) | 2012.06.20 |
C++ PInvoke를 사용하여 함수 포인터 마샬링 (0) | 2012.06.08 |