C# 绘图 程序编译正常但无法绘制图形

本人C#小白,在VS2017 .net framework 4.5的环境下编译正常,但无法绘制图形图片说明
麻烦各位大佬帮忙看看哪里出了问题

 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HelloWinForm
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // Sets g to a graphics object representing the drawing surface of the
            // control or form g is a member of.

        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics; //创建画板,这里的画板是由Form提供的.
            Pen p = new Pen(Color.Blue, 2);//定义了一个蓝色,宽度为的画笔
            g.DrawLine(p, 10, 10, 100, 100);//在画板上画直线,起始坐标为(10,10),终点坐标为(100,100)
            g.DrawRectangle(p, 10, 10, 100, 100);//在画板上画矩形,起始坐标为(10,10),宽为,高为
            g.DrawEllipse(p, 10, 10, 100, 100);//在画板上画椭圆,起始坐标为(10,10),外接矩形的宽为,高为
        }
    }
}

我的可以 - -
1.你form的的paint事件里加了以上函数了么 点form 属性 事件 找到 paint
2.不报错有什么警告么
我也是小白 你可以试试以上方法

你的代码我一个字母都没动!图片说明
而且还有一个问题,你把它写在Form_Pain事件里是很消耗资源的。

Graphics g = e.Graphics;
改成
Graphics g;//放在方法外
g=this.CreateGraphics();//放在构造内
试试
实在还不行就重写OnPaint()把绘图代码放onpaint()里,光看你这些代码不知道你有没有注册事件

你这个窗体是不是有面板,看看属性,代码是可以的,不行就新建一个窗体或项目

虽然过了很久,还是很感谢楼上几位的提醒。。