Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using GDI object inplace of buttons

Status
Not open for further replies.

kehers

Programmer
Aug 31, 2005
56
A2
is there any way i can use GDI objects like rectangles, strings,etc, call a onClick event handler..as in simulating window.forms.buttons?
 
Create a class that extends Button and just handle the paint event.

public class MyButton : System.Windows.Forms.Button
{
public MyButton()
{
InitializeComponents();
this.Paint += new PaintEventHandler(MyButton_Paint);
}

private void MyButton_Paint(object sender, PaintEventArgs e)
{
//Do your GDI+ Drawing here using e.Graphics.
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top