Advertisement
Fhernd

Principal.cs

Mar 7th, 2018
1,511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.82 KB | None | 0 0
  1. using System;
  2. using System.Windows;
  3. using System.Windows.Forms;
  4. using System.Windows.Forms.Integration;
  5. using WPFControls = System.Windows.Controls;
  6.  
  7. namespace R722ControlWPFEnWinForms
  8. {
  9.     public partial class Principal : Form
  10.     {
  11.         WPFControls.TextBox txtRegistroCambioColor;
  12.         private ElipseControl elipseControl;
  13.  
  14.         public Principal()
  15.         {
  16.             InitializeComponent();
  17.  
  18.             txtRegistroCambioColor = new WPFControls.TextBox();
  19.             txtRegistroCambioColor.Text = "Campo de Texto WPF\n\r\n\r";
  20.             txtRegistroCambioColor.TextAlignment = TextAlignment.Center;
  21.             txtRegistroCambioColor.VerticalAlignment = VerticalAlignment.Center;
  22.             txtRegistroCambioColor.VerticalScrollBarVisibility = WPFControls.ScrollBarVisibility.Auto;
  23.             txtRegistroCambioColor.IsReadOnly = true;
  24.  
  25.             ElementHost elhContedorCampoTexto = new ElementHost();
  26.             elhContedorCampoTexto.Name = "elhContedorCampoTexto";
  27.             elhContedorCampoTexto.Dock = DockStyle.Fill;
  28.             elhContedorCampoTexto.Child = txtRegistroCambioColor;
  29.             elhContedorCampoTexto.Size = new System.Drawing.Size(156, 253);
  30.             elhContedorCampoTexto.RightToLeft = RightToLeft.No;
  31.  
  32.             tlpContenedor.Controls.Add(elhContedorCampoTexto, 0, 0);
  33.  
  34.  
  35.             elipseControl = new ElipseControl();
  36.  
  37.             elhElipse.Child = elipseControl;
  38.  
  39.             btnCambiarColorElipse.Anchor = AnchorStyles.None;
  40.         }
  41.  
  42.         private void btnCambiarColorElipse_Click(object sender, EventArgs e)
  43.         {
  44.             elipseControl.CambiarColor();
  45.  
  46.             txtRegistroCambioColor.Text += String.Format("La elipse cambió su color a {0}\n\r", elipseControl.Color);
  47.  
  48.             txtRegistroCambioColor.ScrollToEnd();
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement