Last december 1st, I decided to start several post using Visual Studio2010 around a Windows 8 Start Menu. The first post was : Create your Windows 8 Start Menu
Each day, I try to add something in it. Most stuff are basic knowledge. Here is a test sample. Yes I know, there is still work to do.
my Start Menu Windows 8 now
If you want to make your own Windows 8 Start Menu. Just do it. Is not hard. You saw the video on youtube. It doesn't take much to make one. Of course, the one on the video is not that beautiful, but is just a mather of time. Is not like i am selling it.
Last december 1st, I decided to start several post using Visual Studio2010 around a Windows 8 Start Menu. The first post was : Create your Windows 8 Start Menu
Each day, I try to add something in it. Most stuff are basic knowledge. Here is a test sample. Yes I know, there is still work to do.
my Start Menu Windows 8 now
If you want to make your own Windows 8 Start Menu. Just do it. Is not hard. You saw the video on youtube. It doesn't take much to make one. Of course, the one on the video is not that beautiful, but is just a mather of time. Is not like i am selling it.
Windows 7 Start Button:
The first thing you need to if you want to program your own Start Menu, is getting Microsoft Visual Basic Express 2010 or Microsoft Visual Studio 2010 Professional. In my case, I will work with the profession edition and use the screen shoot from that software. The express edition will work too. So you could download it for fee from here: Download Visual Studio or Express Edition
Create your project in Visual Basic Express 2010 or Visual Studio 2010
I decided to start with a new project with the Windows Forms Applications Template. I named my project: SampleBasicProgram. Press Ok when you have finish.
Create your form in Visual Basic Express 2010 or Visual Studio 2010. I decided to place a button1 to do my test and a Status bar at the button to easily see the bounds of my form. Because we need to place the form over the Windows 8 taskbar, the statusBar will help me visualize it. The look of the form is not important, neither of the size.
Determine the position and the screen resolution
If you start your program, the form will display anywhere. We need to specify a precise position. Because the coordinates in Windows are base on the top left corner, we need to do some little mathematics to be able to place the windows 8 form at the right place.
I will use the screen method to get the size of my screen. With that information, I will be able to place my windows over my taskbar easily and automatically.
By the way, I would not recommend using an old Microsoft windows API shell32.dll to get taskbar height. That way use very old technologies (C++) and unmanaged code. We have to be better than that.
Beside, the height is 40 pix or 32 pix because of the size of the icons inside.
To be able to make this work, you need to override the OnShown Function from the form class:
Protected Overrides Sub OnLoad(e As System.EventArgs) MyBase.OnLoad(e) MyBase.Top = Screen.PrimaryScreen.WorkingArea.Bottom - Me.Height MyBase.Left = Screen.PrimaryScreen.WorkingArea.Left End Sub |
That means that the form move while the form is about to load. You can’t put the same function inside the regular Load function because of the order of events. Your “Me.Height” inside the new function because the class isn’t created. So the best place and most simple way to do it is inside that event.
When you run your program, you will have something like this:
After, we need to do some decoration.
Next post : Create the Search TextBox
Next post : Windows 8 Search Box with UserControl
Next post : Create the Search TextBox
Next post : Windows 8 Search Box with UserControl
Next post : Launch a program from the Windows 8 Start Menu
Next post : Extract icon from file
Next post : enhance button vb
Next Post : Search a file
Reference
0 Response to "Create a Windows 8 Start Menu with Visual Basic"
Posting Komentar