锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / 英语翻译 / ZOOMVIEW原文翻译
服务方向
人工智能数据处理
人工智能培训
kaldi数据准备
小语种语音识别
语音识别标注
语音识别系统
语音识别转文字
kaldi开发技术服务
软件开发
运动控制卡上位机
机械加工软件
量化预测
股票离线分析软件
软件开发培训
Java 安卓移动开发
VC++
C#软件
汇编和破解
驱动开发
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883
微信:ryysoft

锐英源精品原创,禁止转载和任何形式的非法内容使用,违者必究

Automatic Scaling in Windows窗口内自动缩放

Many Windows applications need the ability to arbitrarily scale, or zoom, the contents of a window.An example of this is print preview, where you can zoom in
and out on a portion of the printed page. Programming information on this subject is minimal and very obfuscated. Not any more! In this article I explain how to easily use the built it scaling capabilities of Windows, and apply it to a C++ MFC extension class that I call CZoomView.很多窗口程序需要能处理任意比例地显示(也就是缩放)窗口的内容。打印预览就是个例子,预览时你能缩放打印页。这个方向的编程信息很少且非常模糊。本文会解释怎样容易地使用这方面的技术,怎样处理我封装到CZoomView类里了。

Learning To Scale学习缩放

Proper scaling in Microsoft Windows requires you to set the map mode, window extent, window origin, viewport extent, and viewport origin for a window.
Are you confused yet Try reading the manual entries for any corresponding API - SetWindowExt: Sets the x- and y-extents of the window... So it wasn't just a clever name.合适的缩放需要你设置映射模式,窗口大小,窗口原点,视口大小和视口原点。
如果对概念不理解,请尝试阅读手册上API的帮助--SetWindowExt:设置x方向和y方向的宽度.所以,它不只是个应景的名称。
A key phrase, however, comes next: defines how GDI maps points in the logical coordinate system to points in the device coordinate system. Although this
information tells you nothing on how to use it, it is the clue to how it works -- mapping from one coordinate system to another. To make scaling easy, we want Windows to do as much of this conversion work as possible. Luckily for us, it can be done easily if you arm yourself with just a little bit of API knowledge..关键阶段是下面的: GDI怎样定义从逻辑坐标系到设备坐标系的映射?尽管在使用上此点信息少,但是这是工作的关键加在线--从坐标系映射到其它坐标系里。为了让缩放容易,我们想让Windows做更多的事情。幸运的是,在掌握API信息的基本基础下,就会得到比较好的武装。
For a drawing page to be automatically scaled in a window, two concepts must be understood.The first is how to draw the page, and the second is how to
view the page. The Windows operating system uses both pieces of information together so that a user can view your drawing in a window at any arbitrary zooming
scale. As a teprogrammer, the easiest way to understand and implement scaling is to "divide and conquer," handling each concept separately.对于绘制窗口里自动缩放的页面来说,
2个概念必须理解。首先是怎样绘制,其次是怎样查看页面。Windows操作系统集成使用了这2块的信息,这让用户能够在窗口内以任意比例查看绘制结果。做为程序员,最容易的理解和实现缩放的方法是“分而治之”,单独处理每个概念。

Step One: Drawing the Page绘制页面

The first thing that you need to do is choose the logical units,for your drawing.Think of this as the number of virtual horizontal and vertical units on a page
you will draw on. This is what Windows calls the 揥indow Extent," and is set by the SetWindowExt API. A logical page size of x by y units would simply have a window
extent of {x, y}. Keep in mind that "units" is an arbitrary amount of measure that you pick, so do not be stuck thinking that it has to be pixels, inches, or any other
measure.首先要做的是选择逻辑单位。把它理解为在页面上的虚拟的宽高单位的个数。这也是Windows里的窗口大小称呼。这个大小通过SetWindowExt API函数来设计。一个逻辑页面大小象个组合{x,y}。记好"单位"是你选择的度量衡,有任意的大小的,所以不要着眼于想着它必须是像素,英寸或其它度量单位。
Once you choose a logical coordinate system, all GDI drawing will be done using it. For example, lets say that you want to draw a line from the top left corner to
the bottom right corner of a page that has a window extent of 100 by 100 logical units. Using the MoveTo and LineTo API functions, you would pass {0, 0} as the
starting logical coordinate to MoveTo, and {100, 100} as the ending logical coordinate to LineTo. Any other GDI function (Rectangle, Arc, CreateFont, TextOut,
etc.) will also use logical units. // ADD DRAWING ONE HERE一旦你选择好了逻辑坐标系,所以GDI的绘制会使用它。比如,你想绘制线,窗口大小是{100,100},从左上角到右下角来绘制。使用MoveTo和LineTo函数来处理,你会从{0,0}位置开始,这要先MoveTo到这个位置,接着是结束位置选择{100,100},使用LineTo来画到这个坐标上。其它GDI函数(Rectangle,Arc,CreateFont,Textout等等)同样使用逻辑单位。
Using logical units allows your program display device independence. Drawing objects coordinates can all be stored in logical units, and you will use those
coordinates when painting your windows without needing to do any conversions for scaling, different size screens, or different size windows. Doing any device
dependent conversions, and determining which part of the drawing to actually scale and display to the user in a window, will be handled automatically by Windows after
you follow the next step.使用逻辑单位允许你程序设备无关地显示。绘制对象的坐标能以逻辑单位来存储,在绘制窗口时不再为比例、不同的屏幕尺寸或不同的窗口大小来进行转换, 用这些坐标就可以进行绘制了。只要你按如下步骤处理,任何设备相关的转换,决定绘制结果中哪一部分来确实地缩放和显示给用户,会被Windows自动地处理。

友情链接
版权所有 Copyright(c)2004-2024 锐英源软件
统一社会信用代码:91410105098562502G 豫ICP备08007559号 最佳分辨率 1440*900
地址:郑州市金水区文化路97号郑州大学北区院内南门附近