jaysnanavati Posted December 25, 2008 Posted December 25, 2008 Hi I have got soem basic knowledge of visual basic .net and wpf microsoft expression blend. I am familiar with the environment of both the programs and have started to programm in them. However I need help on this topic as it is out of my knowledge. I would firstly like my program to open in system tray, then when I hit the "x" button on it I would like it to minimize in the system try, and when I roll over the icon in the system tray I would like the program window to hover just above the icon , if you know what I mean. For me this is very challanging becuase I think there is some x-y-z co-ordinate coding involved or not I dont know. Please if someone could help me out here. I would also like to learn the keydown code becuase following some other websites the code Public Class Form1 Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown If e.KeyCode = Keys.A Then MsgBox("A is pressed") End If End Sub End Class dosent work at all.!! please if some one can help me aswell on this. Thank you in advance, any help would be extremely appreciated Quote
Administrators PlausiblyDamp Posted December 26, 2008 Administrators Posted December 26, 2008 If the form has any controls on it then you will also need to set the KeyPreview property to true - otherwise the control with focus gets the event not the form itself. Have you already got the application appearing in the notification area? If not you need to add a NotifyIcon to the main form - this will then appear in the notification area. To make the form appear at a given position you would need to set it's location to the new position - this could be calculated by taking the screen height and width and subtracting the form's height and width. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
jaysnanavati Posted December 27, 2008 Author Posted December 27, 2008 thank you for the reply. Bt the way what is the keyproperty and where do I find it to set it to true. Do I have to declare it or something like the notifyicon and NO I have not been able to make the main form to show un in the notify area:( please help me Quote
Administrators PlausiblyDamp Posted December 27, 2008 Administrators Posted December 27, 2008 The KeyPreview is a property of the form - simlpy select the form (not a control on the form) and it will apeear in the property grid. If you add a NotifyIcon icon component to your form and assign it an icon then it will show up in the notification area. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
jaysnanavati Posted December 27, 2008 Author Posted December 27, 2008 Yes but the thing is , I am not using GUI in VB.net. I am using microsoft expression blend to do all my GUI and then all I see in VB.net is the code of it , if you know what I mean. So I have no properties window, I have that in blend though I cant find what you are saying in it. Is there any other way if possible, only in code??? Quote
Administrators PlausiblyDamp Posted December 27, 2008 Administrators Posted December 27, 2008 My bad, I didn't spot that you were using WPF - simply add a reference to System.Windows.Forms.dll and you should be able to use the NotifyIcon in your code. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.