Ver Mensaje Individual
  #7 (permalink)  
Antiguo 09/12/2015, 10:39
REHome
 
Fecha de Ingreso: mayo-2007
Ubicación: PIC-16F84A
Mensajes: 729
Antigüedad: 17 años, 11 meses
Puntos: 8
Respuesta: ¿Cómo cargar una imagen con un botón?

Gracias, el código fuente de ejmplo por si algún visitante lo quiere claro.

Código:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Entrada_Arduino_WPF_1_CS
{
    /// <summary>
    /// Lógica de interacción para MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void button_Click(object sender, RoutedEventArgs e)
        {
            image.Source = (new BitmapImage(new Uri("Led rojo encendido.png", UriKind.Relative)));
            label_Leyendo.Content = "Encendido.";
            Rectangulo.Fill = new SolidColorBrush(Colors.Green);
        }

        private void button_apagar_Click(object sender, RoutedEventArgs e)
        {
            image.Source = (new BitmapImage(new Uri("Led rojo apagado.png", UriKind.Relative)));
            label_Leyendo.Content = "Apagado.";
            Rectangulo.Fill = new SolidColorBrush(Colors.Red);
        }
    }
}
Saludos.
__________________
Meta Shell, VERSIÓN 1.2.2
Descargar