前田稔(Maeda Minoru)の超初心者のプログラム入門
![]()
![]()
using System; using System.Drawing; using System.Windows.Forms; using System.Text; // for Encoding using System.IO; // for File, StreamReader using System.Collections; // ArrayList using System.Diagnostics; // Process の起動 |
| メニュー | メソッド |
|---|---|
| コピー(&C) | Copy メソッド |
| カット(&T) | Cut メソッド |
| ペースト(&P) | Paste メソッド |
| 行コピー(&B) | LCopy メソッド |
| 行カット(&L) | LCut メソッド |
![]()
//☆ 編集メソッド
private void Copy(object sender, EventArgs e)
{
if (richTextBox1.SelectionLength > 0)
{ richTextBox1.Copy(); }
}
private void Cut(object sender, EventArgs e)
{
if (richTextBox1.SelectionLength > 0)
{ richTextBox1.Cut(); }
}
private void Paste(object sender, EventArgs e)
{
ClipPaste();
}
private void Undo(object sender, EventArgs e)
{
if (richTextBox1.CanUndo)
{ richTextBox1.Undo(); }
}
private void Redo(object sender, EventArgs e)
{
if (richTextBox1.CanRedo)
{ richTextBox1.Redo(); }
}
private void LCopy(object sender, EventArgs e)
{
m_fclass.LineEdit(richTextBox1);
Clipboard.SetDataObject(m_fclass.lstr, true);
}
private void LCut(object sender, EventArgs e)
{
m_fclass.LineEdit(richTextBox1);
Clipboard.SetDataObject(m_fclass.lstr, true);
richTextBox1.Text = richTextBox1.Text.Remove(m_fclass.st, m_fclass.nx - m_fclass.st);
richTextBox1.SelectionStart = m_fclass.st;
}
private void ClipPaste()
{
IDataObject data = Clipboard.GetDataObject();
if (data != null && data.GetDataPresent(DataFormats.Text) == true)
{
richTextBox1.Paste();
}
}
|
private void Exec(object sender, EventArgs e)
{
if (File.Exists(m_fclass.path))
System.Diagnostics.Process.Start(m_fclass.path);
}
private void Ut8Load(object sender, EventArgs e)
{
m_fclass.ReadFile("utf-8");
m_fclass.Load(richTextBox1);
}
private void UniLoad(object sender, EventArgs e)
{
m_fclass.ReadFile("utf-16");
m_fclass.Load(richTextBox1);
}
private void JisLoad(object sender, EventArgs e)
{
m_fclass.ReadFile("shift_jis");
m_fclass.Load(richTextBox1);
}
private void EucLoad(object sender, EventArgs e)
{
m_fclass.ReadFile("euc-jp");
m_fclass.Load(richTextBox1);
}
private void HelpAbout(object sender, EventArgs e)
{
MessageBox.Show("Text Editor by Maeda Minoru Contex Version");
}
|
![]()