如何像图表一样创建图片 [英] how to create a picture like a chart
本文介绍了如何像图表一样创建图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我需要帮助..我正在创建如下a,b和c所示的图像。我想创建如下图所示的图像,带有Y轴图例和X轴图例的必需图像标题。
i need help.. i am creating image as shown below as a,b and c. and i want to create image as shown below with Required Image Heading with Y-axis legend and X-axis Legend.
请指导我一下用C#表格做怎么做
kindly guide me what to do and how to do in C# forms
提前谢谢
问候
推荐答案
您好,
您可以添加标签来做这个,非常简单。你也可以直接画画。代码供您参考。
You can add label to do this, that is very simply. you can also drawing directly. Code for your reference.
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = this.CreateGraphics();
Bitmap bm = new Bitmap(System.Environment.CurrentDirectory + "\\sample1.PNG");
g.DrawImage(bm, 100, 100, bm.Size.Width , bm.Height);
//draw legend x
for (int i = 0; i*50 <= bm.Width; i++)
{
g.DrawString(i.ToString() , new Font("verdana", 12, FontStyle.Bold), new SolidBrush(Color.Black), 100 + i*50, 100+ bm.Height +10);
}
//draw legend y
for (int i = 0; i * 50 <= bm.Height; i++)
{
if(i!=0)
g.DrawString(i.ToString(), new Font("verdana", 12, FontStyle.Bold), new SolidBrush(Color.Black), 100-20, 100 +bm.Height- i * 50);
}
}
希望这可以是对你有帮助。
Hope this can be helpful to you.
Bob
这篇关于如何像图表一样创建图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文