How to build your first form and hope the following instructions can be a guide to your Quick start. 1. How to set a from boundary 2. how to establish a transparent from 3. How to set the position of a form on the screen 4. how to make the Minimize and Maximize buttons unavailable 5. How to make a form disappear 6. How to set the form to be non rectangular. 7. How to make a form at the top of the screen. 8. How to display a model and non-model form 9. How to make an MDI form 10. how your form will not appear on the taskbar. 11. How to make a form with a splash screen. 12. How to make your form trayicon. 13. How to modify the size and length of the control form. 14. How to create a Windows Explorer-style form. 15. How to set the initial startup form 16. How to create a form with a background image
1. How to set up a from boundary form There are seven different boundary styles that you can set up, and you could set it dynamically at design time as well as through code. These seven boundary styles are: None ( System.Windows.Forms.FormBorderStyle.None) fixed 3D (System.Windows.Forms.FormBorderStyle.Fixed3D) fixed Dialog ( System.Windows.Forms.FormBorderStyle.FixedDialog) Fixed single (System.Windows.Forms.FormBorderStyle.FixedSingle) Fixed Tool Window (System.Windows.Forms.FormBorderStyle.FixedToolWindow) sizable ( System.Windows.Forms.FormBorderStyle.Sizable) sizable Tool Window ( System.Windows.Forms.FormBorderStyle.SizableToolWindow) in the design mode of the Vs.net IDE Properties window to set the FormBorderStyle property. In the running mode you can use the code to complete:
Dlgbx1.formborderstyle = System.Windows.Forms.FormBorderStyle.FixedDialog
These seven types of boundary type VB6, there is no big change in the running mode you need to control different enumeration variables to set.
2. How to create a transparent fromThere are two ways you can do this at design time and run time. At design time, you can set the Opacity property in the Vs.net IDE's Properties window to achieve this effect. This value is from 0.0 to 1.0. 0 means full transparency, and 1.0 means completely opaque. Run time you can use the following encoding to set the Opactiy property of the form. Specific: frmtransparentform.opacity = 0.76; (C #) It's easy to see now that you don't have to know any alpha variables anymore. Transparency is always an effect, don't abuse it.
3. How to set the position of the form on the screenYou can set the StartPosition property of the form, VS. NET generally gives you a conservative option of "windowsdefaultlocation" so that the system will determine a value based on the user's current computer settings in the Load form, or you can change it to another value "Center" at design time. If you have to make sure that the form appears on the screen in a design way you can set StartPosition to manual and then set the location x and Y values. The runtime seems to be more concise with code implementations:
Of course, you can also modify the x and Y values of the location separately, corresponding to the left and top properties of the form, such as: Form1.left + + (vb.net) form1.top-= (vb.net) Another property will also affect the form's bit on the screen Place: Desktoplocation This property is very useful when you set up a form relative to the taskbar (when you put the taskbar on top or left of the screen, you actually change the desktop coordinates (0,0)), You can set this in this way. Properties that do not appear in the Design Properties window, Form1.desktoplocation = The position of the new Point (100,100) Form on the screen will depend primarily on the specific hardware and settings of each user, so the conservative approach is to use the default " WindowsDefaultLocation "or Center"; The professional practice is to get the system settings and then encode the dynamic calculation after the setting, otherwise it is easy to find your form on the screen.
4. How to make minimized and Maximize buttons unavailableThe Form.minimizebox and form.maximizebox of the form are displayed when True, and False is not. See below programmatically: Frmmaxmin.minnimizebox = False (vb.net) Frmmaxmin.maxmnimizebox = True (vb.net)
5. How to make a form disappear I think the most direct way is for you to call the Hide () method to do this. But I want to provide another way, and then you will get some other inspiration. (vb.net) Private Const ws_ex_toolwindow as Int32 = &h80 Private Const WS_POPUP As Int32 = &h80000000 Private Const ws_visible as Int32 = &h10000000 privat e Const ws_sysmenu as Int32 = &h80000 Private Const ws_maximizebox as Int32 = &h10000 &N bsp; Protected Overrides ReadOnly Property CreateParams () as System.Windows.Forms.CreateParams get Dim CP As System.Windows.Forms.CreateParams CP = Mybase.createparams CP. ExStyle = Ws_ex_toolwindow cp. Style = Ws_popup or ws_visible or Ws_sysmenu or ws_mAximizebox CP. Height = 0 cp. Width = 0 return CP End got End Property It turns out that the height and width are set to 0, and I think this way and hide () The underlying level of the call may be different.
6. How to set the form to be non rectangular. The problem I think I'm not offering is the most professional, at least it's not what I expected, which means it's going to turn back into a rectangle in some events. But at least I can tell you this: if you try to call the original Win32 ' s API setwindowrng, I've tried so much. Now you may need to know about the form's Region Properties '//(vb.net) public Sub Setwindowregion () Dim Formpath as System.Drawing.Drawing2D.GraphicsPath Dim Reg as drawing.region Dim Lret as Long Formpath = New Drawing2d.graphicspath () formpath.addellipse (New Rectangle (0, 0, 250, 120 ) me.region = New Region (formpath) end Sub & nbsp private Sub button1_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles button1.c Lick me.region = Nothing &nbsP Setwindowregion () End Sub Protected Overrides Sub OnResize (ByVal e as System. EventArgs) me.region = Nothing setwindowregion () end Sub
7. How to make a form at the top of the screen.This is a very useful feature, and now you don't have to call other APIs, just set the topmost property to true. This property can be modified at design time and run-time. Code mode:
8. How to display a form of model and non-modelThe form of model and modeless will mainly depend on your application, most of which is used in the Display dialog box. You call MyForm when you need the model form. ShowDialog instead of the model call Myform.show, there is an optional parameter for ShowDialog ower lets you establish a parent-child relationship for a form. For example:
' Visual Basic
Private Sub mnuabout_click (... args ...)
Dim F as New formoption
F.showdialog Me
End Sub
One thing to note is that for ShowDialog, when executed to this sentence, the form is displayed, but the code that follows will not be executed until the window is closed, and is instantaneous for show, and the following code will be executed immediately after the display of the form.