[RESOLVED] Extracting date from EventArgs
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: [RESOLVED] Extracting date from EventArgs

  1. #1
    Join Date
    Feb 2012
    Posts
    13

    [RESOLVED] Extracting date from EventArgs

    I am trying to write a graphics program in which I use a Panel on a Windows form as the graphics surface. I have a click event routine which is triggered whn the user clicks on the Panel. I want to extract the X and Y coordinates from EventArgs which is passed to the routine. I can see the values in the 'e' argument if I set a break point to examine whn the break point occurs but do not know how to extact thes values, Can anyone please help.?

  2. #2
    Join Date
    May 2007
    Location
    Denmark
    Posts
    623

    Re: Extracting date from EventArgs

    Posting a sample of your code would help. I'm hard pressed to understand what you mean by "Extracting the values" - if you can see them when debugging, they should be available just like any other property.
    It's not a bug, it's a feature!

  3. #3
    Join Date
    Feb 2012
    Posts
    13

    Re: Extracting date from EventArgs

    Thanks for reply foamy. Here is the piece of code where I want to obtain the X and Y values of the point clicked but the compile will no allow e.X and e.Y. :-

    private void panel1_Click(object sender, EventArgs e)
    {
    int horizPos,vertPos;
    horizPos = e.X
    vertPos = e.Y;
    switch (nLines)

  4. #4
    Join Date
    May 2007
    Location
    Denmark
    Posts
    623

    Re: Extracting date from EventArgs

    Well, the generic EventArgs does not contain any such properties.
    I think you should handle the MouseClick event rather than the Click event..
    It's not a bug, it's a feature!

  5. #5
    Join Date
    Feb 2012
    Posts
    13

    Re: Extracting date from EventArgs

    Many Thanks 'Foamy'I have just made the change you suggest and that works fine now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center