|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
[VB.NET] How to hide startup form?
I was to hide my startup form because I only want to display my tray icon. Any ideas how to do this?
|
|
#2
|
|||
|
|||
|
You can add a minimize event on load, if that your program is set to minimize to system tray!
Or you can add Me.Opacity = 0(Me.Opacity = 1 when clicked on systray icon again) on load, and then hide the taskbar button! |
|
#3
|
|||
|
|||
|
1. // IDE: set opacity to 0
2. // IDE: add a timer to your form 3. timer.Enabled = true //enable the timer on form.Load event 4. me.hide() // the timer.Tick even hide form 5. me.opacity = 1 // the timer.Tick make form opacity back to normal 6. me.show() // yourNotifyIcon.click event |
|
#4
|
|||
|
|||
|
Why not just:
this.Visible = false; this.ShowInTaskbar = false; |
|
#5
|
|||
|
|||
|
Hi guys,
Interesting thread this. The method that i've implemented to do this was through the use of this code: #Region "Taskbar Icon" REM TASKBAR ICON Private Sub NotifyIcon1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDown If Me.WindowState = FormWindowState.Normal Then Me.WindowState = FormWindowState.Minimized Else Me.WindowState = FormWindowState.Normal End If End Sub #End Region On the form properties I also made sure that it didnt have appear in the task bar, nor have minimise/maximise/quit buttons.. However, to get to my question - i've tried using this opacity function to produce a 'fade in/out' type affair. The code that I would use is (fade out): Dim n For n = 1 To 10 Me.ActiveForm.Opacity() = Me.ActiveForm.Opacity() - 0.1 Next However, even though the code itself is correct, on running it, it'll produce the error message: An unhandled exception of type 'System.NullReferenceException' occurred in Agility.exe Additional information: Object reference not set to an instance of an object. So..any takers to tell me whats going on? All i want is for it to fade in/out on the system tray button click given if it is already in view or not. Thanks |
|
#6
|
|||
|
|||
|
prabably those code are running when no from active under your "Me"
try Me.Opacity() -= 0.1 a tip to fading effect: you should do your fade codes with threading method rather than just a simple loop. for example, you can have a timer with interval of 100ms, every time the timer tick, you reduce the opacity by 0.1, until it reaches 0 (totally invisible) or whatever you want. And to make it "solid" you do it with the timer again but isntead of reduce opacity, you increase it, until it reaches 1 And of course, if you want, you can create a separate thread and just run the loop with that second thread, however I found the timer method is easier. |
|
#7
|
|||
|
|||
|
thanks for the reply.
I found that using the timer was going to be the safest bet. To solve the problem, dont have your form minimised on startup folks ![]() Yes, believe it or not, that was the answer... |
|
#8
|
|||
|
|||
|
I believe you, if your form is minimised, I guess that will make it not 'Me.ActiveForm'
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > .Net Development > [VB.NET] How to hide startup form? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|