110,538
社区成员
发帖
与我相关
我的任务
分享
private void panel1_Paint_1(object sender, PaintEventArgs e)
{
Graphics g1 = e.Graphics;
if (image != null)
{
if (c == 0)
{
g1.DrawImage(image, new RectangleF(groupBox2.Width, 500, image.Width, Convert.ToSingle((image.Height * sb1 * 1.0))));
}
else if (c == 1)
{
g1.DrawImage(image, new RectangleF(groupBox2.Width, 200, this.panel1.Width, Convert.ToSingle((image.Height * sb1 * 1.0))));
}
}
if (image2 != null)
{
if (c == 0)
{
g1.DrawImage(image2, new RectangleF(groupBox2.Width, 400, image2.Width, Convert.ToSingle((image2.Height * sb1 * 1.0))));
}
else if (c == 1)
{
g1.DrawImage(image2, new RectangleF(0, this.panel1.Height / 3, this.panel1.Width, Convert.ToSingle((image2.Height * sb1 * 1.0))));
}
}
if (image3 != null)
{
if (c == 0)
{
g1.DrawImage(image3, new RectangleF(groupBox2.Width, 700, image3.Width, Convert.ToSingle((image3.Height * sb1 * 1.0))));
}
else if (c == 1)
{
g1.DrawImage(image3, new RectangleF(0, this.panel1.Height / 3 * 2, this.panel1.Width, Convert.ToSingle((image3.Height * sb1 * 1.0))));
}
}
}
if (c == 0)
{
image = new Bitmap(this.panel1.Width / 30 * (j / 5 + 1), 200);
image2 = new Bitmap(this.panel1.Width / 30 * (j / 5 + 1), 200);
image3 = new Bitmap(this.panel1.Width / 30 * (j / 5 + 1), 200);
}
else if (c == 1)
{
image = new Bitmap(this.panel1.Width, 200);
image2 = new Bitmap(this.panel1.Width, 200);
image3 = new Bitmap(this.panel1.Width, 200);
}
Graphics g = Graphics.FromImage(image);
g.SmoothingMode = SmoothingMode.AntiAlias;
//g1.Clear(this.panel1.BackColor);
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.TranslateTransform(1, 10);
g.CompositingQuality = CompositingQuality.HighQuality;
Pen p = new Pen(Color.Red, 1);//定义了一个红色,宽度为1的画笔
g.DrawLines(p, list2.ToArray());
p.Dispose();
g.Dispose();
Graphics gg = Graphics.FromImage(image);
gg.TranslateTransform(1, 10);
Pen pp = new Pen(Color.Green, 1);//定义了一个红色,宽度为1的画笔
gg.SmoothingMode = SmoothingMode.AntiAlias;
//g1.Clear(this.panel1.BackColor);
gg.InterpolationMode = InterpolationMode.HighQualityBicubic;
gg.CompositingQuality = CompositingQuality.HighQuality;
gg.TranslateTransform(1, 10);
gg.DrawLines(pp, list22.ToArray());
pp.Dispose();
gg.Dispose();
Graphics ggg = Graphics.FromImage(image);
Pen ppp = new Pen(Color.Blue, 1);//定义了一个红色,宽度为1的画笔
ggg.SmoothingMode = SmoothingMode.AntiAlias;
//g1.Clear(this.panel1.BackColor);
ggg.InterpolationMode = InterpolationMode.HighQualityBicubic;
ggg.CompositingQuality = CompositingQuality.HighQuality;
// p = new Pen(Color.Red, 1);//定义了一个红色,宽度为1的画笔
ggg.TranslateTransform(1, 10);
ggg.DrawLines(ppp, list222.ToArray());
ppp.Dispose();
ggg.Dispose();
this.panel1.Invalidate();
private void panel1_Paint_1(object sender, PaintEventArgs e)
{
Graphics g1 = e.Graphics;
if (image != null)
{
if (c == 0)
{
g1.DrawImage(image, new RectangleF(100, 100, 200, 300));
}
else if (c == 1)
{
g1.DrawImage(image, new RectangleF(groupBox2.Width, 200, this.panel1.Width, Convert.ToSingle((image.Height * sb1 * 1.0))));
}
}
if (image2 != null)
{
if (c == 0)
{
g1.DrawImage(image2, new RectangleF(100, 500, 200, 300));
}
else if (c == 1)
{
g1.DrawImage(image2, new RectangleF(0, this.panel1.Height / 3, this.panel1.Width, Convert.ToSingle((image2.Height * sb1 * 1.0))));
}
}
if (image3 != null)
{
if (c == 0)
{
g1.DrawImage(image3, new RectangleF(100, 700, 200, 300));
}
else if (c == 1)
{
g1.DrawImage(image3, new RectangleF(0, this.panel1.Height / 3 * 2, this.panel1.Width, Convert.ToSingle((image3.Height * sb1 * 1.0))));
}
}
}
RectangleF(float x, float y, float width, float height);
y值不对