• 大小: 1.13MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-25
  • 语言: 其他
  • 标签: 内定向  

资源简介

编程要点 /////坐标转换///////////// CClientDC dc(this); //定义设备对象 OnPrepareDC(&dc); //初始化设备对象 CPoint local=point; //定义CPoint类实体,并初始化为设备坐标 dc.DPtoLP(&local); //将设备坐标转为逻辑坐标 //将该段程序放入OnLButtonDown(UINT nFlags, CPoint point) //和OnMouseMove(UINT nFlags, CPoint point)中 //////////////////////////显示光标位置 CString msg; msg.Format(" X = %4d, Y = %4d ", local.x,local.y); CMainFrame* pAppFrame = (CMainFrame*) AfxGetApp()->m_pMainWnd; pAppFrame->m_wndStatusBar.SetPaneText(0,msg); pAppFrame->m_wndStatusBar.UpdateWindow(); /////改变光标///////////// CSize ScrollSize=GetTotalSize(); CRect ScrollRect(0,0,ScrollSize.cx,ScrollSize.cy); if(m_SelectFunction!=13) { if(!ScrollRect.PtInRect(local)) ::SetCursor(m_HCross); else ::SetCursor(m_HArrow); //将该段程序放入OnMouseMove(UINT nFlags, CPoint point)中,并放在坐标转换的后面 //在视图类的头文件的public:后面加上两个光标句柄 HCURSOR m_HArrow; HCURSOR m_HCross; //在视图类的CCP文件的类构造器中加入以下两句 m_HArrow=AfxGetApp()->LoadStandardCursor(IDC_ARROW); m_HCross=AfxGetApp()->LoadStandardCursor(IDC_CROSS);

资源截图

代码片段和文件信息

//  dibapi.cpp
//
//  Source file for Device-Independent Bitmap (DIB) API.  Provides
//  the following functions:
//
//  PaintDIB()          - Painting routine for a DIB
//  CreateDIBPalette()  - Creates a palette from a DIB
//  FindDIBBits()       - Returns a pointer to the DIB bits
//  DIBWidth()          - Gets the width of the DIB
//  DIBHeight()         - Gets the height of the DIB
//  PaletteSize()       - Gets the size required to store the DIB‘s palette
//  DIBNumColors()      - Calculates the number of colors
//                        in the DIB‘s color table
//  CopyHandle()        - Makes a copy of the given global memory block
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1997 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.

#include “stdafx.h“
#include “dibapi.h“
#include 
#include 

/*************************************************************************
 *
 * PaintDIB()
 *
 * Parameters:
 *
 * HDC hDC          - DC to do output to
 *
 * LPRECT lpDCRect  - rectangle on DC to do output to
 *
 * HDIB hDIB        - handle to global memory with a DIB spec
 *                    in it followed by the DIB bits
 *
 * LPRECT lpDIBRect - rectangle of DIB to output into lpDCRect
 *
 * CPalette* pPal   - pointer to CPalette containing DIB‘s palette
 *
 * Return Value:
 *
 * BOOL             - TRUE if DIB was drawn FALSE otherwise
 *
 * Description:
 *   Painting routine for a DIB.  Calls StretchDIBits() or
 *   SetDIBitsToDevice() to paint the DIB.  The DIB is
 *   output to the specified DC at the coordinates given
 *   in lpDCRect.  The area of the DIB to be output is
 *   given by lpDIBRect.
 *
 ************************************************************************/

BOOL WINAPI PaintDIB(HDC     hDC
LPRECT  lpDCRect
HDIB    hDIB
LPRECT  lpDIBRect
CPalette* pPal)
{
LPSTR    lpDIBHdr;            // Pointer to BITMAPINFOHEADER
LPSTR    lpDIBBits;           // Pointer to DIB bits
BOOL     bSuccess=FALSE;      // Success/fail flag
HPALETTE hPal=NULL;           // Our DIB‘s palette
HPALETTE hOldPal=NULL;        // Previous palette

/* Check for valid DIB handle */
if (hDIB == NULL)
return FALSE;

/* Lock down the DIB and get a pointer to the beginning of the bit
 *  buffer
 */
lpDIBHdr  = (LPSTR) ::GlobalLock((HGLOBAL) hDIB);
lpDIBBits = ::FindDIBBits(lpDIBHdr);

// Get the DIB‘s palette then select it into DC
if (pPal != NULL)
{
hPal = (HPALETTE) pPal->m_hobject;

// Select as background since we have
// already realized in forground if needed
hOldPal = ::SelectPalette(hDC hPa

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      14260  1998-08-22 16:42  Diblook2\dibapi.cpp

     文件       1663  1998-08-22 16:42  Diblook2\dibapi.h

     文件       5009  2003-05-24 16:17  Diblook2\dibdoc.cpp

     文件       1464  1998-08-22 16:42  Diblook2\dibdoc.h

     文件       8899  1998-08-22 16:42  Diblook2\diblmac.r

     文件       4736  1998-08-22 16:42  Diblook2\diblook.001

     文件      37164  2011-05-12 15:15  Diblook2\DibLook.aps

     文件       7836  2011-05-12 15:17  Diblook2\diblook.clw

     文件       4384  2003-05-28 12:19  Diblook2\diblook.cpp

     文件       5375  2010-01-06 21:22  Diblook2\diblook.dsp

     文件        539  2001-03-08 16:34  Diblook2\diblook.dsw

     文件     278528  1998-08-22 16:42  Diblook2\diblook.exe

     文件       1211  1998-08-22 16:42  Diblook2\diblook.h

     文件      28560  1998-08-22 16:42  Diblook2\diblook.mak

     文件      80896  2011-05-12 15:19  Diblook2\diblook.opt

     文件       2245  2011-05-12 09:36  Diblook2\diblook.plg

     文件      19616  2011-05-12 09:36  Diblook2\DibLook.rc

     文件       9333  1998-08-22 16:42  Diblook2\diblook.rcm

     文件      15497  2011-05-12 09:36  Diblook2\dibview.cpp

     文件       2347  2011-05-12 09:35  Diblook2\dibview.h

     文件       1759  2010-01-04 21:31  Diblook2\InputKB.cpp

     文件       1399  2010-01-04 21:31  Diblook2\InputKB.h

     文件       9721  1998-08-22 16:42  Diblook2\l.jpn\diblook.rc

     文件       3355  1998-08-22 16:42  Diblook2\mainfrm.cpp

     文件       1181  2009-12-29 21:16  Diblook2\mainfrm.h

     文件        625  1998-08-22 16:42  Diblook2\makefile

     文件       2621  2010-01-08 18:43  Diblook2\matrix.cpp

     文件        350  2010-01-08 18:41  Diblook2\matrix.h

     文件       8298  1998-08-22 16:42  Diblook2\myfile.cpp

     文件      36270  2010-10-31 20:27  Diblook2\RCa03396

............此处省略37个文件信息

评论

共有 条评论