using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace controles_basicos
{
/// <summary>
/// Descripción breve de Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox ctdato;
private System.Windows.Forms.Button btañadir;
private System.Windows.Forms.CheckBox cbcursiva;
private System.Windows.Forms.RadioButton bolectura;
private System.Windows.Forms.RadioButton boescritura;
private System.Windows.Forms.ListBox lslista;
private System.Windows.Forms.HScrollBar bdhcolortexto;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.MenuItem menuopciones;
private System.Windows.Forms.MenuItem itopcionescolor;
private System.Windows.Forms.MenuItem menuayuda;
private System.Windows.Forms.MenuItem itayudaacercade;
private System.Windows.Forms.MenuItem itsalir;
private System.Windows.Forms.ColorDialog dlgcolor;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.ToolTip mensaje;
private System.Windows.Forms.HScrollBar bdhcolortexto1;
private System.Windows.Forms.HScrollBar bdhcolortexto2;
private System.ComponentModel.IContainer components;
public Form1()
{
//
// Necesario para admitir el Diseñador de Windows Forms
//
InitializeComponent();
//
// TODO: agregar código de constructor después de llamar a InitializeComponent
//
}
/// <summary>
/// Limpiar los recursos que se estén utilizando.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Código generado por el Diseñador de Windows Forms
/// <summary>
/// Método necesario para admitir el Diseñador. No se puede modificar
/// el contenido del método con el editor de código.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.ctdato = new System.Windows.Forms.TextBox();
this.btañadir = new System.Windows.Forms.Button();
this.cbcursiva = new System.Windows.Forms.CheckBox();
this.bolectura = new System.Windows.Forms.RadioButton();
this.boescritura = new System.Windows.Forms.RadioButton();
this.lslista = new System.Windows.Forms.ListBox();
this.bdhcolortexto = new System.Windows.Forms.HScrollBar();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuopciones = new System.Windows.Forms.MenuItem();
this.itopcionescolor = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.itsalir = new System.Windows.Forms.MenuItem();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuayuda = new System.Windows.Forms.MenuItem();
this.itayudaacercade = new System.Windows.Forms.MenuItem();
this.dlgcolor = new System.Windows.Forms.ColorDialog();
this.mensaje = new System.Windows.Forms.ToolTip(this.components);
this.bdhcolortexto1 = new System.Windows.Forms.HScrollBar();
this.bdhcolortexto2 = new System.Windows.Forms.HScrollBar();
this.SuspendLayout();
//
// ctdato
//
this.ctdato.AccessibleDescription = "";
this.ctdato.BackColor = System.Drawing.Color.Yellow;
this.ctdato.ForeColor = System.Drawing.SystemColors.ControlText;
this.ctdato.Location = new System.Drawing.Point(16, 32);
this.ctdato.Name = "ctdato";
this.ctdato.Size = new System.Drawing.Size(80, 20);
this.ctdato.TabIndex = 0;
this.ctdato.Tag = "";
this.ctdato.Text = "";
this.ctdato.TextChanged += new System.EventHandler(this.ctdato_TextChanged);
//
// btañadir
//
this.btañadir.Location = new System.Drawing.Point(16, 64);
this.btañadir.Name = "btañadir";
this.btañadir.Size = new System.Drawing.Size(80, 24);
this.btañadir.TabIndex = 1;
this.btañadir.Text = "añadir";
this.btañadir.Click += new System.EventHandler(this.btañadir_Click);
//
// cbcursiva
//
this.cbcursiva.Font = new System.Drawing.Font("Gigi", 15.75F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.cbcursiva.Location = new System.Drawing.Point(16, 112);
this.cbcursiva.Name = "cbcursiva";
this.cbcursiva.TabIndex = 4;
this.cbcursiva.Text = "cursiva";
this.cbcursiva.CheckedChanged += new System.EventHandler(this.cbcursiva_CheckedChanged);
//
// bolectura
//
this.bolectura.Location = new System.Drawing.Point(16, 160);
this.bolectura.Name = "bolectura";
this.bolectura.Size = new System.Drawing.Size(80, 24);
this.bolectura.TabIndex = 3;
this.bolectura.Text = "solo lectura";
this.bolectura.CheckedChanged += new System.EventHandler(this.bolectura_CheckedChanged);
//
// boescritura
//
this.boescritura.Checked = true;
this.boescritura.Location = new System.Drawing.Point(8, 200);
this.boescritura.Name = "boescritura";
this.boescritura.TabIndex = 4;
this.boescritura.TabStop = true;
this.boescritura.Text = "lectura/escritura";
this.boescritura.CheckedChanged += new System.EventHandler(this.boescritura_CheckedChanged);
//
// lslista
//
this.lslista.Location = new System.Drawing.Point(200, 40);
this.lslista.Name = "lslista";
this.lslista.Size = new System.Drawing.Size(112, 199);
this.lslista.TabIndex = 5;
//
// bdhcolortexto
//
this.bdhcolortexto.Location = new System.Drawing.Point(8, 232);
this.bdhcolortexto.Maximum = 255;
this.bdhcolortexto.Name = "bdhcolortexto";
this.bdhcolortexto.Size = new System.Drawing.Size(144, 24);
this.bdhcolortexto.TabIndex = 6;
this.bdhcolortexto.Scroll += new System.Windows.Forms.ScrollEventHandler(this.bdhcolortexto_Scroll);
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuopciones,
this.menuayuda});
//
// menuopciones
//
this.menuopciones.Index = 0;
this.menuopciones.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.itopcionescolor,
this.menuItem5,
this.menuItem6,
this.itsalir,
this.menuItem1});
this.menuopciones.Text = "Opciones";
this.menuopciones.Click += new System.EventHandler(this.menuopciones_Click);
//
// itopcionescolor
//
this.itopcionescolor.Index = 0;
this.itopcionescolor.Text = "color de la caja de texto";
this.itopcionescolor.Click += new System.EventHandler(this.itopcionescolor_Click);
//
// menuItem5
//
this.menuItem5.Index = 1;
this.menuItem5.Text = "-";
//
// menuItem6
//
this.menuItem6.Index = 2;
this.menuItem6.Text = "-";
//
// itsalir
//
this.itsalir.Index = 3;
this.itsalir.Text = "salir";
this.itsalir.Click += new System.EventHandler(this.itsalir_Click);
//
// menuItem1
//
this.menuItem1.Index = 4;
this.menuItem1.Text = "OTRO FORMULARIO";
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
//
// menuayuda
//
this.menuayuda.Index = 1;
this.menuayuda.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.itayudaacercade});
this.menuayuda.Text = "Ayuda";
//
// itayudaacercade
//
this.itayudaacercade.Index = 0;
this.itayudaacercade.Text = "acerca de";
this.itayudaacercade.Click += new System.EventHandler(this.itayudaacercade_Click);
//
// dlgcolor
//
this.dlgcolor.Color = System.Drawing.Color.White;
//
// bdhcolortexto1
//
this.bdhcolortexto1.Location = new System.Drawing.Point(8, 272);
this.bdhcolortexto1.Name = "bdhcolortexto1";
this.bdhcolortexto1.Size = new System.Drawing.Size(144, 24);
this.bdhcolortexto1.TabIndex = 7;
this.bdhcolortexto1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hScrollBar1_Scroll);
//
// bdhcolortexto2
//
this.bdhcolortexto2.Location = new System.Drawing.Point(8, 304);
this.bdhcolortexto2.Name = "bdhcolortexto2";
this.bdhcolortexto2.Size = new System.Drawing.Size(144, 24);
this.bdhcolortexto2.TabIndex = 8;
this.bdhcolortexto2.Scroll += new System.Windows.Forms.ScrollEventHandler(this.bdhcolortexto2_Scroll);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(224)), ((System.Byte)(192)));
this.ClientSize = new System.Drawing.Size(344, 337);
this.Controls.Add(this.bdhcolortexto2);
this.Controls.Add(this.bdhcolortexto1);
this.Controls.Add(this.bdhcolortexto);
this.Controls.Add(this.lslista);
this.Controls.Add(this.boescritura);
this.Controls.Add(this.bolectura);
this.Controls.Add(this.cbcursiva);
this.Controls.Add(this.btañadir);
this.Controls.Add(this.ctdato);
this.Cursor = System.Windows.Forms.Cursors.Hand;
this.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(64)), ((System.Byte)(0)));
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "controles basicos";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// Punto de entrada principal de la aplicación.
/// </summary>
[STAThread]
public static void Main()
{
Application.Run(new Form1());
}
private void ctdato_TextChanged(object sender, System.EventArgs e)
{
}
private void btañadir_Click(object sender, System.EventArgs e)
{
{
if (ctdato.Text != "")
{
lslista.Items.Add(ctdato.Text);
}
}
}
private void cbcursiva_CheckedChanged(object sender, System.EventArgs e)
{
{
if (cbcursiva.Checked)
{
ctdato.Font = new Font("Microsoft Sans Serif",8.25F,FontStyle.Italic);
}
else ctdato.Font = new Font("Microsoft Sans Serif",8.25F,FontStyle.Regular);
}
}
private void bolectura_CheckedChanged(object sender, System.EventArgs e)
{
{
ctdato.ReadOnly=true;
}
}
private void bdhcolortexto_Scroll(object sender, System.Windows.Forms.ScrollEventArgs e)
{
ctdato.ForeColor= Color.FromArgb(bdhcolortexto.Value,bdhcolortexto.Value,bdhcolortexto.Value);
}
private void itopcionescolor_Click(object sender, System.EventArgs e)
{
dlgcolor.Color =ctdato.BackColor;
if (dlgcolor.ShowDialog()==DialogResult.OK)
ctdato.BackColor=dlgcolor.Color;
}
private void boescritura_CheckedChanged(object sender, System.EventArgs e)
{
ctdato.ReadOnly=false;
}
private void itayudaacercade_Click(object sender, System.EventArgs e)
{
MessageBox.Show("aplicando controles. VERSION 1.0" + Environment.NewLine + "COPYRIGTH (C)" + Environment.NewLine + "luis eduador bautista rosale,2009","acerca de controles", MessageBoxButtons.OK ,MessageBoxIcon.Information);
}
private void Form1_Load(object sender, System.EventArgs e)
{
mensaje=new ToolTip();
mensaje.SetToolTip(ctdato,"Datos que agrego a la lista, o datos seleccionados de la lita");
mensaje.SetToolTip(btañadir,"Añade un elemeto a la lista");
}
private void menuItem1_Click(object sender, System.EventArgs e)
{
}
private void menuopciones_Click(object sender, System.EventArgs e)
{
}
private void itsalir_Click(object sender, System.EventArgs e)
{
Close();
}
}
}
}
ya solo le falta lo de cambiar a varios colores
las convinaciones son
255,0,0 es rojo
0,255,0 es verde
0,0,255 es azul
esto lo ponen en el de ct dato.forecolor
y son 3 barras no solo la que tiene
ç
aver si les sirve