1. Trang chủ
  2. » Công Nghệ Thông Tin

Giáo trình C winform phần 1

31 269 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 31
Dung lượng 158,75 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1Giáo trình C winform phần 2.1v

Trang 1

L p trình trên môi tr ậ ườ ng Windows

Windows control - Ph n 1 ầ

Tr n Duy Hoàng ầ

tdhoang@hcmus.edu.vn

Trang 3

Form

Trang 8

private void DemoForm_Load(object sender, EventArgs e){

this.Text = "Demo";

this.Size = new Size(500, 500);

this.BackgroundImage = new Bitmap("background.jpg"); this.Opacity = 0.75;

Trang 9

Form

Trang 10

● Ch a danh sách các control con c a nó ứ ủ

● Thêm xóa đ ng các control vào form ộ

Button btn = new Button;

btn.Text = “Hello”;

btn.Size = new Size (50, 50);

btn.Location = new Point (10,10);

this.Controls.Add(btn);

Trang 11

this.ClientSize = new Size(500, 500);

Button[,] arrButton = new Button[10, 10];

for (int i = 0; i < 10; i++) {

for (int j = 0; j < 10; j++) {

arrButton[i,j] = new Button();

arrButton[i,j].Size = new Size(50, 50);

arrButton[i,j].Location = new Point(j * 50, i * 50); this.Controls.Add(arrButton[i,j]);

}

}

Trang 12

Form

Trang 16

● KeyDown(), KeyUp()

➢ if (e.KeyCode == Keys.F5) { ThemNhanVien();

e.Handled = true;}

➢ if (e.KeyCode == Keys.N && e.Control == true) { ThemNhanVien();

e.Handled = true;

Trang 20

● Validating() / Validated()

● TextChange

Trang 24

● SelectedIndexChanged

● SelectedValueChanged

Trang 25

}

Trang 26

Dialog thông d ng ụ

OpenFileDialog dialog = new OpenFileDialog();

dialog.InitialDirectory = Application.ExecutablePath; dialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; dialog.FilterIndex = 2;

dialog.RestoreDirectory = true;

if (dialog.ShowDialog() == DialogResult.OK)

{

Trang 27

Dialog thông d ng ụ

SaveFileDialog dialog = new SaveFileDialog();

dialog.InitialDirectory = Application.ExecutablePath; dialog.Filter = "txt files (*.txt)|*.txt";

Trang 28

Dialog thông d ng ụ

FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.RootFolder = Environment.SpecialFolder.Desktop; dialog.ShowNewFolderButton = true;

if (dialog.ShowDialog() == DialogResult.OK)

{

MessageBox.Show(dialog.SelectedPath);

}

Trang 29

Dialog thông d ng ụ

Trang 30

Dialog thông d ng ụ

Trang 31

Tr n Duy Hoàng - tdhoang@fit.hcmus.edu.vn ầ

Th o lu n ả ậ

Ngày đăng: 20/11/2014, 23:18

TỪ KHÓA LIÊN QUAN

w