Visual C++ and MFC Fundamentals programming phần 7

Chức năng này không có đối số nhưng trả về dòng lệnh của một ứng dụng như là một chuỗi nullterminated. Dưới đây là một ví dụ: khoảng trống CCommandLineDlg:: OnBtnCmdLine () {/ / TODO: Thêm mã kiểm soát xử lý thông báo của bạn | Chapter 15 Fundamental Controls Visual C and MFC Fundamentals GetClientRect function is called to get the dimensions of the view s client area of a frame -based application and use the resulting rectangle to paint that area void CCView1View OnPaint CPaintDC dc this device context for painting TODO Add your message handler code here CRect Recto CBrush SelectedBrush SelectedColor CPen SelectedBlue PS_SOLID 1 SeiectedColor GetClientRect Recto CBrush pOldBrush SelectedBrush CPen pOldPen SelectedBlue Recto pOldBrush Do not call CView OnPaint for painting messages Once the control is already positioned on the client area to get its location and dimensions you can call the CWnd GetWindowRect method. Here is an example void CTabDlg OnBtnInfo . TODO Add your control notification handler code here CRect Recto char LocDim 80 Recto sprintf LocDim - Panel Information - nLeft d nTop d nWidth d nHeight d MessageBox LocDim Practical Learning Using the Client Area 1. Open the Geometry application you were working on earlier 2. Open the source file and change its OnPaint event as follows 426 FunctionX Inc. Visual C and MFC Fundamentals Chapter 15 Fundamental Controls void CQuadrilateral OnPaint CPaintDC dc this device context for painting CRect Recto Create a light green brush CBrush BruShLightGreen RGB 212 235 235 Create a navy pen CPen PenNavy PS_SOLID 1 RGB 0 0 128 Create a green brush CBrush BrushGreen RGB 100 175 180 Create a dark green pen CPen PenGreen PS_SOLID 2 RGB 0 115 115 Get the location and dimensions of the client rectangle GetClientRect Recto Select the light green brush CBrush pOldBrush BrushLightGreen Select the navy pen CPen pOldPen PenNavy Draw a rectangular shape on the left side of the property page 0 0 162 Select the green brush pOldBrush .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.