InicioHazlo Tu MismoPopup estilo MSN con C# Express

Popup estilo MSN con C# Express

Hazlo Tu Mismo2/8/2012


Hola Taringueros

Hoy les voy a enseñar como poder realizar un simple popup al estilo MSN (Cuando se conecta un nuevo contacto) en C# con Visual C# Express 2010

Para descargarlo pueden ir a : http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-csharp-express



Primero que nada creamos un nuevo proyecto Windows Forms



Luego creamos un nuevo Form el cual llamaremos Popup y le agregaremos el siguiente namespace:

using System.Runtime.InteropServices;

Y en el código agregamos lo siguiente:

#region Win32

const int AW_HIDE = 0X10000;
const int AW_ACTIVATE = 0X20000;
const int AW_HOR_POSITIVE = 0X1;
const int AW_HOR_NEGATIVE = 0X2;
const int AW_SLIDE = 0X40000;
const int AW_BLEND = 0X80000;
const int AW_VER_NEGATIVE = 0X8;
const int AW_VER_POSITIVE = 0X4;

[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int AnimateWindow
(IntPtr hwand, int dwTime, int dwFlags);

#endregion

#region Variables

private bool _UseSlideAnimation = true;
private int speedAnimation = 350;

#endregion



Luego en el constructor del form agregamos lo siguiente despues de la inicializacion de los componentes.

public Popup()
{
InitializeComponent();
// Aca seteamos la posición a manual para dejar la ventana donde queramos
this.StartPosition = FormStartPosition.Manual;
// Aca le indicamos a la ventana que se situe abajo y a la derecha de la pantalla
this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width -10, Screen.PrimaryScreen.WorkingArea.Height - this.Height -10);
}


En el evento Load del formulario agregamos lo siguiente para crear la animación:

private void Popup_Load(object sender, EventArgs e)
{
AnimateWindow(this.Handle, speedAnimation, AW_ACTIVATE | (_UseSlideAnimation ? AW_VER_NEGATIVE | AW_SLIDE : AW_BLEND));
}


Luego insertamos un timmer y le agregamos 5 segundos entre intervalos.
En el evento Tick del timmer agregamos el siguiente código:


private void timer1_Tick(object sender, EventArgs e)
{
AnimateWindow(this.Handle, speedAnimation, AW_HIDE | (_UseSlideAnimation ? AW_VER_POSITIVE | AW_SLIDE : AW_BLEND));
this.Close();
}


Luego solo resta armar el formulario a gusto nuestro y ya podremos agregarle un lindo popup a nuestras aplicaciones.







CÓDIGO FUENTE POR MP
Datos archivados del Taringa! original
26puntos
238visitas
0comentarios
Actividad nueva en Posteamelo
0puntos
3visitas
0comentarios
Dar puntos:

Dejá tu comentario

0/2000

Autor del Post

t
tincho2083🇦🇷
Usuario
Puntos0
Posts2
Ver perfil →
PosteameloArchivo Histórico de Taringa! (2004-2017). Preservando la inteligencia colectiva de la internet hispanohablante.

CONTACTO

18 de Septiembre 455, Casilla 52

Chillán, Región de Ñuble, Chile

Solo correo postal

© 2026 Posteamelo.com. No afiliado con Taringa! ni sus sucesores.

Contenido preservado con fines históricos y culturales.