Click here to Skip to main content
15,914,795 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can u please help me out how to code for an eraser and for multiple colors(such as in ms-paint)?
How to change the mouse pointer to pen n brush when we click on those corresponding buttons?

Any one please reply me else please at-least give me an idea.
Posted
Updated 20-Jul-10 22:55pm
v2

Mouse pointer is easy: Cursor = new Cursor(...); (see MSDN for details, there are four different constructors based on how you store your cursor shape).

Coding for multiple colours / eraser is a bit harder, and depends on how you are storing and dispalying your images.
 
Share this answer
 
FillEraser in picture box mouse move event

private void FillEraser(object sender, MouseEventArgs e)
{
if (pctFundusMain.Image != null)
{
if (e.Button == MouseButtons.Left)
{
PictureBox thisform = (PictureBox)sender;
Graphics g = thisform.CreateGraphics();
var pen = new Pen(Color.White, 5);
pen.Width = FixEraserThickness();
// new SolidBrush(Color.White);
_bitmap = new Bitmap(pctFundusMain.Image);
g = Graphics.FromImage(_bitmap);
var cursorLocation = new Point(e.X + 5, e.Y + 5);
// g.DrawLine(pen, e.X, e.Y, e.X + 5, e.Y + 5);
g.DrawLine(pen, pe, cursorLocation);
pctFundusMain.Image = _bitmap;
pe = cursorLocation;
}
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900