Click here to Skip to main content
15,922,696 members
Home / Discussions / C#
   

C#

 
AnswerRe: Help with PictureBox.image updating from Webcam capture Pin
shutupsquare16-Jan-10 10:08
shutupsquare16-Jan-10 10:08 
GeneralRe: Help with PictureBox.image updating from Webcam capture Pin
Luc Pattyn16-Jan-10 11:05
sitebuilderLuc Pattyn16-Jan-10 11:05 
GeneralRe: Help with PictureBox.image updating from Webcam capture Pin
shutupsquare16-Jan-10 12:56
shutupsquare16-Jan-10 12:56 
GeneralRe: Help with PictureBox.image updating from Webcam capture Pin
Luc Pattyn16-Jan-10 13:03
sitebuilderLuc Pattyn16-Jan-10 13:03 
Questionencapsulation understanding problems Pin
binn01916-Jan-10 6:41
binn01916-Jan-10 6:41 
AnswerRe: encapsulation understanding problems PinPopular
Jimmanuel16-Jan-10 7:11
Jimmanuel16-Jan-10 7:11 
GeneralRe: encapsulation understanding problems Pin
binn01924-Jan-10 0:02
binn01924-Jan-10 0:02 
QuestionNeed help with drawing circles on mouse click event in pictureBox Pin
Midex16-Jan-10 5:49
Midex16-Jan-10 5:49 
AnswerRe: Need help with drawing circles on mouse click event in pictureBox Pin
Luc Pattyn16-Jan-10 6:13
sitebuilderLuc Pattyn16-Jan-10 6:13 
AnswerRe: Need help with drawing circles on mouse click event in pictureBox Pin
Dan Mos16-Jan-10 7:53
Dan Mos16-Jan-10 7:53 
QuestionBackgroundWorker with anonymous methods ? Pin
Mohammad Dayyan16-Jan-10 4:06
Mohammad Dayyan16-Jan-10 4:06 
AnswerRe: BackgroundWorker with anonymous methods ? Pin
Nicholas Butler16-Jan-10 4:59
sitebuilderNicholas Butler16-Jan-10 4:59 
GeneralRe: BackgroundWorker with anonymous methods ? Pin
Mohammad Dayyan16-Jan-10 6:58
Mohammad Dayyan16-Jan-10 6:58 
QuestionHolding data in memory Pin
Bardy8516-Jan-10 0:22
Bardy8516-Jan-10 0:22 
AnswerRe: Holding data in memory Pin
OriginalGriff16-Jan-10 1:01
mveOriginalGriff16-Jan-10 1:01 
GeneralRe: Holding data in memory Pin
Bardy8516-Jan-10 1:16
Bardy8516-Jan-10 1:16 
GeneralRe: Holding data in memory Pin
N a v a n e e t h16-Jan-10 6:05
N a v a n e e t h16-Jan-10 6:05 
GeneralRe: Holding data in memory Pin
Dan Mos16-Jan-10 7:21
Dan Mos16-Jan-10 7:21 
GeneralRe: Holding data in memory Pin
Bardy8516-Jan-10 9:21
Bardy8516-Jan-10 9:21 
GeneralRe: Holding data in memory Pin
Luc Pattyn16-Jan-10 10:05
sitebuilderLuc Pattyn16-Jan-10 10:05 
GeneralRe: Holding data in memory Pin
Bardy8516-Jan-10 10:56
Bardy8516-Jan-10 10:56 
GeneralRe: Holding data in memory [modified] Pin
Dan Mos16-Jan-10 11:01
Dan Mos16-Jan-10 11:01 
GeneralRe: Holding data in memory Pin
Bardy8516-Jan-10 9:28
Bardy8516-Jan-10 9:28 
GeneralRe: Holding data in memory Pin
Dan Mos16-Jan-10 10:48
Dan Mos16-Jan-10 10:48 
QuestionSystem.Drawing.Graphics Problem Pin
logicon15-Jan-10 23:17
logicon15-Jan-10 23:17 
Hi All,

Its been quite a long time since I am stuck with this problem. I am writing an application in which user selects a portion of picture box and rest part (apart from selection) is filled with white color.

Now Problem is that FillRectange fill area more that what is selected. For example here is code to fill from 0,0 of image to first node of rectangular selection:

        private void picItem_MouseDown(object sender, MouseEventArgs e)<br />
        {<br />
            // Starting point of the selection:<br />
            if (e.Button == MouseButtons.Left)<br />
            {<br />
                _selecting = true;<br />
                _selection = new Rectangle(new Point(e.X, e.Y), new Size());<br />
            }<br />
        }<br />
<br />
        private void picItem_MouseUp(object sender, MouseEventArgs e)<br />
        {<br />
            if (e.Button == MouseButtons.Left && _selecting)<br />
            {<br />
                Rectangle cropRect = _selection; <br />
<br />
                using (Graphics g = Graphics.FromImage(picItem.Image))<br />
                {<br />
                    g.FillRectangle(Brushes.White, new Rectangle(0, 0, _selection.X, _selection.Y));<br />
                }<br />
<br />
                picItem.Refresh();<br />
                _selecting = false;<br />
            }<br />
        }<br />
<br />
        private void picItem_MouseMove(object sender, MouseEventArgs e)<br />
        {<br />
            // Update the actual size of the selection:<br />
            if (_selecting)<br />
            {<br />
                    _selection.Width = e.X - _selection.X;<br />
                    _selection.Height = e.Y - _selection.Y;<br />
<br />
                // Redraw the picturebox:<br />
                picItem.Refresh();<br />
<br />
                lblLocation.Text = "Height = " + _selection.Height.ToString() + ", Width = " <br />
                                   + _selection.Width.ToString();<br />
            }<br />
        }


Can anyone tell me why this is happening please?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.