我希望即使重新启动后也能保持不透明度

时间:2016-10-31 01:59:32

标签: vb.net visual-studio-2013

我希望在退出应用程序并将其重新打开为不透明度时将其设置为不透明度,我将其设置为轨道栏值...希望这些图像有帮助......

http://imgur.com/gallery/yK3no

    Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll

        Me.Opacity = TrackBar1.Value * 0.01
        Form1.Opacity = TrackBar1.Value * 0.01
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Label5.Text = TrackBar1.Value
// this is the Label showing the value of track bar 1 which you'll see in the images.

    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        My.Settings.Default("Settings") = "Some Value"
        My.Settings.Default.Save()
//here is the settings in properties to save the value on exit however doesn't work... any ideas? 

    End Sub
End Class

以下是我目前的设置,直到那时为止

    Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll
        Me.Opacity = TrackBar1.Value * 0.01
        Form1.Opacity = TrackBar1.Value * 0.01
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Label5.Text = TrackBar1.Value
    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        If Label5.Text = TrackBar1.Value Then
            My.Settings.Opacity = TrackBar1.Value * 0.01
        End If
    End Sub
End Class

1 个答案:

答案 0 :(得分:0)

您将要使用“应用程序设置”来保存该值。

这个答案有望帮助您:Best practice to save application settings in a Windows Forms Application