Click here to Skip to main content
15,923,222 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
am doing coding in C#

am having an container image on the page
now after executing i must able to put crossmark on that image(to show the damages)
or draw cross mark like we draw in paint with paint brush

and after that i must able to save the changed image in database

plz help

tnX in advance
Posted
Comments
Sergey Alexandrovich Kryukov 14-Jun-11 2:13am    
So, what's your question? Any effort?
--SA

Assuming you are using a PictureBox or similar container, then drawing a cross on it is pretty easy:
using (Graphics g = Graphics.FromImage(myPictureBox.Image))
{
    using (Pen p = Pens.Red)
    {

        Point TLHC = new Point(0, 0);
        Point BRHC = new Point(myPictureBox.Image.Width, myPictureBox.Image.Height);
        g.DrawLine(p, new Point(TLHC.X, TLHC.Y), new Point( BRHC.X, BRHC.Y));
        g.DrawLine(p, new Point(TLHC.X, BRHC.Y), new Point(BRHC.X, TLHC.Y));
    }
}
Saving it back to the database is the same method you original used to get in into the database in the first place, but with a UPDATE command instead of INSERT.
 
Share this answer
 
Comments
SK, The Boss 14-Jun-11 5:17am    
protected void imgcon_Click(object sender, ImageClickEventArgs e)
{
try
{
// X coordinate from click argument
int x = e.X;

// Y coordinate from click argument
int y = e.Y;
btnfin.Visible = true;

if (((x >= 1) && (x <= 150)) && ((y >= 0) && (y <= 299)))
{
xcord = Convert.ToString(x);
ycord = Convert.ToString(y);
lblpart.Text = "Damage in ''Left Back Door of Container''";
part = lblpart.Text;
}
else if (((x >= 500) && (x <= 650)) && ((y >= 0) && (y <= 299)))
{
xcord = Convert.ToString(x);
ycord = Convert.ToString(y);
lblpart.Text = "Damage in ''Right Back Door of Container''";
part = lblpart.Text;
}
else if (((x >= 248) && (x <= 403)) && ((y >= 90) && (y <= 216)))
{
xcord = Convert.ToString(x);
ycord = Convert.ToString(y);
lblpart.Text = "Damage in ''Front Door of Container''";
part = lblpart.Text;
}
else
{
xcord = Convert.ToString(x);
ycord = Convert.ToString(y);
lblpart.Text = "Damage in ''Roof/FloorBoard of Container''";
part = lblpart.Text;
}

lblcord.Text = "Do u want to finalize the X ( " + xcord + " ) and Y ( " + ycord + " ) Coordinates ??? If 'Yes' then click on Finalize else select the coordinates again...";
}
catch (Exception ex)
{
lbler.Visible = true;
lbler.Text = ex.Message;
}

}
OriginalGriff 14-Jun-11 5:26am    
Yes - and? It's code. The relevance?
OriginalGriff 14-Jun-11 5:27am    
From OP, posted as an answer:

"it is showing error

plz help"

I have deleted the answer and moved it to a comment.
OriginalGriff 14-Jun-11 5:28am    
What error is it showing?
SK, The Boss 14-Jun-11 7:35am    
plz help

i hv taken imagebutton not image...sorry for incomplete info
 
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