public Form1() { InitializeComponent(); p = new Picture(g); Paint += new PaintEventHandler(OnPaint); panel = new PaintPanel(); panel.Location = new System.Drawing.Point(96, 41); panel.Size = new System.Drawing.Size(631, 510); panel.Parent = this; panel.BackColor = Color.White; g = panel.CreateGraphics(); panel.MouseDown += panel1_MouseDown_1; panel.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; p.g = g; p.gcontrol = panel; panel.Resize += Form1_Resize; tcolor = Color.Black; }
public Form1() { InitializeComponent(); p = new Picture(g); Paint += new PaintEventHandler(OnPaint); panel = new PaintPanel(); panel.Location = new System.Drawing.Point(96, 41); panel.Size = new System.Drawing.Size(631, 510); panel.Parent = this; panel.BackColor = Color.White; g = panel.CreateGraphics(); panel.MouseDown += panel1_MouseDown_1; panel.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; p.g = g; p.gcontrol = panel; panel.Resize += Form1_Resize; tcolor = Color.Black; }
private void Form1_Resize(object sender, EventArgs e) { g = panel.CreateGraphics(); p.g = g; }