I have a program with multiple forms. From Form1 I want to open Form2 and simultanously display a graphic (some lines), but I get only a blank form. I can only get the graphic displayed if I click on a button, but I need it to appear without intervention. How can I do it?
Here is the code for the second form:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace WindowsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
CenterToScreen();
}
private void Form2_Load(object sender, EventArgs e)
{
Graphics g = this.CreateGraphics();
Pen p = new Pen(Color.SaddleBrown, 15);
g.DrawLine(p, 40, 400, 200, 400);
g.DrawLine(p, 80, 400, 80, 90);
g.DrawLine(p, 73, 90, 300, 90);