In Windows 8, there is no Start Menu. Is a good idea to start creating our own Windows 8 Start Menu. That menu is custom and programmed in Visual Basic with the Express Edition or with the Professional Edition.
In the previous post, we were able to create a form and place it over the taskbar. Now let’s take a look on something interesting in the Windows Start Menu. Please take a look at the next image.
[ In the Windows 7 Start menu]
There is a textbox use to help you find a program or a file in your computer. Personally, I never liked the windows search tools because it never gives me the file I wanted. Now this is our time to create our custom search textbox.
Unfortunately, we can’t just put a textbox. It is too simple. Text search box comes with a little button with a magnet inside it. That little button is part of the design of the window Start Button and even if you don’t think is useful; we still have to put it.
Otherwise, the Start Menu will not look like the windows Start Menu, right?
There are 2 ways we could do it and I will show you: the usercontrol and inherits function. There are no controls like that in Visual Basic Express 2010 or Visual Studio 2010. You have to build the control.
For those of you who are too lazy to do a usercontrol or a the new textbox type, is OK. Just skip the reading. Make a simple textbox with a button next to it (or over it). It will work but it won’t give the same feeling.
Here is the sample of my new TextBox.
''' <summary> ''' English: this is a sample of Inherits ''' Francais: ceci est un exemple d'héritage ''' </summary> ''' <remarks></remarks> Public Class TextBoxButton Inherits TextBox Public mButton As Button Public Property Button As Button Get Return mButton End Get Set(value As Button) mButton = value End Set End Property Protected Overrides Sub OnCreateControl() Me.Controls.Add(Me.mButton) Me.mButton.Dock = DockStyle.Right MyBase.OnCreateControl() End Sub Public Sub New() MyBase.New() mButton = New Button With Me.mButton .Width = 20 .FlatAppearance.BorderSize = 0 .FlatStyle = FlatStyle.Popup .BackColor = Color.Transparent .Image = My.Resources.search.ToBitmap 'put the image you want End With End Sub End Class |
My new textbox is called TextBoxButton. Is simple a button inside a Textbox. So my Textbox is some kind of a enhance Textbox. So instead of using the regular Textbox from System.Windows.Forms.Textbox , I’ll use this improved textbox.
The class is very small and I done it like that on purpose. It is easy to improve it because it works the same way as a class form where you could put function or variables.
If you use and add the TextboxButton, you will see something like the next image:
The icon button inside the textbox makes it better. That is good for the user.
Previous post : Create your Windows 8 Start Menu
Next Post : Create searchBox using UserControl
0 Response to "Create the Search TextBox"
Posting Komentar