iTextInputPanel::SetInPlacePosition 方法 (peninputpanel.h)

[ITextInputPanel 可在“要求”部分指定的操作系统中使用。 它可能在后续版本中变更或不可用。 请改用 IInputPanelConfiguration

]

将平板电脑输入面板显式定位在屏幕坐标中。

语法

HRESULT SetInPlacePosition(
  int                xPosition,
  int                yPosition,
  CorrectionPosition position
);

参数

xPosition

输入面板左上角的水平 x 坐标,没有可见的更正梳。

yPosition

输入面板左上角的垂直 y 坐标,没有可见的更正梳。

position

插入后更正梳子应弹出的方向,由 CorrectionPosition 枚举定义。

返回值

当输入面板打开 (停靠或浮动) 且无法移动时,返回 false ;否则返回 true

返回代码 说明
S_OK
成功。
E_FAIL
发生了未指定的错误。

注解

注意 在 Windows 7 中,调用 SetInPlacePosition 将不再使用 CorrectionPosition 参数。
 
在确定输入面板的位置时,请记住更正梳子的高度,以便使输入面板和更正梳子保持在屏幕上。 position 参数中指定的方向使用 ITextInputPanel::P referredInPlaceDirection 属性替代方向设置。

输入面板的放置位置没有限制。 应用程序开发人员负责确保输入面板不会离开屏幕。 ITextInputPanel::InPlaceBoundingRectangle 属性ITextInputPanel::P opUpCorrectionHeight 属性ITextInputPanel::P opDownCorrectionHeight 属性以及 ITextInputPanelEventSink::InPlaceSizeChanging 方法可用于此目的。

此方法是同步方法。 定位在方法返回之前发生。

示例

此 C++ 示例实现 EN_SETFOCUS Edit 控件 IDC_EDIT3的事件处理程序。 它首先检查是否已创建 ITextInputPanel 对象 g_pTip。 如果存在,它将报告多个 ITextInputPanel 接口 属性的值,以使用 TRACE 宏调试输出。 它还通过调用 ITextInputPanel::SetInPlacePosition 方法设置输入面板的位置。

void CCOMTIPDlg::OnEnSetFocusEdit3()
{
    if (NULL != g_pTip)
    {
		CorrectionMode mode;

		if (SUCCEEDED(g_pTip->get_CurrentCorrectionMode(&mode)))
        {
			TRACE("CurrentCorrectionMode: %d\n", mode);
		}

		InPlaceState state;

		if (SUCCEEDED(g_pTip->get_CurrentInPlaceState(&state)))
        {
			TRACE("CurrentInPlaceState: %d\n", state);
		}

		PanelInputArea area;

		if (SUCCEEDED(g_pTip->get_CurrentInputArea(&area)))
        {
			TRACE("CurrentInputArea: %d\n", area);
		}

		InteractionMode iMode;

		if (SUCCEEDED(g_pTip->get_CurrentInteractionMode(&iMode)))
        {
			TRACE("CurrentInteractionMode: %d\n", iMode);
		}

        RECT rect;

		if (SUCCEEDED(g_pTip->get_InPlaceBoundingRectangle(&rect)))
        {
	        TRACE("InPlaceBoundingRectangle.top: %d\n", rect.top);
	        TRACE("InPlaceBoundingRectangle.left: %d\n", rect.left);
	        TRACE("InPlaceBoundingRectangle.bottom: %d\n", rect.bottom);
	        TRACE("InPlaceBoundingRectangle.right: %d\n", rect.right);
        }

	    int nHeight;

		if (SUCCEEDED(g_pTip->get_PopDownCorrectionHeight(&nHeight)))
        {
	        TRACE("PopDownCorrectionHeight: %d\n", nHeight);
        }

	    if (SUCCEEDED(g_pTip->get_PopUpCorrectionHeight(&nHeight)))
        {
	        TRACE("PopUpCorrectionHeight: %d\n", nHeight);
        }

		if (SUCCEEDED(g_pTip->SetInPlacePosition(300, 300, CorrectionPosition_Bottom)))
		{
			TRACE("Call to SetInPlacePosition() succeeded.\n");
		}
		else
		{
			TRACE("Call to SetInPlacePosition() failed.\n");
		}
    }
    else
    {
        TRACE("ITextInputPanel object is NULL.\n");
    }
}

要求

要求
最低受支持的客户端 Windows XP Tablet PC Edition [仅限桌面应用]
最低受支持的服务器 无受支持的版本
目标平台 Windows
标头 peninputpanel.h
DLL Tiptsf.dll

另请参阅

ITextInputPanel 接口

ITextInputPanel::SetInPlaceHoverTargetPosition 方法

ITextInputPanel::SetInPlaceVisibility 方法