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 WindowsApplication65
{
public class Button1 : Button
{
protected override void OnPaint(PaintEventArgs pevent)
{
base.OnPaint(pevent);
Graphics gh = pevent.Graphics;
Color c1 = Color.FromArgb(0x000000);
Color c2=Color.FromArgb(0xffffff);
Point p1=new Point(5,5);
Point p2=new Point(10,10);
Brush bs = new LinearGradientBrush(p1, p2, c1, c2);
gh.FillEllipse(bs, 50, 50, 30, 20);
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
怎么没变化,想把button画成个椭圆,然后在有渐变
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 WindowsApplication65
{
public class Button1 : Button
{
protected override void OnPaint(PaintEventArgs pevent)
{
base.OnPaint(pevent);
Graphics gh = pevent.Graphics;
Color c1 = Color.FromArgb(0x000000);
Color c2=Color.FromArgb(0xffffff);
Point p1=new Point(5,5);
Point p2=new Point(10,10);
Brush bs = new LinearGradientBrush(p1, p2, c1, c2);
gh.FillEllipse(bs, 50, 50, 30, 20);
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
怎么没变化,想把button画成个椭圆,然后在有渐变
解决方案 »
- c# 执行exe程序,的要命问题。
- Scrolling时图像有明显的闪烁和延迟,
- WPF多窗口切换,任务栏总显示是来回切换
- 一个很奇怪的问题--datagridview
- net2003c# windows编程datagrid的合并单元格.急!!!
- C#进行Windows窗体编程的问题
- 请问能否在局域网监视他人post或get提交的地址
- 这个问题好简单哟,C# 关于TreeView问题?
- 在数据库里存放整个图片,而不是路径。当我在TREEVIEW里点击一个产品节点,要在IMAGE里显示图片。点击不同产品,显示对应的图片。如何定
- Google翻译api如何批量翻译
- 如何释放反射后的文件?
- 有没有办法用xmlhttp做自动表单提交
gp.AddEllip(0,0,100,50);
Button.Range = gp;
就行了
关键是Button的Range属性的使用!
gp.AddEllip(0,0,100,50);
Button.Range = gp;
就行了
===============
Range 没有找到这个属性Form1里也没看你用Button1啊。
================
在From1.D....cs里是你的顏色范圍有問題﹐試試將c1,c2換成別的顏色。
========================
换了,从绿色到红色也不行,我刚才用了一下纯色的也不行啊,哪位给个代码把。