---
title: "How to call Form_Paint event on button click event?"  
description: "How to call Form_Paint event on button click event?"  
author: "Anonymous User"  
published: 2012-07-16  
updated: 2012-07-21  
canonical: https://www.mindstick.com/forum/424/how-to-call-form_paint-event-on-button-click-event  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to call Form_Paint event on button click event?

Hi All,

I'm facing a [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) since last night actually I want to [invoke](https://www.mindstick.com/interview/983/how-will-you-invoke-any-external-process-in-java) **Form_Paint** [event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) on **[button click](https://www.mindstick.com/forum/790/form-gets-submiited-twice-on-button-click) event** but I didn't getting a proper solution so far. Please [resolve](https://www.mindstick.com/forum/159427/windows-app-dll-not-found-resolve-library-issue) my problem as soon as possible.

## Replies

### Reply by Anonymous User

Hi Tanuj Kumar,\
If you want to invoke Form_Paint event on [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) [click event](https://www.mindstick.com/forum/12705/how-to-implement-click-event-on-textbox) then you have to write code in such way:**\**

```
public void draw(object sender, PaintEventArgs e)        {            try            {                using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, Color colr1, Color colr2, LinearGradientMode.Vertical))                {                    e.Graphics.FillRectangle(brush, ClientRectangle);                }            }            catch (Exception ex)            {                MessageBox.Show(ex.Message);            }        }private void btnApply_Click(object sender, EventArgs e)        {            Paint += draw;            Invalidate();        }
```

**\
I hope it might be resolve your problem.\**


---

Original Source: https://www.mindstick.com/forum/424/how-to-call-form_paint-event-on-button-click-event

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
