急等...windows programing的问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了急等...windows programing的问题相关的知识,希望对你有一定的参考价值。
任务是做一个画板,大多功能都实现..就是不会缩放..
如何用映射模式进行整体的缩放呢?
SetWindowExtEx 和SetViewportExtEx具体什么功能,为什么说改变里面的参数可以达到缩放的效果呢...一头雾水,望大家指教....
The SetViewportExtEx function sets the horizontal and vertical extents of the viewport for a device context by using the specified values.
BOOL SetViewportExtEx(
HDC hdc, // handle to device context
int nXExtent, // new horizontal viewport extent
int nYExtent, // new vertical viewport extent
LPSIZE lpSize // original viewport extent
);
Parameters
hdc
[in] Handle to the device context.
nXExtent
[in] Specifies the horizontal extent, in device units, of the viewport.
nYExtent
[in] Specifies the vertical extent, in device units, of the viewport.
lpSize
[out] Pointer to a SIZE structure that receives the previous viewport extents, in device units. If lpSize is NULL, this parameter is not used.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Windows NT/2000/XP: To get extended error information, call GetLastError.
Remarks
The viewport refers to the device coordinate system of the device space. The extent is the maximum value of an axis. This function sets the maximum values for the horizontal and vertical axes of the viewport in device coordinates (or pixels). When mapping between page space and device space, SetWindowExtEx and SetViewportExtEx determine the scaling factor between the window and the viewport. For more information, see Transformation of Coordinate Spaces.
When the following mapping modes are set, calls to the SetWindowExtEx and SetViewportExtEx functions are ignored.
MM_HIENGLISH
MM_HIMETRIC
MM_LOENGLISH
MM_LOMETRIC
MM_TEXT
MM_TWIPS
When MM_ISOTROPIC mode is set, an application must call the SetWindowExtEx function before it calls SetViewportExtEx. Note that for the MM_ISOTROPIC mode certain portions of a nonsquare screen may not be available for display because the logical units on both axes represent equal physical distances.
Example Code
For an example, see Invalidating the Client Area.
Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Wingdi.h; include Windows.h.
Library: Use Gdi32.lib.
See Also
Coordinate Spaces and Transformations Overview, Coordinate Space and Transformation Functions, GetViewportExtEx, SetWindowExtEx, SIZE
Parameters
hdc
[in] Handle to the device context.
nXExtent
[in] Specifies the window's horizontal extent in logical units.
nYExtent
[in] Specifies the window's vertical extent in logical units.
lpSize
[out] Pointer to a SIZE structure that receives the previous window extents, in logical units. If lpSize is NULL, this parameter is not used.
SetWindowExtEx :
SetWindowExtEx
The SetWindowExtEx function sets the horizontal and vertical extents of the window for a device context by using the specified values.
BOOL SetWindowExtEx(
HDC hdc, // handle to device context
int nXExtent, // new horizontal window extent
int nYExtent, // new vertical window extent
LPSIZE lpSize // original window extent
);
Parameters
hdc
[in] Handle to the device context.
nXExtent
[in] Specifies the window's horizontal extent in logical units.
nYExtent
[in] Specifies the window's vertical extent in logical units.
lpSize
[out] Pointer to a SIZE structure that receives the previous window extents, in logical units. If lpSize is NULL, this parameter is not used.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Windows NT/2000/XP: To get extended error information, call GetLastError.
Remarks
The window refers to the logical coordinate system of the page space. The extent is the maximum value of an axis. This function sets the maximum values for the horizontal and vertical axes of the window (in logical coordinates). When mapping between page space and device space, SetViewportExtEx and SetWindowExtEx determine the scaling factor between the window and the viewport. For more information, see Transformation of Coordinate Spaces.
When the following mapping modes are set, calls to the SetWindowExtEx and SetViewportExtEx functions are ignored:
MM_HIENGLISH
MM_HIMETRIC
MM_LOENGLISH
MM_LOMETRIC
MM_TEXT
MM_TWIPS
When MM_ISOTROPIC mode is set, an application must call the SetWindowExtEx function before calling SetViewportExtEx. Note that for the MM_ISOTROPIC mode, certain portions of a nonsquare screen may not be available for display because the logical units on both axes represent equal physical distances.
Example Code
For an example, see Invalidating the Client Area.
Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Wingdi.h; include Windows.h.
Library: Use Gdi32.lib.
See Also 参考技术B 上面的太过分了!本回答被提问者采纳
stc 51单片机延时程序,不能进入中断,在线急等解答!
#include <stc12c5a60s2.h>
#include <stdio.h>
#define uint unsigned int
#define uchar unsigned char
uint a;
uint aa,flag0;
sbit out0=P2^0;
sbit out1=P2^1;
---------------------------
void maininit(void)
out0 = 1;
out1 = 1;
a=0;
aa=0;
flag0=0;
---------------------------------------
void Timer0Init(void)
AUXR &= 0x7F; // 定时器时钟为12T模式
TMOD &= 0xF0; // 1111 0000 清零TMOD低四位,不更改上面串口中断所用定时器1
TMOD |= 0x01; // 0000 0001 设置定时器0为16为定时器
TL0 = 0x00; // 设置定时器初值
TH0 = 0x4C; // 设置定时器初值
TF0 = 0; // 清除TF0标志(定时器0溢出标志位)
TR0 = 1; // 定时器0开始计时
EA = 1; // 开总中断
ET0 = 1; // 开定时器0中断
------------------------------------------------
void timer0_zd() interrupt 1 //定时器0,定时中断子程序
TL0 = 0x00; // 设置定时器初值
TH0 = 0x4C; // 设置定时器初值
a++; //开关按下延时,延时到之后,电磁阀开始动作。
if(a==20) //延时20*50毫秒 = 1秒
flag0=1;
---------------------------------------------------
void main()
maininit();
Timer0Init();
while(1)
if(key==0) //key为自锁开关,也就是key==0一直满足。
aa++;
if(aa==1)
a=0;
bb=1;
flag0=0;
out0=0;
if(bb==1 && flag0==1)
out1=0;
说明白了,我想达到的效果很简单,就是,一上电,启动定时器0,和定时器0中断,每进入中断1次,a自加1,但是当按下开关时候,把a清零,开始算时间,当a等于20时候,就说明计时时间到了。
问题点就是:主程序out1=0,不会执行。
很高兴收到大家的帮助,但是三条回答都没有说到正点上,我后来已经发现问题原因,我说key==0条件一直满足的意思是,正常情况没有按下为1,按下之后会一直为0,这个问题的原因是:aa++的条件一直在循环执行,我本来以为不管这个值再怎么循环自加,aa=1的情况只会发生一次,后来发现错了,aa是unsigned char的类型,如果aa自加超过65535,就会发生数据溢出,而会造成不稳定的状态,所以这里就会发生aa==1,就一直在清零a,所以也就无法得到计时结束flag0=1。
请加括号 参考技术B 可以发给我看看
我做单片机的
以上是关于急等...windows programing的问题的主要内容,如果未能解决你的问题,请参考以下文章
Win7旗舰版电脑突然卡主,然后重启后显示hal丢失或损坏无法加载怎么办?这是办公的电脑。急等。