PenInputPanel.Refresh 方法
已取代。根據 [Tablet PC 輸入面板] 更新並還原 PenInputPanel 屬性、自動定位「畫筆輸入面板」,以及將使用者介面設為預設面板。PenInputPanel 已被 Microsoft.Ink.TextInput 取代。
命名空間: Microsoft.Ink
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
語法
'宣告
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Name := "FullTrust")> _
<UIPermissionAttribute(SecurityAction.Demand, Window := UIPermissionWindow.SafeTopLevelWindows)> _
<SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted := True)> _
Public Sub Refresh
'用途
Dim instance As PenInputPanel
instance.Refresh()
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
[UIPermissionAttribute(SecurityAction.Demand, Window = UIPermissionWindow.SafeTopLevelWindows)]
[SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted = true)]
public void Refresh()
[PermissionSetAttribute(SecurityAction::InheritanceDemand, Name = L"FullTrust")]
[UIPermissionAttribute(SecurityAction::Demand, Window = UIPermissionWindow::SafeTopLevelWindows)]
[SecurityPermissionAttribute(SecurityAction::Demand, Unrestricted = true)]
public:
void Refresh()
/** @attribute PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust") */
/** @attribute UIPermissionAttribute(SecurityAction.Demand, Window = UIPermissionWindow.SafeTopLevelWindows) */
/** @attribute SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted = true) */
public void Refresh()
public function Refresh()
備註
Refresh 方法會還原預設面板。例如,如果 DefaultPanel 屬性設為 [鍵盤] 且 CurrentPanel 屬性設為 [手寫],則 Refresh 方法會將畫筆輸入面板設為 [鍵盤]。如果 DefaultPanel 屬性設定為 [預設],則 Refresh 方法不會變更畫筆輸入面板。
Refresh 方法會相對於附加畫筆輸入面板的控制項,自動定位畫筆輸入面板。
Refresh 方法會使用 [Tablet PC 輸入面板] 設定更新畫筆輸入面板。例如,您可以對 PenInputPanel 物件進行變更,然後呼叫 Refresh 將設定還原為自 [輸入面板] 複製的設定。
PenInputPanel 物件會在 [輸入面板] 上的設定變更時自動更新。
在畫筆輸入面板未擁有焦點時呼叫 Refresh 方法會產生錯誤。
![]() |
---|
通常您不需要呼叫 Refresh,因為功能會在啟動畫筆輸入面板時表示。不過,如果 AutoShow 屬性設為 false,您可以停用啟動畫筆輸入面板。如果要這樣做,請使用 Refresh 方法重新整理 PenInputPanel 物件。 |
![]() |
---|
自 Microsoft® Windows® XP Tablet PC Edition 2005 起,Refresh 方法已被取代,而且不會有任何作用。 |
![]() |
---|
如果在部分信任的情況下使用,除了 PenInputPanel 所需的權限之外,這個方法還需要 SecurityPermissionFlag.AllFlags (英文) 權限。如需詳細資訊,請參閱Security and Trust。 |
範例
這個 C# 範例會將 PenInputPanel 物件 thePenInputPanel 附加至 InkEdit 控制項 theInkEdit。它會將 VisibleChanged 事件處理常式 VisibleChanged_Event 加入至 PenInputPanel 的表單。在事件處理常式中,如果 PenInputPanel 物件是可見的,其設定會透過呼叫 Refresh 方法還原為 [輸入面板] 的設定。
[C#]
//...
// Delcare the PenInputPanel object
PenInputPanel thePenInputPanel;
public Form1()
{
// Required for Windows Form Designer support
InitializeComponent();
// Create and attach the new PenInputPanel to an InkEdit control.
thePenInputPanel = new PenInputPanel(theInkEdit);
// Add a PenInputPanelVisibleChanged event handler
thePenInputPanel.VisibleChanged +=
new PenInputPanelVisibleChangedEventHandler(VisibleChanged_Event);
}
//...
public void VisibleChanged_Event(object sender,
PenInputPanelVisibleChangedEventArgs e)
{
// Make sure the object that generated
// the event is a PenInputPanel object
if (sender is PenInputPanel)
{
PenInputPanel theSenderPanel = (PenInputPanel)sender;
// If the panel has become visible...
if (e.NewVisibility)
{
// Restore the pen input panel settings
// from the global Input Panel
theSenderPanel.Refresh();
}
}
}
這個 Microsoft Visual Basic .NET 範例會將 PenInputPanel 物件 (thePenInputPanel) 附加至 InkEdit 控制項 (theInkEdit)。它會將 VisibleChanged 事件處理常式 VisibleChanged_Event 加入至 PenInputPanel 的表單。在事件處理常式中,如果 PenInputPanel 物件是可見的,其設定會透過呼叫 Refresh 方法還原為 [輸入面板] 的設定。
[Visual Basic]
'...
' Declare the PenInputPanel object
Dim thePenInputPanel As PenInputPanel
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
' Create and attach the new PenInputPanel to an InkEdit control.
thePenInputPanel = New PenInputPanel(theInkEdit)
' Add a PenInputPanelVisibleChanged event handler
AddHandler thePenInputPanel.VisibleChanged, _
AddressOf VisibleChanged_Event
End Sub 'New
'...
Public Sub VisibleChanged_Event(sender As Object, e As _
PenInputPanelVisibleChangedEventArgs)
' Make sure the object that generated
' the event is a PenInputPanel object
If TypeOf sender Is PenInputPanel Then
Dim theSenderPanel As PenInputPanel = CType(sender, PenInputPanel)
' If the panel has become visible...
If e.NewVisibility Then
' Restore the pen input panel settings
' from the global Input Panel
theSenderPanel.Refresh()
End If
End If
End Sub 'VisibleChanged_Event
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0