0
我使用WFA和C#,並試圖在包含圖像的圖片框頂部繪製一個橢圓。這裏是我的代碼,但目前它的繪圖在PB後面。在圖像的頂部繪圖WFA
private void Form1_Paint(object sender, PaintEventArgs e)
{
PictureBox pb=new PictureBox();
pb.Location=new Point(10,25);
pb.BackgroundImage = Image.FromFile("fire2_clipped_rev_1.png");
pb.Size = Image.FromFile("fire2_clipped_rev_1.png").Size;
Truck.TruckF(pb.Location, pb.CreateGraphics());
pb.Invalidate();
Controls.Add(pb);
}
static Image truckf = Image.FromFile("fire2_clipped_rev_1.png");
public static void TruckF(Point location, Graphics e)
{
Wheels(truckf.Size,location,e);
}
private static void Wheels(Size simage,Point location,Graphics e)
{
e.FillEllipse(Brushes.Black, location.X/6F, location.Y/1.43F, 20, 20);
}
您正在創建一個新的PictureBox,每次你的表單描繪。你確定你要這麼做嗎? – geedubb
它現在非常重要,它是應用程序的早期版本,我現在只需要知道如何在圖像上繪製圖像,如果需要的話,我也可以控制它 – user2390564