Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu File , Thư mục và IO phần cuối doc
MIỄN PHÍ
Số trang
7
Kích thước
174.7 KB
Định dạng
PDF
Lượt xem
1091

Tài liệu File , Thư mục và IO phần cuối doc

Nội dung xem thử

Mô tả chi tiết

using System;

using System.Drawing;

using System.Windows.Forms;

public class SimpleEditForm : System.Windows.Forms.Form {

private System.Windows.Forms.MenuItem mnuFile;

private System.Windows.Forms.MenuItem mnuOpen;

private System.Windows.Forms.MenuItem mnuSave;

private System.Windows.Forms.MenuItem mnuExit;

private System.Windows.Forms.RichTextBox rtDoc;

// (Bỏ qua phần mã designer.)

private void mnuOpen_Click(object sender, System.EventArgs e) {

OpenFileDialog dlg = new OpenFileDialog();

dlg.Filter = "Rich Text Files (*.rtf)|*.RTF|" +

"All files (*.*)|*.*";

dlg.CheckFileExists = true;

dlg.InitialDirectory = Application.StartupPath;

if (dlg.ShowDialog() == DialogResult.OK) {

rtDoc.LoadFile(dlg.FileName);

rtDoc.Enabled = true;

}

}

private void mnuSave_Click(object sender, System.EventArgs e) {

SaveFileDialog dlg = new SaveFileDialog();

dlg.Filter = "RichText Files (*.rtf)|*.RTF|Text Files (*.txt)|*.TXT" +

"|All files (*.*)|*.*";

dlg.CheckFileExists = true;

dlg.InitialDirectory = Application.StartupPath;

if (dlg.ShowDialog() == DialogResult.OK) {

rtDoc.SaveFile(dlg.FileName);

}

Tải ngay đi em, còn do dự, trời tối mất!
Tài liệu File , Thư mục và IO phần cuối doc | Siêu Thị PDF