home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / mswindo / programm / misc / 1610 < prev    next >
Encoding:
Text File  |  1992-08-31  |  1.4 KB  |  38 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!microsoft!hexnut!blakeco
  3. From: blakeco@microsoft.com (Blake Coverett)
  4. Subject: Re: SetViewportExt and Screen Mapping
  5. Message-ID: <1992Sep01.030312.5301@microsoft.com>
  6. Date: 01 Sep 92 03:03:12 GMT
  7. Organization: Microsoft Canada Inc.
  8. References: <92242.153745IO70935@MAINE.MAINE.EDU>
  9. Lines: 27
  10.  
  11. In article <92242.153745IO70935@MAINE.MAINE.EDU> <IO70935@MAINE.MAINE.EDU> writes:
  12. >I working on an application that requires a real time display for a data acqusi
  13. >stion program and I need to remap the window. I would like to map the window in
  14. > a user coordinate system such that one corner is x1,y1 and the other x2,y2. I
  15. >am looking for any information or examples of how to do this my BC 3.0 Manuals
  16. >are no help and Microsofts Reference Book little better. Thanks in advance.
  17.  
  18. HDC GetScaledDC(HWND hwnd, int left, int top, int right, int bottom)
  19. {
  20.     HDC hdc;
  21.     RECT r;
  22.  
  23.     hdc = GetDC(hWnd);
  24.     GetClientRect(hWnd, &r);
  25.     SetMapMode(hdc, MM_ANISOTROPIC);
  26.     SetWindowOrg(hdc, left, bottom);
  27.     SetWindowExt(hdc, right-left, top-bottom);
  28.     //SetViewportOrg(hdc, 0, 0); This is the default in a clean DC
  29.     SetViewportExt(hdc, r.right, r.bottom);
  30.  
  31.     return hdc;
  32. }
  33.  
  34. -Blake (typed off the top of my head, all disclaimers apply)
  35. -- 
  36. #include <std/disclaimer.h>                       blakeco@microsoft.com
  37. Mail Flames, Post Apologies.                      ...!uunet!microsoft!blakeco
  38.