.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

DragMove with WindowsForm in a WPF

Posted By:      Posted Date: October 28, 2010    Points: 0   Category :WPF
 

Hi,

 

I have a Windows form (a picture box) inside a WPF window.  I desire drag 'n move functionality when clicking on my picture box.  In order to do so, I catch my picture box MouseDown event and then raise a MouseLeftButtonDown event so that my WPF window can get it and inside that event handler I call DragMove().

 

So I have this call inside my windows form event handler:

      if (e.Button == MouseButtons.Left)
      {
        MouseDevice mouseDev = InputManager.Current.PrimaryMouseDevice;
        MouseButtonEventArgs mouseEvent = new MouseButtonEventArgs(mouseDev, 0, MouseButton.Left)
        {
          RoutedEvent = MouseLeftButtonDownEvent
        };
        RaiseEvent(mouseEvent);
      }

 

However when I check the left button of the mouse device, it's never in the state "Pressed", so when I call DragMove in the WPF handler, it throws an exception.

 

How do I get the mouse so that the left button is pressed?  I can't set the states since it's all read-only...

 

Is what I'm trying to do possible?  Or will I just have to do some math and manually set the top and left of the WPF window?

 

Thanks.




View Complete Post


More Related Resource Links

pdf on a windowsform ...WITHOUT temp file

  

Hi everybody, I got this problem, a simple byte[] with a right formatted pdf, ofcourse if I write it down on file and then let the webbrowser object navigate to this file everything works sweet and i can see the pdf on my form...but i cant have files used on my application, is quite annoying then here it is the deal:

how can I show a byte[] rappresenting a pdf in my windows form application without use a temp file and without buy any expensive 3th part component?

Thankssss

 


How can a fill a cell in a gridview in a windowsform?

  

I have a gridview in a windowsform.
There are 4 columns (A, B, C and D).
I column D is a combobox.
How can I fill this combobox at form_load with the following data: --> 
1
2
3
4
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend