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.1
Trang 1L p trình trên môi tr ng windows ậ ườ
Windows control – Ph n 2 ầ
Trang 3 Namespace: System.Windows.Forms
Đ nh d ng th hi n và nh p c a TextBox nh đ nh ị ạ ể ệ ậ ủ ư ị
d ng s đi n tho i,… ạ ố ệ ạ
Thu c tính Mask : thi t l p m t n ộ ế ậ ặ ạ
● Mask đ c đ nh nghĩa s nượ ị ẵ
● T đ nh nghĩa Maskự ị
Trang 4 Mask đ c đ nh nghĩa s n ượ ị ẵ
Trang 6soDienThoai = medSoDienThoai.Text
Trang 8 Thu c tính Checked ộ
S ki n CheckedChanged ự ệ
if (chbDongY.Checked == true) MessageBox.Show("Dong y");
Trang 10 Thu c tính ộ
● Size / ClientSize
● Controls
Trang 13// them cot vao listview
lvwDir.Columns.Add( "Name" , 200, HorizontalAlignment Left); lvwDir.Columns.Add( "Size" , 80, HorizontalAlignment Right); lvwDir.Columns.Add( "Type" , 80, HorizontalAlignment Left);
lvwDir.Columns.Add( "Date Modified" , 160,
// hien thi theo dang chi tiet
lvwDir.View = View Details;
Trang 14// them danh sach hinh cho icon cua listview
lvwDir.SmallImageList = new ImageList ();
lvwDir.SmallImageList.Images.Add( new Icon ( "icons/folder.ico" )); lvwDir.SmallImageList.Images.Add( new
Icon ( "icons/document.ico" ));
Trang 16 Th hi n d ng Cây ể ệ ạ
T ng node bên trong nó là 1 TreeNode ừ
Trong 1 TreeNode có th có 1 ho c nhi u TreeNode ể ặ ề con
Trang 18// them danh sach cac icon
tvwDir.ImageList = new ImageList ();
tvwDir.ImageList.Images.Add( new Icon ( "icons/mycomputer.ico" )); tvwDir.ImageList.Images.Add( new Icon ( "icons/drive.ico" ));
tvwDir.ImageList.Images.Add( new Icon ( "icons/folder.ico" ));
tvwDir.ImageList.Images.Add( new Icon ( "icons/document.ico" ));
Trang 19// them nut My computer va cac o dia
TreeNode myComputerNode = new TreeNode ( "My computer" ); myComputerNode.Tag = "My computer" ;
myComputerNode.ImageIndex = 0;
tvwDir.Nodes.Add(myComputerNode);
Trang 20// them cac node o dia vao mycomputer node
foreach ( DriveInfo drive in DriveInfo GetDrives())
Trang 24Thi t k layout ế ế
Ch n ọ 2 control tr lên ở
Toolbar đ ượ c enable