Click here to Skip to main content
15,905,419 members
Home / Discussions / C#
   

C#

 
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?
AnswerRe: System.Drawing.Graphics Problem Pin
OriginalGriff15-Jan-10 23:34
mveOriginalGriff15-Jan-10 23:34 
GeneralRe: System.Drawing.Graphics Problem Pin
logicon16-Jan-10 0:38
logicon16-Jan-10 0:38 
GeneralRe: System.Drawing.Graphics Problem Pin
OriginalGriff16-Jan-10 0:54
mveOriginalGriff16-Jan-10 0:54 
QuestionAdd an Item to a ListView in VitualMode ? Pin
Mohammad Dayyan15-Jan-10 22:48
Mohammad Dayyan15-Jan-10 22:48 
AnswerRe: Add an Item to a ListView in VitualMode ? Pin
MumbleB16-Jan-10 5:41
MumbleB16-Jan-10 5:41 
GeneralRe: Add an Item to a ListView in VitualMode ? Pin
Mohammad Dayyan16-Jan-10 6:52
Mohammad Dayyan16-Jan-10 6:52 
QuestionDirectX Support In C#.Net Pin
ashwath197915-Jan-10 20:10
ashwath197915-Jan-10 20:10 
AnswerMessage Closed Pin
15-Jan-10 20:49
stancrm15-Jan-10 20:49 
GeneralRe: DirectX Support In C#.Net Pin
ashwath197916-Jan-10 0:32
ashwath197916-Jan-10 0:32 
GeneralMessage Closed Pin
16-Jan-10 1:02
stancrm16-Jan-10 1:02 
GeneralRe: DirectX Support In C#.Net Pin
ashwath197916-Jan-10 1:10
ashwath197916-Jan-10 1:10 
GeneralRe: DirectX Support In C#.Net Pin
#realJSOP16-Jan-10 1:21
professional#realJSOP16-Jan-10 1:21 
QuestionUser Interface for Windows Form Pin
sjs4u15-Jan-10 18:21
sjs4u15-Jan-10 18:21 
AnswerRe: User Interface for Windows Form Pin
N a v a n e e t h15-Jan-10 18:38
N a v a n e e t h15-Jan-10 18:38 
AnswerRe: User Interface for Windows Form Pin
Abhinav S15-Jan-10 19:51
Abhinav S15-Jan-10 19:51 
QuestionHow to retrieve lost email password Pin
CoderForEver15-Jan-10 17:28
CoderForEver15-Jan-10 17:28 
AnswerRe: How to retrieve lost email password Pin
Dave Kreskowiak15-Jan-10 18:42
mveDave Kreskowiak15-Jan-10 18:42 

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.