Re: [問題] 繪圖與部分繪圖

看板C_Sharp作者 (ideaupsoho)時間17年前 (2009/02/13 18:59), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/4 (看更多)
我把某個program 的程式, 列出 Image mapImage; Bitmap map; Graphics graph,xgraph; =========Form--Load---Event need Add xgraph=pictureBox1.CreateGraphics(); ww=pictureBox1.Width; hh=pictureBox1.Height; src=dest=new Rectangle(0, 0, ww, hh); map=new Bitmap(ww, hh); mapImage=Image.FromHbitmap(map.GetHbitmap()); graph=Graphics.FromImage(mapImage); } private void pictureBox1_Paint(object sender, PaintEventArgs e) { if (mapImage==null) return; try { e.Graphics.DrawImage(mapImage, dest, src, GraphicsUnit.Pixel); } catch(Exception ) { throw; } } private void pictureBox1_Resize(object sender, EventArgs e) { if (mapImage==null) return; int wd=pictureBox1.Width, ht=pictureBox1.Height; SetSize(wd,ht); dest=new Rectangle(0, 0, wd, ht); if (xgraph==null) game.xgraph=pictureBox1.CreateGraphics(); xgraph.DrawImage(mapImage, dest, src, GraphicsUnit.Pixel); } Timer_Click() { //在graph上 draw, fill 各樣rectangle, ellipse, xgraph.DrawImage(mapImage, dest, src, GraphicsUnit.Pixel); } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.114.246.17
文章代碼(AID): #19bLALNE (C_Sharp)
文章代碼(AID): #19bLALNE (C_Sharp)