windows:Interaction/pen

出自UXGuide.net

跳转到:导航, 搜索

手写笔
Pen

所有 Microsoft® Windows® 应用程序都应当可以使用手写笔来操作。这么做其实比你想像的要容易。

目录


“手写笔输入(pen input)”是指 Windows 允许你使用手写笔直接与计算机进行交互的方式。手写笔可以用于定点,也可以用于笔势(gesture)、简单文本输入、及使用电子墨水(digital ink)捕捉自由的灵感。

用于输入的“手写笔(pen)”带有细小而光滑的笔尖,以支持精确指向、书写或用电子墨水绘图。手写笔可能还具备可选的“手写笔按钮(pen button)”(用于执行右键单击)和“橡皮擦(eraser)”(用于擦除电子墨水)。大多数手写笔都支持悬停。

Cc872775_Pen01(en-us,MSDN_10).png

典型的手写笔

当手写笔用于书写时,用户的笔划可以使用“手写识别”转化为文本。笔划也能够以书写时的原样保留,而识别则在后台完成以支持文本方式的搜索和复制。这种未经转换的笔划也称为电子“墨水”。

Cc872775_Pen02(en-us,MSDN_10).png

电子墨水输入示例

大多数 Windows 程序已经是“手写笔友好(pen-friendly)”的了,手写笔可以用来代替鼠标,手写笔可以很好地用于最重要的任务和交互,且程序能够响应笔势。当一个程序支持手写文本输入时,即可认为是“手写友好(handwriting-friendly)”的。当一个程序可以正确处理电子墨水,而无须将手写笔转换为文本或等价的鼠标运动时,即可认为是“电子墨水可用(int-enabled)”的。这使用户能够用自由的、高质量的电子墨水进行书写、绘画或是添加批注。收集电子墨水与收集鼠标事件不同,因为电子墨水需要更高的分辨率和采样率,而且还要加上压力和倾角的差别。关于创建手写友好和电子墨水可用的程序,请参考电子墨水集成(英文)使用手写笔输入文本(英文)

定位手写笔对光标的需要较少,因为笔尖可以反映其自身的位置。但是,为了辅助定位,Windows 提供了一个极小的“手写笔光标”以标示当前笔的位置。与它所代替的鼠标指针不同,手写笔光标只会在手写笔靠近屏幕的时候才会显示,当不活动状态持续数秒后它就会消失以避免遮挡信息。

大多数手写笔友好的程序都支持笔势(gesture)。“笔势”是指手写笔在屏幕上的快速移动,计算机会将其解释为命令而非鼠标移动、书写或绘图。其中最快速容易的笔势就是划动。“划动”是一个简单的笔势,用于执行导航或编辑命令。导航划动笔势包括向上拖动、向下拖动、向后翻而和向前翻页,编辑划动笔势包括复制、粘贴、撤销和删除。

除了忙碌指针以外,所有的鼠标指针都有一个单像素的“热点(hot spot)”,用于定义鼠标指针在屏幕上的确切位置。热点决定了操作会影响到哪个对象。对象也定义有“热区(hot zone)”,表示热点位于哪些位置时被认为是在该对象之上。通常,热区与对象的边界是一致的,但为了便于操作,热区也可能会更大一些。

因为手写笔可以比手指进行更精确地定点,所以如果你的用户界面可以很好地用于触摸的话,就也可以很好地用于手写笔。因此,本文主要关注的是为那些已经是为触摸设计的程序添加对手写笔的支持。

注:鼠标触摸无障碍访问(辅助特性)相关的设计规范请参考各自相应的章节。


Design concepts

Using a pen for input has the following characteristics:

All Windows programs should have a good pen experience. Users should be able to perform your program's most important tasks efficiently using a pen. Some tasks, like typing or detailed pixel manipulation, aren't appropriate for a pen, but they should at least be possible.

Fortunately, if your program is already well designed and is touch-friendly, providing a good pen support is easy to do. For this purpose, a well-designed program:

Unfortunately, the converse is also true—if your program isn't well designed, its shortcomings are going to be especially obvious to users who use a pen.


Model for pen interaction

