[問題] 請問為何無法畫圖...
我看書上的範例:
using ~~~(省)
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
GraphicsPath gp = new GraphicsPath(); // GraphicsPath物件
Point p1 = new Point(10, 20); // 直線的兩端
Point p2 = new Point(100, 20);
gp.AddLine(p1, p2); // 將 直線 加入到 GraphicsPath物件
gp.CloseFigure(); // 先封閉 第一條直線
Point p3 = new Point(10, 50); // 直線的兩端
Point p4 = new Point(100, 50);
gp.AddLine(p3, p4); // 將第二條直線 加入到 GraphicsPath物件
e.Graphics.DrawPath(Pens.Black, gp); // 繪出GraphicsPath物件
}
}
}
我很好奇why我們都沒有call 畫圖的那個method 就是arguments中有
(object sender, PaintEventArgs e) 那行的程式 他就會自動執行所以可以畫圖
到底是誰call 那行程式導致可以畫圖??
最重要的是...
我也是按照
*********************************************************************
using ~~ 一堆一堆
namespace test001
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void paint_f(object sender, PaintEventArgs e)
{
GraphicsPath paint = new GraphicsPath();
........一堆
e.Graphics.DrawCurve(pen, pt);
}
}
}
去做 就不會自動畫圖 / \ 好幾天了 好悶阿
請高手指點
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.115.155.193
→
08/23 23:08, , 1F
08/23 23:08, 1F
→
08/23 23:11, , 2F
08/23 23:11, 2F
→
08/23 23:11, , 3F
08/23 23:11, 3F
→
08/23 23:11, , 4F
08/23 23:11, 4F
→
08/23 23:12, , 5F
08/23 23:12, 5F
→
08/23 23:14, , 6F
08/23 23:14, 6F
→
08/23 23:14, , 7F
08/23 23:14, 7F
→
08/23 23:15, , 8F
08/23 23:15, 8F
→
08/23 23:15, , 9F
08/23 23:15, 9F
→
08/23 23:19, , 10F
08/23 23:19, 10F
→
08/23 23:20, , 11F
08/23 23:20, 11F
→
08/23 23:21, , 12F
08/23 23:21, 12F
→
08/23 23:24, , 13F
08/23 23:24, 13F
→
08/23 23:25, , 14F
08/23 23:25, 14F
→
08/23 23:28, , 15F
08/23 23:28, 15F
→
08/23 23:30, , 16F
08/23 23:30, 16F
→
08/23 23:32, , 17F
08/23 23:32, 17F
→
08/23 23:36, , 18F
08/23 23:36, 18F
→
08/23 23:36, , 19F
08/23 23:36, 19F
→
08/23 23:37, , 20F
08/23 23:37, 20F
→
08/23 23:40, , 21F
08/23 23:40, 21F
→
08/23 23:41, , 22F
08/23 23:41, 22F
→
08/23 23:42, , 23F
08/23 23:42, 23F
→
08/23 23:42, , 24F
08/23 23:42, 24F
→
08/23 23:43, , 25F
08/23 23:43, 25F
→
08/23 23:43, , 26F
08/23 23:43, 26F
→
08/23 23:44, , 27F
08/23 23:44, 27F
→
08/23 23:48, , 28F
08/23 23:48, 28F
→
08/23 23:52, , 29F
08/23 23:52, 29F
→
08/23 23:56, , 30F
08/23 23:56, 30F
→
08/24 00:01, , 31F
08/24 00:01, 31F
→
08/24 00:02, , 32F
08/24 00:02, 32F
→
08/24 00:03, , 33F
08/24 00:03, 33F
→
08/24 00:04, , 34F
08/24 00:04, 34F
→
08/24 00:05, , 35F
08/24 00:05, 35F
→
08/24 00:05, , 36F
08/24 00:05, 36F
→
08/24 00:07, , 37F
08/24 00:07, 37F
→
08/24 00:13, , 38F
08/24 00:13, 38F
→
08/24 00:15, , 39F
08/24 00:15, 39F
→
08/24 00:15, , 40F
08/24 00:15, 40F
→
08/24 00:16, , 41F
08/24 00:16, 41F
→
08/24 00:19, , 42F
08/24 00:19, 42F
→
08/24 00:20, , 43F
08/24 00:20, 43F
→
08/24 00:20, , 44F
08/24 00:20, 44F
→
08/24 00:24, , 45F
08/24 00:24, 45F
→
08/24 00:24, , 46F
08/24 00:24, 46F
→
08/24 00:25, , 47F
08/24 00:25, 47F
→
08/24 00:25, , 48F
08/24 00:25, 48F
→
08/24 00:28, , 49F
08/24 00:28, 49F
→
08/24 00:29, , 50F
08/24 00:29, 50F
→
08/24 00:38, , 51F
08/24 00:38, 51F
→
08/24 00:38, , 52F
08/24 00:38, 52F
→
08/24 00:40, , 53F
08/24 00:40, 53F
→
08/24 00:41, , 54F
08/24 00:41, 54F
→
08/24 00:46, , 55F
08/24 00:46, 55F
→
08/24 00:47, , 56F
08/24 00:47, 56F
→
08/24 00:48, , 57F
08/24 00:48, 57F
→
08/24 00:48, , 58F
08/24 00:48, 58F
→
08/24 00:49, , 59F
08/24 00:49, 59F
→
08/24 00:50, , 60F
08/24 00:50, 60F
→
08/24 01:12, , 61F
08/24 01:12, 61F
→
08/24 01:13, , 62F
08/24 01:13, 62F
→
08/24 01:14, , 63F
08/24 01:14, 63F
→
08/24 01:15, , 64F
08/24 01:15, 64F
→
08/24 01:16, , 65F
08/24 01:16, 65F
→
08/24 01:24, , 66F
08/24 01:24, 66F
→
08/24 01:25, , 67F
08/24 01:25, 67F
→
08/24 01:26, , 68F
08/24 01:26, 68F
→
08/24 01:27, , 69F
08/24 01:27, 69F
→
08/24 01:28, , 70F
08/24 01:28, 70F
→
08/24 01:28, , 71F
08/24 01:28, 71F
→
08/24 01:36, , 72F
08/24 01:36, 72F
→
08/24 02:35, , 73F
08/24 02:35, 73F
→
08/24 02:36, , 74F
08/24 02:36, 74F
→
08/24 02:36, , 75F
08/24 02:36, 75F
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章