2017-01-04 40 views

回答

-1

我不認爲有防止用戶直接編輯該字段的方法 - 如果您正在使用表單區域,並且可以直接覆蓋主題字段(可能使用替換表單區域比鄰接)。

我認爲你能做的最好的就是在啓動時爲主題存儲不可變的值,綁定到用戶更改該字段時觸發的事件,並將其恢復爲不可變的值。

MailItem對象https://technet.microsoft.com/en-us/library/ff866739的PropertyChange屬性是您需要監聽的。

例子:

// within your startup method 
this._MailItem.PropertyChange += MailItem_PropertyChange; 
this.mySubject = "Don't change me!"; 

function MailItem_PropertyChange(string Name) 
{ 
    if (Name.Equals("Subject")) // or whatever 
    { 
     // do something here like this.Subject = this.mySubject; 
     // and maybe alert the user the field can't be changed 
    } 
} 
+0

直到您嘗試保存項目或切換到巡視窗口中的其他字段時纔會觸發事件。這是一個衆所周知的問題。 –

+0

謝謝約翰,但我想打開新的郵件窗口時禁用某些字段。 – TinkerBelly

0

我只能想找到合適的HWND和使用EnableWWindow Windows API函數將其禁用。

相關問題