Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
GeneralRe: Disappearing Controls on Windows Form App Pin
eddieangel23-Aug-10 9:02
eddieangel23-Aug-10 9:02 
GeneralRe: Disappearing Controls on Windows Form App Pin
Luc Pattyn23-Aug-10 9:21
sitebuilderLuc Pattyn23-Aug-10 9:21 
GeneralRe: Disappearing Controls on Windows Form App Pin
eddieangel23-Aug-10 9:27
eddieangel23-Aug-10 9:27 
GeneralRe: Disappearing Controls on Windows Form App Pin
Luc Pattyn23-Aug-10 10:07
sitebuilderLuc Pattyn23-Aug-10 10:07 
GeneralRe: Disappearing Controls on Windows Form App Pin
phil.o23-Aug-10 20:49
professionalphil.o23-Aug-10 20:49 
Questionthe locations are different than the mouse locations.. Pin
prasadbuddhika23-Aug-10 5:31
prasadbuddhika23-Aug-10 5:31 
AnswerRe: the locations are different than the mouse locations.. Pin
OriginalGriff23-Aug-10 6:05
mveOriginalGriff23-Aug-10 6:05 
GeneralRe: the locations are different than the mouse locations.. Pin
prasadbuddhika23-Aug-10 6:11
prasadbuddhika23-Aug-10 6:11 
public partial class Form1 : Form
    {
        Rectangle r;
        bool isDrawAllow = false;
        int x = 0;
        int y = 0;
       
        //List<MouseRecorder> events = new List<MouseRecorder>();
        List<PointEvent> events = new List<PointEvent>();

        int lastTimeRecorded = 0;

        Graphics g = null;
        MouseHook mouseHook = new MouseHook();

        public Form1()
        {
            InitializeComponent();
            mouseHook.MouseMove += new MouseEventHandler(mouseHook_MouseMove);
            mouseHook.MouseDown += new MouseEventHandler(mouseHook_MouseDown);
            mouseHook.MouseUp += new MouseEventHandler(mouseHook_MouseUp);
            r = new Rectangle(new Point(0,0), new Size(20, 20));
            panel1.Invalidate();
        }

        void mouseHook_MouseUp(object sender, MouseEventArgs e)
        {
           // events.Add(new PointEvent(e.X, e.Y));
            events.Add(new PointEvent(e.X, e.Y));
        }

        void mouseHook_MouseDown(object sender, MouseEventArgs e)
        {
            events.Add(new PointEvent(e.X, e.Y));
        }

        void mouseHook_MouseMove(object sender, MouseEventArgs e)
        {
            events.Add(new PointEvent(e.X, e.Y));
        }

        private void button1_Click(object sender, EventArgs e)
        {
            events.Clear();
            x = 0;
            lastTimeRecorded = Environment.TickCount;
            mouseHook.Start();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            mouseHook.Stop();
        }

        private void PlayBack_Click(object sender, EventArgs e)
        {
            timer1.Enabled = true;
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            if (isDrawAllow)
            {
                if (x < events.Count - 1)
                {
                    PointEvent p = events[x];
                    r.Location = new Point(p.X, p.Y);
                    e.Graphics.FillRectangle(new SolidBrush(Color.Red), r);
                }
                e.Graphics.Dispose(); 
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (x>= events.Count-2)
            {
                timer1.Stop();
            }
            isDrawAllow = true;
            x++;
            panel1.Invalidate();
        }

       
    }


here mouse hook is a third party lib.I'm using PointEvent class to store location(x,Y) in the list
yea this is drawing in the panel.
GeneralRe: the locations are different than the mouse locations.. Pin
Ennis Ray Lynch, Jr.23-Aug-10 6:24
Ennis Ray Lynch, Jr.23-Aug-10 6:24 
GeneralRe: the locations are different than the mouse locations.. Pin
Luc Pattyn23-Aug-10 6:31
sitebuilderLuc Pattyn23-Aug-10 6:31 
GeneralRe: the locations are different than the mouse locations.. Pin
OriginalGriff23-Aug-10 6:45
mveOriginalGriff23-Aug-10 6:45 
GeneralRe: the locations are different than the mouse locations.. Pin
Luc Pattyn23-Aug-10 7:15
sitebuilderLuc Pattyn23-Aug-10 7:15 
QuestionDownload file from server to local folder Pin
Agweet23-Aug-10 4:16
Agweet23-Aug-10 4:16 
AnswerRe: Download file from server to local folder Pin
Luc Pattyn23-Aug-10 4:18
sitebuilderLuc Pattyn23-Aug-10 4:18 
AnswerRe: Download file from server to local folder Pin
Pete O'Hanlon23-Aug-10 4:35
mvePete O'Hanlon23-Aug-10 4:35 
AnswerRe: Download file from server to local folder Pin
Agweet23-Aug-10 6:01
Agweet23-Aug-10 6:01 
GeneralRe: Download file from server to local folder Pin
Ravi Bhavnani23-Aug-10 6:23
professionalRavi Bhavnani23-Aug-10 6:23 
GeneralRe: Download file from server to local folder Pin
Luc Pattyn23-Aug-10 6:33
sitebuilderLuc Pattyn23-Aug-10 6:33 
GeneralRe: Download file from server to local folder Pin
OriginalGriff23-Aug-10 6:48
mveOriginalGriff23-Aug-10 6:48 
GeneralRe: Download file from server to local folder Pin
Agweet23-Aug-10 6:54
Agweet23-Aug-10 6:54 
GeneralRe: Download file from server to local folder Pin
Ravi Bhavnani23-Aug-10 7:04
professionalRavi Bhavnani23-Aug-10 7:04 
GeneralRe: Download file from server to local folder Pin
Ravi Bhavnani23-Aug-10 7:09
professionalRavi Bhavnani23-Aug-10 7:09 
GeneralRe: Download file from server to local folder Pin
Agweet23-Aug-10 20:14
Agweet23-Aug-10 20:14 
GeneralRe: Download file from server to local folder Pin
Ravi Bhavnani24-Aug-10 5:20
professionalRavi Bhavnani24-Aug-10 5:20 
GeneralRe: Download file from server to local folder Pin
OriginalGriff23-Aug-10 8:20
mveOriginalGriff23-Aug-10 8:20 

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.