0% found this document useful (0 votes)
53 views

Programacion de Vista de Arbol Distribucion Geopolitica El Salvador

This document contains code for a C# Windows Forms application that creates a tree view to display the geographic distribution of El Salvador. It defines classes and methods to initialize the tree view component, add nodes for the country and its regions, and populate the tree with province names. Images are added to icons and assigned to nodes. When run, it will display a tree view with El Salvador at the root and nodes for western, central, etc. regions containing province names.

Uploaded by

cmpmendoza
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Programacion de Vista de Arbol Distribucion Geopolitica El Salvador

This document contains code for a C# Windows Forms application that creates a tree view to display the geographic distribution of El Salvador. It defines classes and methods to initialize the tree view component, add nodes for the country and its regions, and populate the tree with province names. Images are added to icons and assigned to nodes. When run, it will display a tree view with El Salvador at the root and nodes for western, central, etc. regions containing province names.

Uploaded by

cmpmendoza
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

PROGRAMACION DE VISTA DE ARBOL DISTRIBUCION GEOPOLITICA EL SALVADOR

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace App_TreeView
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TreeView treeView1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
ImageList il = new ImageList();
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code


/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new
System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.treeView1 = new System.Windows.Forms.TreeView();
this.SuspendLayout();
//
// treeView1
//
this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeView1.Font = new System.Drawing.Font("Courier New", 12F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.treeView1.HotTracking = true;
this.treeView1.Indent = 30;
this.treeView1.ItemHeight = 30;
this.treeView1.LabelEdit = true;
this.treeView1.Location = new System.Drawing.Point(0, 0);
this.treeView1.Name = "treeView1";
this.treeView1.Size = new System.Drawing.Size(376, 309);
this.treeView1.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(376, 309);
this.Controls.Add(this.treeView1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.Text = "DISTRIBUCION GEOPOLITICA ESA";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void Form1_Load(object sender, System.EventArgs e)


{
// Select icons into the image list
il.Images.Add(new Icon("KEY04.ICO"));
il.Images.Add(new Icon("ARW06LT.ICO"));
il.Images.Add(new Icon("LITENING.ICO"));
il.Images.Add(new Icon("ARW06UP.ICO"));
treeView1.ImageList = il ;

// Creacion de la Raiz
TreeNode rootNode = treeView1.Nodes.Add("EL SALVADOR");
rootNode.ImageIndex =0 ;

// Creacion de los Nodos Secundarios de la Raiz


TreeNode states1 = rootNode.Nodes.Add("ZONA OCCIDENTAL");
states1.ImageIndex =1 ;
TreeNode states2 = rootNode.Nodes.Add("ZONA CENTRAL");
states2.ImageIndex =1 ;
TreeNode states3 = rootNode.Nodes.Add("ZONA PARACENTRAL");
states3.ImageIndex =1 ;
TreeNode states4 = rootNode.Nodes.Add("ZONA ORIENTAL");
states4.ImageIndex =1 ;

// Creando los Nodos Terciarios de la Raiz


TreeNode child = states1.Nodes.Add("SANTA ANA");
child.ImageIndex = 2 ;
child =states1.Nodes.Add("AHUACHAPAN");
child.ImageIndex = 2 ;
child =states1.Nodes.Add("SONSONATE");
child.ImageIndex = 2 ;

child = states2.Nodes.Add("LA LIBERTAD");


child.ImageIndex = 2 ;
child =states2.Nodes.Add("SAN SALVADOR");
child.ImageIndex = 2 ;
child =states2.Nodes.Add("CHALATENANGO");
child.ImageIndex = 2 ;

child = states3.Nodes.Add("LA PAZ");


child.ImageIndex = 2 ;
child =states3.Nodes.Add("SAN VICENTE");
child.ImageIndex = 2 ;
child =states3.Nodes.Add("CUSCATLAN");
child.ImageIndex = 2 ;
child = states3.Nodes.Add("CABAÑAS");
child.ImageIndex = 2;

child = states4.Nodes.Add("USULUTAN");
child.ImageIndex = 2 ;
child =states4.Nodes.Add("SAN MIGUEL");
child.ImageIndex = 2 ;
child =states4.Nodes.Add("MORAZAN");
child.ImageIndex = 2 ;
child = states4.Nodes.Add("LA UNION");
child.ImageIndex = 2;
}

}
}

You might also like