Click here to Skip to main content
15,895,283 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# 2.0 Windows Service - Memory Leak? Pin
Pete O'Hanlon31-May-10 21:42
mvePete O'Hanlon31-May-10 21:42 
GeneralRe: C# 2.0 Windows Service - Memory Leak? Pin
SarahMcM1-Jun-10 12:22
SarahMcM1-Jun-10 12:22 
AnswerRe: C# 2.0 Windows Service - Memory Leak? Pin
#realJSOP1-Jun-10 0:06
mve#realJSOP1-Jun-10 0:06 
GeneralRe: C# 2.0 Windows Service - Memory Leak? Pin
SarahMcM1-Jun-10 12:21
SarahMcM1-Jun-10 12:21 
AnswerRe: C# 2.0 Windows Service - Memory Leak? Pin
PIEBALDconsult1-Jun-10 4:03
mvePIEBALDconsult1-Jun-10 4:03 
GeneralRe: C# 2.0 Windows Service - Memory Leak? Pin
SarahMcM1-Jun-10 12:13
SarahMcM1-Jun-10 12:13 
AnswerRe: C# 2.0 Windows Service - Memory Leak? Pin
SarahMcM1-Jun-10 15:19
SarahMcM1-Jun-10 15:19 
Questionhow about erasing trace of Rectangle? [modified] Pin
sonic74731-May-10 17:59
sonic74731-May-10 17:59 
hello..
this program is based of C# and WPF
i draw Rectangle as mouse
but this program get stain of Rectangle
i want to disply without leaving any trace of Rectangle..

help me..
im sorry short english..

Screen Capture Image DownLoad
////////////////source///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Drawing;

namespace rectTest
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

        System.Drawing.Rectangle myRec;
        System.Windows.Point firstPoint;

        bool flg = false;
        private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            flg = true;
            firstPoint = e.GetPosition(mainwin);
            myRec = new System.Drawing.Rectangle((int)firstPoint.X, (int)firstPoint.Y, 0, 0);
        }

        private void mainwin_MouseMove(object sender, MouseEventArgs e)
        {
            if (flg == true)
            {
                System.Windows.Point currentPoint;
                currentPoint = e.GetPosition(mainwin);

                double width = currentPoint.X - firstPoint.X;
                double height = currentPoint.Y - firstPoint.Y;

                if (width > 0 && height > 0)
                {
                    Graphics g = Graphics.FromHwnd(new System.Windows.Interop.WindowInteropHelper(this).Handle);
                    System.Drawing.Pen myPen = new System.Drawing.Pen(System.Drawing.Color.Red, 5);
                    g.DrawRectangle(myPen, myRec);
                    myRec.Width = (int)width;
                    myRec.Height = (int)height;
                    InvalidateVisual();
                }
            }

        }

        private void mainwin_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            flg = false;
        }
    }
}


modified on Tuesday, June 1, 2010 3:37 AM

AnswerRe: how about erasing trace of Rectangle? Pin
Stanciu Vlad31-May-10 21:53
Stanciu Vlad31-May-10 21:53 
GeneralRe: how about erasing trace of Rectangle? Pin
sonic74731-May-10 23:51
sonic74731-May-10 23:51 
GeneralRe: how about erasing trace of Rectangle? Pin
Stanciu Vlad1-Jun-10 0:37
Stanciu Vlad1-Jun-10 0:37 
AnswerRe: how about erasing trace of Rectangle? Pin
Pete O'Hanlon1-Jun-10 1:02
mvePete O'Hanlon1-Jun-10 1:02 
GeneralRe: how about erasing trace of Rectangle? Pin
sonic7471-Jun-10 2:12
sonic7471-Jun-10 2:12 
GeneralRe: how about erasing trace of Rectangle? Pin
Pete O'Hanlon1-Jun-10 2:37
mvePete O'Hanlon1-Jun-10 2:37 
QuestionUnhandled exception in the designer (OnPaint) Pin
AussieLew31-May-10 13:18
AussieLew31-May-10 13:18 
AnswerRe: Unhandled exception in the designer (OnPaint) Pin
Luc Pattyn31-May-10 13:30
sitebuilderLuc Pattyn31-May-10 13:30 
AnswerRe: Unhandled exception in the designer (OnPaint) Pin
Stanciu Vlad31-May-10 21:57
Stanciu Vlad31-May-10 21:57 
QuestionSerial interface RS-232 C# app data recive issue Pin
sebogawa31-May-10 9:32
sebogawa31-May-10 9:32 
AnswerRe: Serial interface RS-232 C# app data recive issue Pin
Luc Pattyn31-May-10 9:53
sitebuilderLuc Pattyn31-May-10 9:53 
AnswerRe: Serial interface RS-232 C# app data recive issue Pin
Richard Andrew x6431-May-10 11:14
professionalRichard Andrew x6431-May-10 11:14 
QuestionTime event? Real time data send Pin
sodevrom31-May-10 6:46
sodevrom31-May-10 6:46 
AnswerRe: Time event? Real time data send Pin
Luc Pattyn31-May-10 7:03
sitebuilderLuc Pattyn31-May-10 7:03 
GeneralRe: Time event? Real time data send Pin
sodevrom31-May-10 7:12
sodevrom31-May-10 7:12 
GeneralRe: Time event? Real time data send Pin
Luc Pattyn31-May-10 7:14
sitebuilderLuc Pattyn31-May-10 7:14 
GeneralRe: Time event? Real time data send Pin
sodevrom31-May-10 7:18
sodevrom31-May-10 7:18 

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.