private Form1 dlg;
public Form2(Form1 a)
{
InitializeComponent();
dlg = a;
}
int length, index = 0, k, c = 1;
private void button1_Click(object sender, EventArgs e)
{
c = 1;
string str = dlg.textBox1.Text;
str = str.Remove(index, length);
str = str.Insert(index, textBox2.Text);
dlg.textBox1.Text = str;
button2_Click(sender, e);
if (c == 0)
MessageBox.Show("바꿀게더없습니다");
}
private void button2_Click(object sender, EventArgs e)
{
string str = dlg.textBox1.Text, str_1;
int next = str.Length, a = 1;
length = textBox1.Text.Length;
index = dlg.textBox1.Text.IndexOf(textBox1.Text);
for(int i = k ; i < next - length ; i++)
{
str_1 = str.Substring(i, length);
if(textBox1.Text == str_1)
{
dlg.textBox1.Focus();
dlg.textBox1.Select(i, length);
k = i+1;
a = 2;
break;
}
}
if (a == 1)
{
k = 0;
c = 0;
}
private void button3_Click(object sender, EventArgs e)//모두바꾸?/
{
dlg.textBox1.Text = dlg.textBox1.Text.Replace(textBox1.Text, textBox2.Text);
}
private void button4_Click(object sender, EventArgs e)
{
dlg.Close();
}
}
}
public partial class Form2 : Form
{
private Form1 f1;
public Form2(Form1 a)
{
InitializeComponent();
f1 = a;
}
private void button1_Click(object sender, EventArgs e)
{
ListViewItem item = new ListViewItem(textBox1.Text, int.Parse(comboBox5.Text));
item.SubItems.Add(comboBox4.Text);
item.SubItems.Add(comboBox3.Text);
f1.listView1.Items.Add(item);
}
private void button2_Click(object sender, EventArgs e)
{
foreach (ListViewItem ls in f1.listView1.Items)
{
if (textBox1.Text == ls.Text)
ls.Remove();
}
}
private void button3_Click(object sender, EventArgs e)
{
f1.listView1.Sorting = SortOrder.Ascending;
f1.listView1.Sorting = SortOrder.None;
}
}
}
//
//
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 ob in dir)
{
ListViewItem item1 = new ListViewItem(d.Name.ToString(), 0);
item1.SubItems.Add(ob.Attributes.ToString());
item1.SubItems.Add("");
item1.SubItems.Add(ob.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();
}
}
}
//
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
webBrowser1.Navigate(comboBox1.Text);
comboBox1.Items.Insert(0,comboBox1.Text);
}
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());
}
private void button6_Click(object sender, EventArgs e)
{
listView1.Items.Add(comboBox1.Text);
}
private void button7_Click(object sender, EventArgs e)
{
if(listView1.Visible == false)
listView1.Visible = true;
else
listView1.Visible = false;
}
private void listView1_Click(object sender, EventArgs e)
{
webBrowser1.Navigate(listView1.FocusedItem.Text);
}
}
}
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace save
{
public partial class Form1 : Form
{
ArrayList ar = new ArrayList();
ADD_CARD card;
public Form1()
{
InitializeComponent();
}
[Serializable]
public class ADD_CARD
{
public String name;
public String address;
public String phone;
}
private void 열기ToolStripMenuItem_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
FileStream fs = new FileStream(openFileDialog1.FileName, FileMode.Open);
BinaryFormatter bf = new BinaryFormatter();
ar = (ArrayList)bf.Deserialize(fs);
foreach (ADD_CARD card in ar)
{
textBox1.Text = card.name;
textBox2.Text = card.address;
textBox3.Text = card.phone;
break;
}
fs.Close();
}
private void button1_Click(object sender, EventArgs e)
{
card = new ADD_CARD();
card.name = textBox1.Text;
card.address = textBox2.Text;
card.phone = textBox3.Text;
ar.Add(card);
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
}
private void button3_Click(object sender, EventArgs e)
{
foreach (ADD_CARD c in ar)
{
if (c.name == textBox1.Text)
{
textBox2.Text = c.address;
textBox3.Text = c.phone;
}
}
}
private void button2_Click(object sender, EventArgs e)
{
int c = 0;
foreach (ADD_CARD cd in ar)
{
if (c != 0)
{
textBox1.Text = cd.name;
textBox2.Text = cd.address;
textBox3.Text = cd.phone;
break;
}
if (textBox1.Text == cd.name)
c++;
}
}
private void 저장ToolStripMenuItem_Click(object sender, EventArgs e)
{
saveFileDialog1.ShowDialog();
FileStream fs1 = new FileStream(saveFileDialog1.FileName, FileMode.Create);
BinaryFormatter bf1 = new BinaryFormatter();
bf1.Serialize(fs1, ar);
fs1.Close();
}
}
}
//
/////////////
double num=0;
string x=null,memory="0"; //x?산술연산자가 저장되?memory?MS?값저?
int y = 0; //숫자 버튼클릭?처음 입력하는지 산술연산?후에 다른 숫자?입력하는지 구분
public Form1()
{
InitializeComponent();
}
private void button13_Click(object sender, EventArgs e)
{
if (x != null) // "="버튼?클릭 안해?연속적으?계산하도?해줌
calculation();
num = double.Parse(textBox1.Text);
x = "/";
}
private void button14_Click(object sender, EventArgs e)
{
if (x != null)
calculation();
num = double.Parse(textBox1.Text);
x = "*";
}
private void button15_Click(object sender, EventArgs e)
{
if (x != null)
calculation();
num = double.Parse(textBox1.Text);
x = "-";
}
private void button16_Click(object sender, EventArgs e)
{
if (x != null)
calculation();
num = double.Parse(textBox1.Text);
x = "+";
}
private void button12_Click(object sender, EventArgs e) // "=" 연산?br /> {
calculation(); //"="버튼은 연속적인 계산?위해?따로 메소드화 하였?br />
num = 0; // "="연산 이후?다른 계산?위해?초기?br /> y = 0;
x = null;
}
private void button1_Click(object sender, EventArgs e)
{
if ( x == null) //연산 버튼 클릭 이전
{
if (textBox1.Text == "0")
textBox1.Text = "1";
else
textBox1.Text += "1";
}
else if (y==1) //연산버튼 클릭 이후 y?카운터로 해서 첫입력인지 두번째이상인지 구분
textBox1.Text += "1"; //예를 들어?11?입력하고자할?두번?클릭시의 1
else
{
textBox1.Text = "1";
y = 1; // 예를 들어?11?입력할때 첫번?클릭?1?경우
}
}
private void button2_Click(object sender, EventArgs e)
{
if (x == null)
{
if (textBox1.Text == "0")
textBox1.Text = "2";
else
textBox1.Text += "2";
}
else if (y == 1)
textBox1.Text += "2";
else
{
textBox1.Text = "2";
y=1;
}
}
private void button3_Click(object sender, EventArgs e)
{
if (x == null)
{
if (textBox1.Text == "0")
textBox1.Text = "3";
else
textBox1.Text += "3";
}
else if (y == 1)
textBox1.Text += "3";
else
{
textBox1.Text = "3";
y=1;
}
}
private void button4_Click(object sender, EventArgs e)
{
if (x == null)
{
if (textBox1.Text == "0")
textBox1.Text = "4";
else
textBox1.Text += "4";
}
else if (y == 1)
textBox1.Text += "4";
else
{
textBox1.Text = "4";
y=1;
}
}
private void button5_Click(object sender, EventArgs e)
{
if (x == null)
{
if (textBox1.Text == "0")
textBox1.Text = "5";
else
textBox1.Text += "5";
}
else if (y == 1)
textBox1.Text += "5";
else
{
textBox1.Text = "5";
y=1;
}
}
private void button6_Click(object sender, EventArgs e)
{
if (x == null)
{
if (textBox1.Text == "0")
textBox1.Text = "6";
else
textBox1.Text += "6";
}
else if (y == 1)
textBox1.Text += "6";
else
{
textBox1.Text = "6";
y=1;
}
}
private void button7_Click(object sender, EventArgs e)
{
if (x == null)
{
if (textBox1.Text == "0")
textBox1.Text = "7";
else
textBox1.Text += "7";
}
else if (y == 1)
textBox1.Text += "7";
else
{
textBox1.Text = "7";
y=1;
}
}
private void button8_Click(object sender, EventArgs e)
{
if (x == null)
{
if (textBox1.Text == "0")
textBox1.Text = "8";
else
textBox1.Text += "8";
}
else if (y == 1)
textBox1.Text += "8";
else
{
textBox1.Text = "8";
y=1;
}
}
private void button9_Click(object sender, EventArgs e)
{
if (x == null)
{
if (textBox1.Text == "0")
textBox1.Text = "9";
else
textBox1.Text += "9";
}
else if (y == 1)
textBox1.Text += "9";
else
{
textBox1.Text = "9";
y=1;
}
}
private void button10_Click(object sender, EventArgs e)
{
if (x == null)
{
if (textBox1.Text != "0")
{
textBox1.Text += "0";
}
}
else if (y == 1)
textBox1.Text += "0";
else
{
if (textBox1.Text != "0")
{
textBox1.Text = "0";
}
y = 1;
}
}
private void button11_Click(object sender, EventArgs e)
{
string temp =textBox1.Text;
if (temp.Contains(".") == false)
{
textBox1.Text += ".";
}
}
private void button19_Click(object sender, EventArgs e)
{
textBox1.Text = "0";
x = null;
num = 0;
y = 0;
}
private void button18_Click(object sender, EventArgs e)
{
textBox1.Text = "0";
y = 0;
}
private void button17_Click(object sender, EventArgs e)
{
string temp = textBox1.Text;
if (temp.Length > 1)
temp = temp.Remove((temp.Length - 1), 1);
else
temp = "0";
textBox1.Text = temp;
}
private void calculation() // 계산 해주?메소?br /> {
switch (x)
{
case "-":
num -= double.Parse(textBox1.Text);
break;
case "+":
num += double.Parse(textBox1.Text);
break;
case "*":
num *= double.Parse(textBox1.Text);
break;
case "/":
num /= double.Parse(textBox1.Text);
break;
}
textBox1.Text = num.ToString();
y = 0;
}
private void button23_Click(object sender, EventArgs e)
{
memory = null;
textBox2.Text = null;
x = "M"; //MR,MS,MC,M+ 버튼 ??숫자?받기 위해 임의?x값을 부?br /> }
private void button21_Click(object sender, EventArgs e)
{
memory = textBox1.Text;
textBox2.Text = "M";
x = "M";
}
private void button22_Click(object sender, EventArgs e)
{
textBox1.Text = memory;
x = "M";
}
private void button20_Click(object sender, EventArgs e)
{
double double_memory=double.Parse(memory);
double temp = double.Parse(textBox1.Text);
double_memory += temp;
memory = double_memory.ToString();
x = "M";
}
}
}
///////////