admin 管理员组

文章数量: 887021


2023年12月20日发(作者:frequency函数视频)

C#中实现撤销、恢复、保存、退出、对齐代码

2009-10-27 09:30

private void 新建ToolStripMenuItem_Click(object sender,

EventArgs e)

{

= "";

}

private void 打开ToolStripMenuItem_Click(object sender,

EventArgs e)

{

OpenFileDialog openF = new OpenFileDialog();

= "文本文件(*.rtf)|*.rtf|文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";

if (alog() == )

{

string strFileNmae = me;

string strExt = ension(strFileNmae);//对应命名空间

if (r() == ".rtf")

{

le(

@strFileNmae,

xt);

}

else if (r() == ".txt")

{

le(

@strFileNmae,

ext);

}

else

{

= "系统不支持该类型文件。";

}

}

}

private void 保存ToolStripMenuItem_Click(object sender,

EventArgs e)

{

SaveFileDialog saveF = new SaveFileDialog();

= "文本文件(*.rtf)|*.rtf|文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";

eDirectory = true;

if (alog() == )

{

string strFileNmae = me;

le(

strFileNmae, xt);

}

}

private void 退出ToolStripMenuItem_Click(object sender,

EventArgs e)

{

();

}

private void 字体ToolStripMenuItem_Click(object sender,

EventArgs e)

{

FontDialog fontD = new FontDialog();

lor = true;

fects = true;

if (alog() == )

{

ionFont = ;

ionColor = ;

}

}

private void 颜色ToolStripMenuItem_Click(object sender,

EventArgs e)

{

ColorDialog colorD = new ColorDialog();

if (alog() == )

{

ionColor = ;

}

}

private void 左对齐ToolStripMenuItem_Click(object sender,

EventArgs e)

{

ionAlignment =

;

}

private void 居中ToolStripMenuItem_Click(object sender,

EventArgs e)

{

ionAlignment =

;

}

private void 右对齐ToolStripMenuItem_Click(object sender,

EventArgs e)

{

ionAlignment =

;

}

private void 撤销ToolStripMenuItem_Click(object sender,

EventArgs e)

{

();

}

private void 删除DToolStripMenuItem_Click(object sender,

EventArgs e)

{

();

}

private void 全选AToolStripMenuItem_Click(object sender,

EventArgs e)

{

All();

}

private void 恢复ToolStripMenuItem_Click(object sender,

EventArgs e)

{

();

}


本文标签: 恢复 类型 退出 支持 撤销