C#處理Paint事件的方法
更新時(shí)間:2015年06月11日 14:51:44 作者:zhuzhao
這篇文章主要介紹了C#處理Paint事件的方法,實(shí)例分析了C#使用Paint進(jìn)行圖形繪制的技巧,需要的朋友可以參考下
本文實(shí)例講述了C#處理Paint事件的方法。分享給大家供大家參考。具體方法如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication2
{
public partial class Form5 : Form
{
bool drawElipse = false;
public Form5()
{
InitializeComponent();
this.SetStyle(ControlStyles.ResizeRedraw, true);
}
private void Form5_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
this.drawElipse = !this.drawElipse;
this.Invalidate(true);
}
private void Form5_Paint(object sender, PaintEventArgs e)
{
if (!this.drawElipse) return;
Graphics g = e.Graphics;
g.FillEllipse(Brushes.DarkBlue, this.ClientRectangle);
}
}
}
希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。
相關(guān)文章
利用C#代碼實(shí)現(xiàn)圖片旋轉(zhuǎn)360度
本文介紹利用C#代碼實(shí)現(xiàn)圖片旋轉(zhuǎn)360度,具體實(shí)例代碼已附上,僅供大家參考,希望對(duì)大家有所幫助2016-11-11
在winform下實(shí)現(xiàn)左右布局多窗口界面的方法之續(xù)篇
這篇文章主要介紹了在winform下實(shí)現(xiàn)左右布局多窗口界面的方法之續(xù)篇 的相關(guān)資料,需要的朋友可以參考下2016-02-02
C#實(shí)現(xiàn)數(shù)字轉(zhuǎn)換
這篇文章主要為大家詳細(xì)介紹了C#實(shí)現(xiàn)數(shù)字轉(zhuǎn)換,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-04-04
C#中ToString數(shù)據(jù)類型格式大全(千分符)
這篇文章主要介紹了C#中ToString數(shù)據(jù)類型格式大全 千分符,需要的朋友可以參考下2017-02-02
C#數(shù)據(jù)結(jié)構(gòu)與算法揭秘二
上文對(duì)數(shù)據(jù)結(jié)構(gòu)與算法,有了一個(gè)簡(jiǎn)單的概述與介紹,這篇文章,我們介紹一中典型數(shù)據(jù)結(jié)構(gòu)——線性結(jié)構(gòu)2012-10-10
C#中控件動(dòng)態(tài)添加事件綁定的時(shí)機(jī)詳解
這篇文章主要給大家介紹了在C#中為控件動(dòng)態(tài)添加事件綁定的時(shí)機(jī)的相關(guān)資料,文中介紹的非常詳細(xì),對(duì)大家具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面跟著小編一起來(lái)學(xué)習(xí)學(xué)習(xí)吧。2017-06-06

