2011-04-13 32 views

回答

2

您正在尋找ToolTip component

+1

這不是一個標準的提示,是什麼呢?工具提示是鼠標懸停 - 這是一個驗證彈出窗口。 – 2011-04-13 15:00:10

+0

@Dan:您可以手動顯示工具提示;如果出現錯誤,請調用「Show」。 – SLaks 2011-04-13 15:10:19

0

不,開箱即用。有一個工具提示,但它看起來不像你展示的那個。

但是你可以通過創建一個自定義控件。

3

的DevExpress有一個免費的ToolTipController類(以及ErrorProvider控件和HintController類),你可以在這裏:https://www.devexpress.com/Products/Free/NetOffer/提供你想要什麼。我每天使用它。您可以簡單地將文本框拖放到表單上,並根據需要設置其工具提示,工具提示控制器和工具提示圖標屬性(也可以使用驗證事件將錯誤消息顯示爲工具提示)。

0

存在的WinForms錯誤提供商要做到這一點,但如果你想顯示這樣你可以使用工具提示

//創建工具提示和準用Form容器。 ToolTip toolTip1 = new ToolTip();

 // Set up the delays for the ToolTip. 
    toolTip1.AutoPopDelay = 5000; 
    toolTip1.InitialDelay = 1000; 
    toolTip1.ReshowDelay = 500; 
    // Force the ToolTip text to be displayed whether or not the form is active. 
    toolTip1.ShowAlways = true; 

    // Set up the ToolTip text for the Button . 
    toolTip1.SetToolTip(this.button1, "My button1"); 

參考MSDN