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

Tài liệu Visual C-018 Thêm ToolTip cho đối tượng trên Dialog pdf

4 362 0
Tài liệu đã được kiểm tra trùng lặp

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Thêm ToolTip cho đối tượng trên Dialog
Tác giả Văn Chí Nam, Nguyễn Anh Hoàng
Trường học Trường Đại học Khoa học Tự nhiên Thành phố Hồ Chí Minh
Chuyên ngành Công nghệ thông tin
Thể loại tài liệu
Năm xuất bản 2005
Thành phố Ho Chi Minh City
Định dạng
Số trang 4
Dung lượng 207,34 KB

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

Nội dung

GetText Retrieves the text that a tool tip control maintains for a tool.. GetToolInfo Retrieves the information that a tool tip control maintains about a tool.. GetToolCount Retrieves a

Trang 1

Thêm ToolTip cho các control trong

VISUAL C++ 6.0

V n Chí Nam, Nguy n c Hoàng H

Khoa Công ngh Thông tin, tr ng H KHTN TP.HCM vcnam@fit.hcmuns.edu.vn, ndhha@fit.hcmuns.edu.vn

Phiên b n c p nh t ngày 15/05/2005

Tooltip là m t dòng đ n chú thích hi n ra bên c nh control khi chu t di chuy n phía trên "khu v c" c a đ i t ng Tooltip th ng đ c dùng nh là m t ghi chú h ng

d n ng i s d ng ch c n ng c a đ i t ng đang h ng đ n

MFC h tr m t l p đ th c hi n công vi c này ó là l p CToolTipCtrl

GI I THI U V CTOOLTIPCTRL

Các ch c n ng cu l p này chúng ta có th tìm hi u thêm MSDN, đây tôi ch ghi l i tóm t t các hàm có th dùng c a CToolTipCtrl :

Create Creates a tool tip control and attaches it to a CToolTipCtrl object

GetText Retrieves the text that a tool tip control maintains for a tool

GetToolInfo Retrieves the information that a tool tip control maintains about a

tool

SetToolInfo Sets the information that a tool tip maintains for a tool

GetToolCount Retrieves a count of the tools maintained by a tool tip control GetDelayTime Retrieves the initial, pop-up, and reshow durations currently set for

a tool tip control

SetDelayTime Sets the initial, pop-up, and reshow durations for a tool tip control GetMargin Retrieves the top, left, bottom, and right margins set for a tool tip

window

SetMargin Sets the top, left, bottom, and right margins for a tool tip window GetMaxTipWidth Retrieves the maximum width for a tool tip window

Trang 2

SetMaxTipWidth Sets the maximum width for a tool tip window

GetTipBkColor Retrieves the background color in a tool tip window

SetTipBkColor Sets the background color in a tool tip window

GetTipTextColor Retrieves the text color in a tool tip window

SetTipTextColor Sets the text color in a tool tip window

Activate Activates and deactivates the tool tip control

AddTool Registers a tool with the tool tip control

DelTool Removes a tool from the tool tip control

HitTest Tests a point to determine whether it is within the bounding rectangle of

the given tool and, if so, retrieves information about the tool

RelayEvent Passes a mouse message to a tool tip control for processing

SetToolRect Sets a new bounding rectangle for a tool

UpdateTipText Sets the tool tip text for a tool

Update Forces the current tool to be redrawn

Pop Removes a displayed tool tip window from view

THÊM TOOLTIP CHO M T CONTROL

Trong ph n này, tôi ch trình bày vi c thêm tooltip cho đ i t ng trên dialog (dialog - based) b i vì vi c thêm tooltip cho các đ i t ng trong ch đ Document - View

có th đ c th c hi n thông qua String Resource

Các b c th c hi n :

- B c 1 : Thêm vào trong l p c a Dialog (C…Dlg) m t con tr ki u

CToolTipCtrl :

CToolTipCtrl* m_pToolTip;

- B c 2: Trong hàm OnInitDialog(), thêm vào các dòng l nh sau :

m_pToolTip = new CToolTipCtrl;

//Khai báo con tr ki u CWnd đ dùng trong vi c thêm tooltip cho đ i t ng

CWnd* pWnd;

//c p b nh thành công

if (m_pToolTip)

Trang 3

{

//Kh i t o con tr Tooltip

if (!m_pToolTip->Create(this))

{

MessageBox("Khong the tao ToolTip");

OnOK();

}

/*

N u mu n thêm tooltip cho đ i t ng IDOK thìl y con tr pWnd t IDOK

*/

pWnd = GetDlgItem(IDOK);

//L y hình ch nh t bao quanh IDOK

pWnd->GetClientRect(rect);

/*Thêm vào đ i t ng tooltip m t tool m i*/

/* Tham s th nh t : con tr ch đ n đ i t ng c n thêm tooltip

Tham s th hai : Chu i th hi n trong tooltip

Tham s th ba : Hình ch nh t bao quanh tooltip

Tham s th t : S hi u cu tool trong tooltip control (IDTool)

*/

m_pToolTip->AddTool(pWnd,"Bam vao day de thoat",rect,1);

}

- B c 3 : Thêm vào l p CTamDlg hàm PreTranslateMessage, hàm này có tác

d ng x lý thông đi p tr c khi g i đ n c a s Thông đi p ph i đ c đ a đ n cho tooltip control tr c Dùng hàm RelayEvent cu CToolTipCtrl đ làm công vi c x lý thông đi p cho tooltip

BOOL CToolTipDlg::PreTranslateMessage(MSG* pMsg)

{

if (m_pToolTip!=NULL)

{

m_pToolTip->RelayEvent(pMsg);

Trang 4

}

return CDialog::PreTranslateMessage(pMsg); }

Hình nh minh h a khi ch y đo n ch ng trình trên

Ngày đăng: 24/01/2014, 02:20

HÌNH ẢNH LIÊN QUAN

Hình  nh minh h a khi ch y đo n ch ng trình trên - Tài liệu Visual C-018 Thêm ToolTip cho đối tượng trên Dialog pdf
nh nh minh h a khi ch y đo n ch ng trình trên (Trang 4)

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w