Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

problem sa opacity forme

[es] :: .NET :: problem sa opacity forme

[ Pregleda: 2031 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

max_2581

Član broj: 87945
Poruke: 18
*.cmu.carnet.hr.



Profil

icon problem sa opacity forme06.07.2006. u 14:36 - pre 216 meseci
dali se moze u Vb-u napraviti da kod startanja programa forma iz potpune prozirnosti postane normalna.

probao sam to napraviti s TIMER-om ali ne funkcionira
Code:
Me.Opacity = Me.Opacity + 1%
        Me.Refresh()
        If Me.Opacity = 100% Then Timer1.Enabled = False


forma odma postane normalna bez da se vidi prijelaz iz 0% -- 100% prozirnosti.
Interval timera je na 100

Hvala.

Jos jedno podpitanje.

U ms help-u sam koristi primjer kako da koristim formu koja izgleda kao neka slika. Npr. crvena pozadina , a u centru je plavi krug. Forma prikazuje sve iako je BORDERSTYLE--NONE i TRANSPENCYKEY---RED.
slika je u BMP formatu
 
Odgovor na temu

ProkDu

Član broj: 54451
Poruke: 10
195.252.99.*



Profil

icon Re: problem sa opacity forme07.07.2006. u 03:26 - pre 216 meseci
'Ajde probaj ovo. Naravno ovo je C#, ali ces se vec snaci da prebacis u VB.

Code:
 private void Form1_Load(object sender, EventArgs e)
        {
            double fadeIn = 0.0;
            while (fadeIn < 1)
            {
                fadeIn += 0.01;
                this.Opacity = fadeIn;
                this.Refresh();
            }
        }


Pozdrav
 
Odgovor na temu

max_2581

Član broj: 87945
Poruke: 18
*.cmu.carnet.hr.



Profil

icon Re: problem sa opacity forme07.07.2006. u 15:16 - pre 216 meseci
hmmmmm...isprobao sam u #C-u, ali ni to ne radi! Forma se najedamput pokaže, bez prijelaza iz nevidljivog u opacity 100%.

I ja bih Vas iskreno molio dali može u VB-u ne u #c-u!!
 
Odgovor na temu

DarkMan
Darko Matesic

Član broj: 20445
Poruke: 572
..mtsns-ns.customer.sbb.co.yu.

Jabber: DarkMan


Profil

icon Re: problem sa opacity forme07.07.2006. u 17:19 - pre 216 meseci
1. resenje sa timer-om
Code:

        Timer timer = new Timer();
        public Form1()
        {
            InitializeComponent();
            this.Opacity = 0.1;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Interval = 100;
            timer.Start();            
        }

        void timer_Tick(object sender, EventArgs e)
        {
            this.Opacity += 0.1;
            if(this.Opacity == 1) timer.Stop();
        }


2. resenje bez timer-a
Code:

        public Form1()
        {
            InitializeComponent();
            this.Shown += new EventHandler(Form1_Shown);
        }

        void Form1_Shown(object sender, EventArgs e)
        {
            this.Opacity = 0;
            while(this.Opacity < 1) {
                this.Opacity += 0.005;
                Application.DoEvents();
            }            
        }

 
Odgovor na temu

VerbatimBOT
Aleksandar Dragosavac
Senior .NET Developer

Član broj: 84129
Poruke: 228
*.vdial.verat.net.



Profil

icon Re: problem sa opacity forme07.07.2006. u 17:38 - pre 216 meseci
Kod za metodu static void main u Program.cs (u tvom slučaju, Program.vb) fajlu:

Code:

static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form1 myForm = new Form1();
            myForm.Opacity = 0;
            myForm.Show();
            double i = 0;
            while (i < 1)
            {
                myForm.Opacity = i;
                i += 0.01;
                System.Threading.Thread.Sleep(10);
            }
            Application.Run(myForm);
        }

Winners never quit, quitters never win.
 
Odgovor na temu

max_2581

Član broj: 87945
Poruke: 18
*.cmu.carnet.hr.



Profil

icon Re: problem sa opacity forme07.07.2006. u 21:21 - pre 216 meseci
Ok. Hvala svima! Iako ne kužim #C ni 0.00001%
Pronašao sam rjesenje.

Umjesto:
Code:
Me.Opacity = Me.Opacity + 1%
        Me.Refresh()
        If Me.Opacity = 100% Then Timer1.Enabled = False


Morao sam upisati:
Code:
Me.Opacity = Me.Opacity + 0.1
        Me.Refresh()
        If Me.Opacity = 1 Then Timer1.Enabled = False
 
Odgovor na temu

[es] :: .NET :: problem sa opacity forme

[ Pregleda: 2031 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.