Professional Documents
Culture Documents
Gioi Thieu Ve Cac Controls (Phan 2)
Gioi Thieu Ve Cac Controls (Phan 2)
Gioi Thieu Ve Cac Controls (Phan 2)
Point : Bottom/Right
Check Smooth
Progress Control
( Thanh Tiến Trình )
Cách dùng :
Khởi tạo
CProgressCtrl* pProg = (CProgressCtrl*)
GetDlgItem( IDC_PROGRESS );
pProg->SetRange(0,100);
pProg->SetPos(0);
Sự kiện : NM_OUTOFMEMORY chỉ ra rằng
tiến trình không thể hoàn tất vì lỗi tràn
memory
Sẽ chạy liên tục nếu kết hợp với sự kiện
định thời WM_TIMER
Spin Control ( Điều khiển xoay )
Dùng để điều chỉnh giá trị tăng giảm trên
cửa sổ giao diện
Default Style
Spin Control ( Điều khiển xoay )
Cách dùng :
Dùng Class Winzard thêm Function cho sự
kiện WM_VSCROLL (hay WM_HSCROLL)
Khởi tạo :
CSpinButtonCtrl* pSpin = (CSpinButtonCtrl*)
GetDlgItem(IDC_SPIN);
pSpin->SetRange(0,100);
pSpin->SetPos(0);
Lấy giá trị đang xoay :
OnVScroll (UINT nSBCode, UINT nPos,
CScrollBar* pScrollBar)
If ( pScrollBar->GetDlgCtrlID() == IDC_SPIN )
Tree View ( Cây )
Được dùng để hiển thị dạng cấu trúc cây
Thêm Function vào sự kiện chọn TVN_SELCHANGED :
OnSelchangedTree (NMHDR* pNMHDR, LRESULT*
pResult)
{
NM_TREEVIEW* pNMTreeView =
(NM_TREEVIEW*)pNMHDR;
hSelect = pNMTreeView->itemNew.hItem;
}
//Luu Y bien hSelect la kieu HTREEITEM
Tree View ( Cây )
Insert :
Nút root : tvinsert.hParent = NULL;
tvinsert.item.pszText = “Root";
pTree->InsertItem(&tvinsert);
Ẩn hiện tab theo sự kiện TCN_SELCHANGE
If ( m_tabCtrl.GetCurSel() == 0 )
{ tab1.ShowWindow(SW_SHOW);
tab2.ShowWindow(SW_HIDE); }
HẾT PHẦN CONTROLS