//IMPRIMINDO
ARRAY EM LISTBOX
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
namespace keypress {
public partial
class Form1 : Form {
private System.Windows.Forms.ListBox listBox;
int i = 0;
int [ ] arr = new
int [ 100 ];
/*============================================================*/
public void
List_Box ( ) {
listBox.Location = new Point ( 250, 100 );
//Propriedades
de fonte no listBox
listBox.Font = new Font ( "Times New Roman", 15F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, 0 );
//Colororindo a font do listBox com rgb
listBox.ForeColor
= Color.FromArgb ( 255, 0, 255 );
}
/*============================================================*/
public void
Ini_Array ( ) {
listBox = new System.Windows.Forms.ListBox ( );
for ( i = 0; i < arr.Length; i++ ) {
arr [ i ] = i;
listBox.Items.Add ( arr [ i ]
);
}
}
/*============================================================*/
protected override
void OnPaint (
PaintEventArgs e ) {
this.Size = new
System.Drawing.Size ( 600, 300 );
this.Text = "IMPRIMINDO ARRAY EM LISTBOX";
this.BackColor = Color.LightBlue;
Graphics dc = e.Graphics;
Pen BluePen = new Pen ( Color.Green, 10 );
dc.DrawRectangle ( BluePen, 5, 5,
575, 250 );
Font myFont = new System.Drawing.Font ( "Helvetica",
14,
FontStyle.Italic );
Brush myBrush = new SolidBrush ( System.Drawing.Color.Black
);
Brush myBrush_1 = new SolidBrush ( System.Drawing.Color.Red );
dc.DrawString ( "IMPRIMINDO
ARRAY EM LISTBOX",
myFont, myBrush_1, 140, 15 );
dc.DrawString ( "Abaixo o array
de inteiros ",
myFont,
myBrush, 190, 40 );
}
/*============================================================*/
public Form1 ( ) {
Ini_Array ( );
List_Box ( );
this.Controls.Add ( this.listBox );
}
}
/*============================================================*/
static class
Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void
Main ( ) {
Application.EnableVisualStyles ( );
Application.SetCompatibleTextRenderingDefault ( false );
Application.Run ( new Form1 ( ) );
}
}
}
Nenhum comentário:
Postar um comentário