views:

27

answers:

2

I'm trying to change a Form's opacity automatically before loading. I am using built in Settings function to save the value what opacity the window should have. The problem is, when I'm debugging my application, it all works well, when I compile it and try to open the executable, the window just dissapears... I don't get any errors.

This is how I'm trying to do it:

First there is a value in settings called opacity (int) from 0-100

    private void Form1_Load(object sender, EventArgs e)
    {
        this.Opacity = WindowsFormsApplication1.Properties.Settings.Default.opacity * 0.01;
    }
A: 

Your problem is that the Opacity value has 1.0 as fully visible, and 0.0 as fully invisible. Anything above 1.0 counts as fully visible, too.


EDIT

ok, so after re-reading your question... maybe instead of using the default, use a constant like 0.5 to test it.

TheAdamGaskins
I know that. The problem is when I run the exe, the window doesnt open at all. Only icon on taskbar. When I debug it, it work perfectly...
Badr Hari
Ah, my bad. I misread the question.
TheAdamGaskins
+1  A: 

When you debug, the settings that you save will be kept from run to run. When you deploy, it will copy the default settings file.

Do a check to see if the settings file opacity is actually being loaded correctly when you run the release exe. I have a feeling that either the default is 0, or it's not being loaded.

ach
I had same idea... I can change the value from my built in settings and it writes the xml file just fine... with right values.
Badr Hari