none
MicrioSoft1 RRS feed

  • 질문

  • using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace livstviewADDRESS  // 추가 삭제 정렬(버튼)  form2연결
    {
        public partial class Form1 : Form
        {
           
           
           
            public Form1()
            {
                InitializeComponent();
            }

            private void button4_Click(object sender, EventArgs e) //대화상자 띄우기
            {
                Form2 dig = new Form2(this);
                dig.Show();
            }

            private void 추가ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Form2 dig = new Form2(this);
                dig.Show();
            }

            private void 삭제ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                listView1.FocusedItem.Remove();
            }

            private void 정렬ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                listView1.Sorting = SortOrder.Ascending;
            }

            private void button1_Click(object sender, EventArgs e)     //추가
            {
                ListViewItem item = new ListViewItem(textBox1.Text,int.Parse(comboBox2.Text));
                item.SubItems.Add(textBox2.Text);
                item.SubItems.Add(textBox3.Text);
                item.SubItems.Add(comboBox1.Text);
                listView1.Items.Add(item);

                textBox1.Clear();
                textBox2.Clear();
                textBox3.Clear();
               
            }

            private void button2_Click(object sender, EventArgs e)    //삭제
            {
                listView1.FocusedItem.Remove();
            }

            private void button3_Click(object sender, EventArgs e)    //정렬
            {
                listView1.Sorting = SortOrder.Ascending;
            }

            private void 큰아이콘ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                listView1.View = View.LargeIcon;
            }

            private void 아이콘ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                listView1.View = View.SmallIcon;
            }

            private void 간단히ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                listView1.View = View.List;
            }

            private void 자세히ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                listView1.View = View.Details;
            }

            private void 큰아이콘ToolStripMenuItem1_Click(object sender, EventArgs e)
            {
                listView1.View = View.LargeIcon;
            }

            private void 작은아이콘ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                listView1.View = View.SmallIcon;
            }

            private void 간단히ToolStripMenuItem1_Click(object sender, EventArgs e)
            {
                listView1.View = View.List;
            }

            private void 자세히ToolStripMenuItem1_Click(object sender, EventArgs e)
            {
                listView1.View = View.Details;
            }

    2009년 10월 13일 화요일 오후 6:15