If you aren't experienced with using a pen, the best introduction is to learn by doing. Get a pen-enabled computer such as a Tablet PC, put the mouse and keyboard aside, and do the tasks that you normally do using just a pen. Be sure to try both ink-enabled programs, such as Windows Journal, and programs that aren't ink-enabled. If you have a Tablet PC, experiment with holding it in different positions, such as on your lap, lying flat on a table, or in your arms while you're standing. Try using it in portrait and landscape orientation, and holding the pen for writing and just for pointing, in your left hand as well as your right.

As you experiment with using a pen, you'll discover that:


Control location

As previously noted, task locality helps because repeating cross-screen movements becomes tedious. To minimize hand movements, locate controls close to where they are most likely going to be used.

Incorrect:

Cc872775_Pen03(en-us,MSDN_10).png


In this example, the color palette is too far from where it is likely to be used. The color palette was moved to the top in Windows Vista.

Consider that the user's current location is the closest a target can be, making it trivial to acquire. Thus, context menus take full advantage of Fitts' Law, as do the mini-toolbars and smart tags used by Microsoft Office.

Cc872775_Pen04(en-us,MSDN_10).png


The current pointer location is always the easiest to acquire.

Also, remember that small targets near the display edge can be difficult to target, so avoid placing small controls near window edges. To ensure that controls are easy to use when a window is maximized, either make them at least 23x23 pixels (13x13 DLUs), or place them away from the window edge.


Pen interactions

System gestures

System gestures are defined and handled by Windows. As a result, all Windows programs have access to them. System gestures map directly to equivalent mouse, keyboard, and application command messages:

System gesture Synthesized equivalent message
Hover (when supported) Mouse hover
Tap (down and up) Mouse left-click
Double tap (down and up twice) Mouse double left-click
Hold (down, pause, up) Mouse right-click
Drag (down, move, up) Mouse left-drag
Hold-drag (down, pause, move, up) Mouse right-drag
Select (down, move over selectable objects, up) Mouse select


Flicks

Flicks are simple gestures that are roughly the equivalent of keyboard shortcuts. Navigational flicks include drag up, drag down, move back, and move forward. Editing flicks include copy, paste, undo, and delete. To use flicks, your program only needs to respond to the related keystrokes commands.

Cc872775_Pen05(en-us,MSDN_10).png


The eight flick gestures and their default assignments in Windows Vista.

The navigational flicks have natural mapping, so they are easy to learn and remember. The editing flicks are diagonals that require more precision and their mappings are not as natural (flick towards the Recycle Bin to delete, flick in the Back arrow direction to undo), so these aren't enabled by default. All flick actions can be customized using the Pen and Input Devices control panel item.

Flick Synthesized equivalent message
Flick left Back application command
Flick right Forward application command
Flick up Keyboard Scroll Down one screenful
Flick down Keyboard Scroll Up one screenful
Flick up-left diagonal Keyboard Delete
Flick down-left diagonal Keyboard Undo
Flick up-right diagonal Keyboard Copy
Flick down-right diagonal Keyboard Paste


Application gestures

Applications can define and handle other gestures as well. The Microsoft Gesture Recognizer can recognize over 40 gestures. To use application gestures, your program must define the gestures it recognizes, and then handle the resulting events.


Editing ink and text

Editing ink and text are among the most challenging interactions when using a pen. Using constrained controls, appropriate default values, and auto-completion eliminates or reduces the need to input text. But if your program involves editing text or ink, you can make users more productive by automatically zooming input UI up to 150 percent by default when a pen is used.

For example, an e-mail program could display UI at normal size, but zoom the input UI to 150 percent to compose messages.

Cc872775_Pen07(en-us,MSDN_10).png


In this example, the input UI is zoomed to 150 percent.

If you do only two things...

  1. Make your Windows programs have a good pen experience! Users should be able to perform your program's most important tasks efficiently using a pen (at least those tasks that don't involve a lot of typing or detailed pixel manipulation).
  2. Consider adding support for writing, drawing, and adding comments directly using ink in the most relevant scenarios.


Guidelines

Control usage

Cc872775_Pen08(en-us,MSDN_10).png
In this example, the system metric for menu height was changed.


Control sizing, layout, and spacing


Interaction


Handedness

Cc872775_Pen09(en-us,MSDN_10).png
Show contextual windows near the object that it was launched from.
Cc872775_Pen10(en-us,MSDN_10).png
When using a pen, also show contextual windows so that they aren't covered by the user's hand.


Forgiveness


Documentation

When referring to pen input:

导航
工具箱