hi expert
i created a classLibrary that inherited from Button
i Override the Onpaint event for this button to create a gradiant rectangle for this button
my code is
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassLibrary1
{
public class Class1 :Button
{
public Class1()
{
this.Size = new Size(100, 20);
this.Location = new Point(0, 0);
}
protected override void OnPaint(PaintEventArgs pevent)
{
pevent.Graphics.Clear(this.Parent.BackColor);
Rectangle rect = new Rectangle(new Point(this.Location.X, this.Location.Y), new Size(this.Width, this.Height));
LinearGradientBrush lgrad = new LinearGradientBrush(rect, Color.Red, Color.Blue, LinearGradientMode.BackwardDiagonal);
pevent.Graphics.FillRectangle(lgrad, rect);
lgrad.Dispose();
}
}
}
i have 2 problem
first my text on the button isn't show !!
and last when my button is at location (0,0) my gradiant shows successfully but when the location was changed my gradiant rectangle shows unormally
i upload my program at flowing location
please see that and ghelp me
regards
link :
http://www.esnips.com/doc/e074814e-9...ustomizeButton