如何将EventArgs转换为PaintEventArgs,C#

如何将EventArgs转换为PaintEventArgs,C#,c#,winforms,onpaint,C#,Winforms,Onpaint,我想在调用MCU\u timer\u Tick()时调用OnPaint()。 我该怎么办 private void MCU_timer_Tick(object sender, EventArgs e) { ... } protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; int width = 30; i

我想在调用MCU\u timer\u Tick()时调用OnPaint()。 我该怎么办

    private void MCU_timer_Tick(object sender, EventArgs e)
    {
        ...
    }
    protected override void OnPaint(PaintEventArgs e)
    {
      Graphics g = e.Graphics;

      int width = 30;
      int x, y;
      x = 150;
      y = 530;
      double color_max;
      color_max = 255;
      SolidBrush aBrush_1 = 
        new SolidBrush(Color.FromArgb(100, 255, 
        (int)(255 * color_map[0] / color_max), 0)); //color_map[0] is real value
      g.FillEllipse(aBrush_1, x-100, y, width * 2, width);
勾选事件中调用
this.Invalidate()
。这将最终使油漆事件发生

private void MCU_timer_Tick(object sender, EventArgs e)
{
    this.Invalidate();
}
其中
指的是
控件
。通常在
勾选
事件中调用
this.Invalidate()
表单。这将最终使油漆事件发生

private void MCU_timer_Tick(object sender, EventArgs e)
{
    this.Invalidate();
}
其中
指的是
控件
。通常是
表单