【发布时间】:2009-08-24 19:25:26
【问题描述】:
作为我上一个问题的后续,我已经获得了我的区域,但在过去的两个小时里试图仅显示该区域的小图片;最终目标是能够任意显示我选择的任意数量的图像。 到目前为止,这是我的代码:
void OnPaintRadar(Object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Bitmap blip = new Bitmap(tst_Graphics.Properties.Resources.dogtag);
Rectangle radar_rect = new Rectangle(myRadarBox.Left + 80, myRadarBox.Left + 7, myRadarBox.Width - 200, myRadarBox.Height + 200);
using (Pen drw_pen = new Pen(Color.White, 1) )
{
using (GraphicsPath path = new GraphicsPath())
{
path.AddPie(radar_rect, 180, 180);
path.CloseFigure();
using (Region rdRegion = new Region(path) )
{
g.DrawPath(drw_pen, path);
g.Clip = rdRegion;
PictureBox pb = new PictureBox();
pb.Image = (blip);
pb.Size = blip.Size;
g.DrawImage(blip, radar_rect);
}
}
}
}// end paint method
我也尝试过 DrawImageUnscaled 方法,但我要么把我的小图片炸掉以填充饼图区域,要么什么都不显示。
【问题讨论】: