none
This is a String RRS feed

  • 질문

  •         private void Form1_DoubleClick(object sender, EventArgs e)
            {
                MessageBox.Show("Form1을 더블클릭하셨습니다.", "ㅇㅇ", MessageBoxButtons.OK);
            }

    ======

    namespace ㅇㅇ

    {
        public partial class Form1 : Form
        {


            public Form1()
            {       

                InitializeComponent();
            }

            private void toolStripMenuItem7_Click(object sender, EventArgs e)
            {
                DialogForm dlg = new DialogForm(this);
                dlg.Show();
            }

            private void toolStripMenuItem3_Click(object sender, EventArgs e)
            {
                listView1.View = View.LargeIcon;
            }

            private void toolStripMenuItem4_Click(object sender, EventArgs e)
            {
                listView1.View = View.SmallIcon;
            }

            private void toolStripMenuItem5_Click(object sender, EventArgs e)
            {
                listView1.View = View.List;
            }

            private void toolStripMenuItem6_Click(object sender, EventArgs e)
            {
                listView1.View = View.Details;
            }

            private void toolStripMenuItem8_Click(object sender, EventArgs e)
            {
                colorDialog1.ShowDialog();
                listView1.BackColor = colorDialog1.Color;
            }
        }
    }

    namespaceㅇㅇ{
        public partial class DialogForm : Form
        {
            private Form1 dlg;
           
            public DialogForm (Form1 a)
            {
                InitializeComponent();
                dlg = a;
            }

            private void button2_Click(object sender, EventArgs e)
            {
                Close();
            }

            private void button1_Click(object sender, EventArgs e)
            {
                ListViewItem item = new ListViewItem(textBox1.Text, int.Parse(textBox4.Text));
                item.SubItems.Add(textBox2.Text);
                item.SubItems.Add(textBox3.Text);
                dlg.listView1.Items.Add(item);
            }

            private void textBox1_TextChanged(object sender, EventArgs e)
            {

            }

            private void textBox2_TextChanged(object sender, EventArgs e)
            {

            }

            private void textBox3_TextChanged(object sender, EventArgs e)
            {

            }

            private void textBox4_TextChanged(object sender, EventArgs e)
            {

            }
        }
    }

    ======

    namespace ㅇ{
        public partial class Form1 : Form
        {

            public Form1()
            {
                InitializeComponent();
            }

            private void textBox1_TextChanged(object sender, EventArgs e)
            {
            }

            private void textBox2_TextChanged(object sender, EventArgs e)
            {
            }

            private void button1_Click(object sender, EventArgs e)
            {
                textBox1.Text = "";
                textBox2.Text = "";
                textBox3.Text = "";
            }

            private void button2_Click(object sender, EventArgs e)
            {
                textBox3.Text = (Convert.ToDouble(textBox1.Text) + Convert.ToDouble(textBox2.Text)).ToString();
            }

            private void button3_Click(object sender, EventArgs e)
            {
                textBox3.Text = (Convert.ToDouble(textBox1.Text) - Convert.ToDouble(textBox2.Text)).ToString();

            }

            private void button4_Click(object sender, EventArgs e)
            {
                textBox3.Text = (Convert.ToDouble(textBox1.Text) * Convert.ToDouble(textBox2.Text)).ToString();

            }

            private void button5_Click(object sender, EventArgs e)
            {
                textBox3.Text = (Convert.ToDouble(textBox1.Text) / Convert.ToDouble(textBox2.Text)).ToString();

            }

            private void textBox3_TextChanged(object sender, EventArgs e)
            {

            }

        }
    }

    ======


    namespace ㅇ{
        public partial class Form1 : Form
        {
            ArrayList a1 = new ArrayList();
            ADD_CARD card;

            bool F = false;

            public Form1()
            {
                InitializeComponent();
            }

            private void button1_Click(object sender, EventArgs e)
            {
                card = new ADD_CARD();

                card.name = textBox1.Text;
                card.address = textBox2.Text;
                card.phone = textBox3.Text;
                a1.Add(textBox1.Text);
                a1.Add(textBox2.Text);
                a1.Add(textBox3.Text);
                MessageBox.Show("데이터가 입력되었습니다.");
                textBox1.Text = "";
                textBox2.Text = "";
                textBox3.Text = "";
            }

            public void button3_Click(object sender, EventArgs e)
            {
                for (int i = 0; i < a1.Count; i = i + 3)
                {
                    if (textBox1.Text == a1[i].ToString())
                    {
                        textBox2.Text = a1[i + 1].ToString();
                        textBox3.Text = a1[i + 2].ToString();
                        F = true;
                    }
                }
                if (F == false)
                {
                    MessageBox.Show("데이터가 없습니다.");
                    textBox2.Text = "";
                    textBox3.Text = "";
                }
                F = false;
            }

            private void button2_Click(object sender, EventArgs e)
            {
                for (int i = 0; i < a1.Count; i = i + 3)
                {
                    textBox1.Text = a1[i].ToString();
                    textBox2.Text = a1[i + 1].ToString();
                    textBox3.Text = a1[i + 2].ToString();
                }
            }

        }
    }

    ======

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

            private void radioButton1_CheckedChanged(object sender, EventArgs e)
            {
                tabControl1.Alignment = TabAlignment.Top;
            }

            private void radioButton2_CheckedChanged(object sender, EventArgs e)
            {
                tabControl1.Alignment = TabAlignment.Bottom;
            }

            private void radioButton3_CheckedChanged(object sender, EventArgs e)
            {
                tabControl1.Alignment = TabAlignment.Left;
            }

            private void radioButton4_CheckedChanged(object sender, EventArgs e)
            {
                tabControl1.Alignment = TabAlignment.Right;
            }

            private void radioButton5_CheckedChanged(object sender, EventArgs e)
            {
                tabControl1.Appearance = TabAppearance.Normal;
            }

            private void radioButton6_CheckedChanged(object sender, EventArgs e)
            {
                tabControl1.Appearance = TabAppearance.Buttons;
            }

            private void radioButton7_CheckedChanged(object sender, EventArgs e)
            {
                tabControl1.Appearance = TabAppearance.FlatButtons;
            }

            private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
            {
                label1.Text = dateTimePicker1.Value.ToString();
            }

            private void monthCalendar1_DateSelected(object sender, DateRangeEventArgs e)
            {
                label1.Text = monthCalendar1.SelectionRange.Start.ToString();
            }


        }
    }

    ======

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

            private void radioButton1_CheckedChanged(object sender, EventArgs e)
            {
                listView1.View = View.LargeIcon;
            }

            private void radioButton2_CheckedChanged(object sender, EventArgs e)
            {
                listView1.View = View.SmallIcon;
            }

            private void radioButton3_CheckedChanged(object sender, EventArgs e)
            {
                listView1.View = View.List;
            }

            private void radioButton4_CheckedChanged(object sender, EventArgs e)
            {
                listView1.View = View.Details;
            }

            private void button1_Click(object sender, EventArgs e)
            {
                ListViewItem item = new ListViewItem(textBox1.Text, Int32.Parse(textBox5.Text));
                item.SubItems.Add(textBox2.Text);
                item.SubItems.Add(textBox3.Text);
                item.SubItems.Add(textBox4.Text);
                item.SubItems.Add(textBox5.Text);           
                listView1.Items.Add(item);
            }

            private void button2_Click(object sender, EventArgs e)
            {
                int i = listView1.SelectedIndices[0];

                listView1.Items.RemoveAt(i);

                MessageBox.Show("삭제되었습니다.");
            }

        }
    }

    ======

    namespace ㅇ{
        public partial class Form1 : Form
        {
            ArrayList a1 = new ArrayList();
            ADD_CARD card;

            bool F = false;
            int i = 0;
            int x = 0;

            public Form1()
            {
                InitializeComponent();
            }
            private void button1_Click_1(object sender, EventArgs e)
            {
                card = new ADD_CARD();

                card.name = textBox1.Text;
                card.address = textBox2.Text;
                card.phone = textBox3.Text;
                a1.Add(textBox1.Text);
                a1.Add(textBox2.Text);
                a1.Add(textBox3.Text);
                MessageBox.Show("데이터가 입력되었습니다.");
                textBox1.Text = "";
                textBox2.Text = "";
                textBox3.Text = "";
            }

            private void button2_Click_1(object sender, EventArgs e)
            {
                if (i == a1.Count)
                    i = 0;

                while (i < a1.Count)
                {
                    if (a1.Contains(a1[i]))
                    {
                        textBox1.Text = a1[i].ToString();
                        textBox2.Text = a1[i + 1].ToString();
                        textBox3.Text = a1[i + 2].ToString();
                        i += 3;
                        x = i - 4;
                        break;
                    }
                }
            }

            private void button3_Click_1(object sender, EventArgs e)
            {
                for (int i = 0; i < a1.Count; i = i + 3)
                {
                    if (textBox1.Text == a1[i].ToString())
                    {
                        textBox2.Text = a1[i + 1].ToString();
                        textBox3.Text = a1[i + 2].ToString();
                        F = true;
                    }
                }
                if (F == false)
                {
                    MessageBox.Show("데이터가 없습니다.");
                    textBox2.Text = "";
                    textBox3.Text = "";
                }
                F = false;
            }

            private void button5_Click(object sender, EventArgs e)
            {

                for (int i = 0; i < a1.Count; i = i + 3)
                {
                    if (textBox1.Text == a1[i].ToString())
                    {
                        a1.RemoveRange(i, 3);
                        if (i == a1.Count)
                        {
                            if (a1.Contains(a1))
                            {
                                textBox1.Text = a1[i - 3].ToString();
                                textBox2.Text = a1[i - 2].ToString();
                                textBox3.Text = a1[i - 1].ToString();
                                F = true;
                                break;
                            }
                            else
                            {
                                textBox1.Text = "";
                                textBox2.Text = "";
                                textBox3.Text = "";
                                F = true;
                                break;
                            }
                        }
                        textBox1.Text = a1[i].ToString();
                        textBox2.Text = a1[i + 1].ToString();
                        textBox3.Text = a1[i + 2].ToString();
                        F = true;
                    }
                }
                if (F == false)
                {
                    MessageBox.Show(textBox1.Text + " 은 명단에 없습니다.");
                    textBox2.Text = "";
                    textBox3.Text = "";
                }
                F = false;
            }

            private void button4_Click(object sender, EventArgs e)
            {
                if (x <= 0)
                    x = a1.Count - 1;

                while (x > 0)
                {
                    if (a1.Contains(a1[x]))
                    {
                        textBox1.Text = a1[x - 2].ToString();
                        textBox2.Text = a1[x - 1].ToString();
                        textBox3.Text = a1[x].ToString();
                        x -= 3;
                        i = x + 4;
                        break;
                    }
                }

            }

            private void button6_Click(object sender, EventArgs e)
            {
                textBox1.Text = "빈칸";
                textBox2.Text = "빈칸";
                textBox3.Text = "빈칸";
            }
        }
    }

    ======

    namespace
    {
        public partial class Form1 : Form
        {
            ArrayList a1 = new ArrayList();
            ADD_CARD card;

            int i = 0;
            int val = 0;
            string sex;

            public Form1()
            {
                InitializeComponent();
            }

            private void radioButton1_CheckedChanged(object sender, EventArgs e)
            {
                listView1.View = View.LargeIcon;
            }

            private void radioButton2_CheckedChanged(object sender, EventArgs e)
            {
                listView1.View = View.SmallIcon;
            }

            private void radioButton3_CheckedChanged(object sender, EventArgs e)
            {
                listView1.View = View.List;
            }

            private void radioButton4_CheckedChanged(object sender, EventArgs e)
            {
                listView1.View = View.Details;
            }

            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                switch (comboBox1.SelectedItem.ToString())
                {
                    case "남자":
                        sex = "남자";
                        break;

                    case "여자":
                        sex = "여자";
                        break;
                }
            }

            private void button1_Click(object sender, EventArgs e)
            {
                if (val < 4)
                {
                    card = new ADD_CARD();

                    card.name = textBox1.Text;
                    card.address = textBox2.Text;
                    card.phone = textBox3.Text;
                    card.sex = sex;

                    a1.Add(card);

                    ListViewItem item = new ListViewItem(textBox1.Text, val);
                    item.SubItems.Add(textBox2.Text);
                    item.SubItems.Add(textBox3.Text);
                    item.SubItems.Add(sex);
                    listView1.Items.Add(item);                                            
                   
                    val++;

                    textBox1.Clear();
                    textBox2.Clear();
                    textBox3.Clear();
                }
                else
                    val = 0;
            }

            private void button2_Click(object sender, EventArgs e)
            {
                foreach (ADD_CARD card in a1)
                {
                    if (card.name == listView1.FocusedItem.Text)
                    {
                        a1.RemoveAt(i);
                        i = 0;
                        break;
                    }
                    else
                    {
                        i++;
                        continue;
                    }
                }           
                listView1.FocusedItem.Remove();
            }

            private void button3_Click(object sender, EventArgs e)
            {
                listView1.Sorting = SortOrder.Ascending;
                listView1.Sorting = SortOrder.None;

                foreach (ADD_CARD one in a1)
                {
                    foreach (ADD_CARD two in a1)
                    {
                        if (string.Compare(one.name, two.name) < 0)
                        {
                            string tmp1 = one.name;
                            string tmp2 = one.address;
                            string tmp3 = one.phone;
                            string tmp4 = one.sex;
                            one.name = two.name;
                            two.name = tmp1;
                            one.address = two.address;
                            two.address = tmp2;
                            one.phone = two.phone;
                            two.phone = tmp3;
                            one.sex = two.sex;
                            two.sex = tmp4;
                        }
                    }               
                }
            }

            private void toolStripMenuItem1_Click(object sender, EventArgs e)
            {
                button1_Click(sender, e);
            }

            private void toolStripMenuItem2_Click(object sender, EventArgs e)
            {
                button2_Click(sender, e);
            }

            private void toolStripMenuItem3_Click(object sender, EventArgs e)
            {
                button3_Click(sender, e);
            }

            private void toolStripMenuItem5_Click(object sender, EventArgs e)
            {
                radioButton1_CheckedChanged(sender, e);
            }

            private void toolStripMenuItem6_Click(object sender, EventArgs e)
            {
                radioButton2_CheckedChanged(sender, e);
            }

            private void toolStripMenuItem7_Click(object sender, EventArgs e)
            {
                radioButton3_CheckedChanged(sender, e);
            }

            private void toolStripMenuItem8_Click(object sender, EventArgs e)
            {
                radioButton4_CheckedChanged(sender, e);
            }
        }
    }

    ======


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

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

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

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

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

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

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

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

            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 comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                webBrowser1.Navigate(comboBox1.SelectedItem.ToString());
                string tmp = comboBox1.SelectedItem.ToString();
                comboBox1.Items.Remove(comboBox1.SelectedItem);
                comboBox1.Items.Insert(0, tmp);
            }

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

            private void 즐겨찾기에추가ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Form2 frm = new Form2(this);

                if (comboBox1.Text != "")
                {
                    frm.AddressText = comboBox1.Text;
                }

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    ToolStripMenuItem menu = new ToolStripMenuItem(frm.AddressText);
                    menu.Click += new EventHandler(menu_Click);
                    ToolStripMenuItem.DropDownItems.Add(menu);
                }
            }

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

    +

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

            public string AddressText
            {
                get
                {
                    return textBox1.Text;
                }
                set
                {
                    textBox1.Text = value;
                }
            }

            private void button2_Click(object sender, EventArgs e)
            {
                Close();
            }
        }
    }

    2010년 10월 18일 월요일 오전 12:05