Is it possible to measure how long the mouse buttons have been held down? I have added the MyClass_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) event handler and can see a e.timestamp, but cant find how to extract how long the mouse has been held down from this. If the user holds the mousedown for 1 or more second I want to trigger code, but under 1 second do nothing.
3green
Posts
-
MouseDown Duration -
Custom WinForm InheritanceAfter lots of research I still cant find an effective way of inheriting windows forms from my custom window forms. In Vis Studio 2005 in C# I have a dll project MyWinFormProject which includes a customised winform "MyWinForm" and builds into MyWinFormProject.dll. I have a seperate standard C# windows app project WindowsApplication1. When in WindowsApplication1 I add a new inheriited form Form1 which I want to inherit from MyWinForm. I have been trying 2 ways of doing this: 1. 'Export Template', MyWinForm from MyWinFormProject which creates a zip file. Then go through the Add Item Dialog, but this then exposes all confidential source code of MyWinForm in Form1, which is unsuitable. 2. Go through the Add Item Dialog -> Inheritance Dialog and browse to MyWinFormProject.dll and add this as a reference and inherit from MyWinForm in the componet list. This adds MyWinFormProject.dll to the WindowsApplication1 project bin folder. This approach works fine until I try to add a second winform Form2 inherited from MyWinForm, then I get the error message "Uanble to Add reference......Check a different version of 'MyWinFormProject' is not already referenced. Many thanks Steven Spencer.
-
Bitmap from MetaFileHi, Given a Bitmap that is embedded into a windows metafile (WMF) thereby allowing it to be added to a rich text box. I have been trying to recreate the bitmap from the WMF. So assuming I have a windows metafile that is represented in the RichText box as the control string : "{\pict\wmetafile8\picw[N]\pich[N]\picwgoal[N]\pichgoal[N] [BYTES]}" where BYTES are the HEX representation of an image. How would I convert this back into a bitmap? My thought was to use the MetaFile class constructing it from a stream derived somehow from the BYTES above, and then as the Metafile class is an Image it can be transformed into a Bitmap which is also an Image. Any help would be very useful as I keep hitting a brick wall, but as a convert from C++, my C# isnt that good yet.
-
Hashtable ItemI know I am doing something silly, but I cant seem to access the Item property of a Hastable: Hashtable myHash = new Hashtable(); myHash.Item; Produces a build error "System.Collections.Hashtable does not contain a definition for 'Item' " But it sez in help that Item is a public property of Hashtable. Am using VS2003 Enterprise with Frameworks 1.1 SP1 Many thanks
-
WindowsForm Styles too LimitedOne of the features stopping us migrating to C# from VC++ is the limited windows form styles. In a VC++ dialog box we can set the dialog box to have no borders and pop-up style. I cant seem to find a way setting a windowsform to have no border in C#/MC++, I wonder if this is possible at all? many thanks
-
calling managed function from unmanged classHave been trying without success to call an managed function from within an unmanaged class. This would seem to be a basic requirement, of the dotnet so I am obviously doing something wrong. Given the class CMyManaged header as: #pragma once public __gc class CMyManaged { public: CMyManaged(void); ~CMyManaged(void); void MyFun(void); }; and a standard MFC dialog class, I wish to call MyFun() from within MyMFCDlg(). Now I went about this by declaring a CMyManaged variable m_MyManaged; in the unmanaged MyMFCDlg() header file. Then in MyMFCDlg.OnInitDialog() I try to call m_MyManaged.MyFun(); Have tried declaring the managed variable as gcroot m_MyManaged; But various means to call MyFun() have all resulted in compilation errors. Any help would be appreciated, as the C# dialog box is to limited I need to continue developing partially in Unmanaged C++. Many thanks
-
Browser shortcut to an exeI have been searching for information on wether it is possible to add a shortcut to the favourites in the IE browser that links to an application ( a .exe program) on the local computer as opposed to a url on the web. Can anyone give me information on this, is it possible? many thanks
-
mfc libraries download siteHaving brought a dynamically linked mfc app to a site which does not have any of the mfc libraries, I wonder if anyone knows of a site that you can download the mfc libraries from. I am looking specifically for mfc7oud.dll but it strikes me that this would be a useful service anyway and that if there are no licencing problems that maybe even the codeproject could offer a selection of these libraries for download?
-
Zero Proof AlgorithmHi, Am trying to find an implemenation of the Zero Proof Algorithm in C++. Does anyone have any pointers, have found it in C# but not in C++, does it exist? many thanks
-
Customizing Windows Taskbar ItemsIs it possible to customize the windows task bar (not the system tray) items so that you can change the text that appears next to the task bar icon for an application? Also could you replace the text that appears next to the icon by a bitmap. That is instead of having " MyApp.exe" appear in the windows task bar, you could have " MyApplication" or " 'A Bitmap'". There seem to be a lot of articles on the system tray, but I havent seen any on the task bar. Many thanks 3green