모든 응답

  • using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace livstviewADDRESS
    {
        public partial class Form2 : Form
        {
            private Form1 dig;
           
            public Form2(Form1 a)
            {
                InitializeComponent();
                dig = a;
            }

            private void button1_Click(object sender, EventArgs e)   // form2 대화상자 입력
            {
                ListViewItem item = new ListViewItem(textBox1.Text,int.Parse(comboBox2.Text));
                item.SubItems.Add(textBox2.Text);
                item.SubItems.Add(textBox3.Text);
                item.SubItems.Add(comboBox1.Text);
                dig.listView1.Items.Add(item);

                textBox1.Clear();
                textBox2.Clear();
                textBox3.Clear();
               
            }
        }
    }

    2009년 10월 13일 화요일 오후 6:15
  • using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace       webBrowser
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }

           
            private void button1_Click(object sender, EventArgs e)
            {
                webBrowser1.Navigate(comboBox1.Text);
            }

            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                webBrowser1.Navigate(comboBox1.SelectedItem.ToString());
            }

            private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
            {
                comboBox1.Text = webBrowser1.Url.ToString();
            }

            private void comboBox1_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    webBrowser1.Navigate(comboBox1.Text);
                    comboBox1.Items.Insert(0, comboBox1.Text);
                }

            }

            private void toolStripButton1_Click(object sender, EventArgs e)
            {
                webBrowser1.GoBack();
            }

            private void toolStripButton2_Click(object sender, EventArgs e)
            {
                webBrowser1.GoHome();
            }

            private void toolStripButton3_Click(object sender, EventArgs e)
            {
                webBrowser1.GoForward();
            }

            private void toolStripButton4_Click(object sender, EventArgs e)
            {
                webBrowser1.GoSearch();
            }

            private void toolStripButton5_Click(object sender, EventArgs e)
            {
                webBrowser1.Stop();
            }

            private void toolStripButton6_Click(object sender, EventArgs e)
            {
                webBrowser1.Refresh();
            }

            private void 즐겨찾기ToolStripMenuItem_Click(object sender, EventArgs e)    즐겨찾기랑 항목(즐겨찾기목록들어감)
            {
                ToolStripMenuItem menu = new ToolStripMenuItem(comboBox1.Text);
                menu.Click += new EventHandler(menu_Click);
                목록ToolStripMenuItem.DropDownItems.Add(menu);
            }

            void menu_Click(object sender, EventArgs e)
            {
                webBrowser1.Navigate(((ToolStripMenuItem)sender).Text);
            }

        }
    }

    2009년 10월 13일 화요일 오후 6:33
  • using System;
    using System.IO;
    using System.Collections.Generic;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace    파일탐색기
    {
        public partial class Form1 : Form
        {
            public DirectoryInfo dinfo;
            public DirectoryInfo[] dir;
            public int count;
            ArrayList ar=new ArrayList();
            string adress;      
     
            public Form1()
            {
                InitializeComponent();
                count = 0;
            }
            public void make_list()
            {

                listView1.Items.Clear();

                ListViewItem item = new ListViewItem("..");
                item.SubItems.Add("");
                item.SubItems.Add("");
                item.SubItems.Add("");
                listView1.Items.Add(item);
                dir = dinfo.GetDirectories();
                count = dir.Length + 1;
                foreach (DirectoryInfo d in dir)
                {
                    ListViewItem item1 = new ListViewItem(d.Name.ToString(), 0);
                    item1.SubItems.Add(d.Attributes.ToString());
                    item1.SubItems.Add("");
                    item1.SubItems.Add(d.CreationTime.ToString());
                    listView1.Items.Add(item1);
                }
                FileInfo[] file = dinfo.GetFiles();
                foreach (FileInfo f in file)
                {
                    ListViewItem item2 = new ListViewItem(f.Name.ToString(), 1);
                    item2.SubItems.Add(f.Attributes.ToString());
                    item2.SubItems.Add(f.Length.ToString());
                    item2.SubItems.Add(f.CreationTime.ToString());
                    listView1.Items.Add(item2);
                }
                Text = dinfo.FullName.ToString();
               
            }


            private void 열기ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                openFileDialog1.ShowDialog();
                dinfo = new DirectoryInfo(openFileDialog1.FileName);
                dinfo = dinfo.Parent;

                make_list();
            }

            private void listView1_Click(object sender, EventArgs e)
            {
                int index = listView1.FocusedItem.Index;
                if (index >= count)
                {
                   
                    return;
                }
                else if (index != 0)
                    dinfo = dir[index - 1];
                else
                {
                    if (dinfo.Parent == null)
                    {
                        MessageBox.Show("루트디렉토리입니다.");
                        return;
                    }
                   
                    dinfo = dinfo.Parent;
                }
                make_list();  
            }

            private void 파일복사하기ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                FileInfo[] file = dinfo.GetFiles();
                ar.Clear();
               
                for(int i=0;i<listView1.SelectedItems.Count;i++)
                {
                    foreach (FileInfo f in file)
                    {
                        if(listView1.SelectedItems[i].Text==f.Name)
                        {
                            adress = f.FullName.ToString();
                            ar.Add(f.Name.ToString());                       
                        }
                    }
                }   
            }

            private void 붙이기ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                FileInfo[] file = dinfo.GetFiles();
                string w = @"\";
                int copy_count = 0;
                foreach (string s in ar)
                {
                    for (int i = 0; i < file.Length; i++)
                    {
                        if (file[i].Name == s)
                        {
                            copy_count++;
                            MessageBox.Show(s+" 파일은 이미 존재합니다.");
                        }
                    }
                    if (copy_count == 0)
                    {
                        File.Copy(@adress, @Text + w + s);
                    }                   
                }
                listView1.Items.Clear();
                make_list();           
            }

            private void 파일삭제ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                FileInfo[] file = dinfo.GetFiles();
               
                for (int i = 0; i < listView1.SelectedItems.Count; i++)
                {
                    foreach (FileInfo f in file)
                    {
                        if (listView1.SelectedItems[i].Text == f.Name)
                        {
                            f.Delete();
                           
                        }
                    }
                }
                listView1.Items.Clear();
                make_list(); 
            }

            private void 끝내기ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Close();
            }
        }

    }

    2009년 10월 14일 수요일 오전 12:38