當鼠標光標在按鈕上時,如何顯示文本或字幕?當鼠標光標在按鈕上時,顯示文本或字幕在WPF中
4
A
回答
4
試試這個:
<Button ToolTipService.InitialShowDelay="5000"
ToolTipService.ShowDuration="2000"
ToolTipService.BetweenShowDelay="10000"
ToolTip="This is a tool tip." />
+0
這很棒!謝謝。 – Mathi901
0
「工具提示」是一個需要添加文本到目前正在積極盤旋控件設置的屬性。
0
您可以創建2個事件:PointerEntered和PointerExited,畫的內容爲按鈕和賦予一個名字內容(或它的模板)
的XAML:
<Button PointerEntered="Button_PointerEntered" PointerExited="Button_PointerExited" >
<Button.Content>
<TextBlock x:Name="txtBlock1" Text="not hovering" />
</Button.Content>
</Button>
在後面的代碼你處理這些事件:
private void Button_PointerEntered(object sender, PointerRoutedEventArgs e)
{
txtBlock1.Text = "hovering";
}
private void Button_PointerExited(object sender, PointerRoutedEventArgs e)
{
txtBlock1.Text = "not hovering";
}
0
其他解決@None(Becouse他的解決方案不工作對我來說)
XAML:
<Button Name="Btn_Temp" MouseEnter="Button_PoiterEntered" MouseLeave="Button_PointerExited" />
C#:
private void Button_PoiterEntered(object sender, System.Windows.Input.MouseEventArgs e)
{
Btn_Temp.Content = "hovering";
}
private void Button_PointerExited(object sender, System.Windows.Input.MouseEventArgs e)
{
Btn_Temp.Content = "not hovering";
}
相關問題
- 1. 當鼠標懸停在圖標上時,按鈕文字模糊
- 2. 將鼠標懸停在gwt中的按鈕上顯示文本
- 3. 如何在WPF中的鼠標上顯示按鈕控件?
- 4. 當鼠標懸停在ASP.NET按鈕上時顯示註釋
- 5. 當鼠標懸停在圖像上時顯示按鈕(rails image_tag)
- 6. 當鼠標懸停在單詞上時顯示關閉按鈕
- 7. 當鼠標懸停在按鈕上時更改光標的圖標
- 8. 在屏幕上移動鼠標光標
- 9. 在phantom.js中顯示鼠標光標
- 10. GTK +:鼠標懸停在按鈕上時顯示標籤
- 11. 當Qt中的鼠標按鈕和lineedit顯示幫助文本
- 12. wpf按鈕的邊距在鼠標懸停時突出顯示
- 13. 當鼠標懸停在按鈕上時,按鈕添加按鈕
- 14. 我想隱藏或顯示div上的鼠標在按鈕上
- 15. 當光標懸停在圖像上時顯示文本
- 16. 當鼠標懸停在引導按鈕上時阻止光標更改
- 17. 當鼠標光標在其上時,XAML按鈕模板發生更改
- 18. 鼠標光標未顯示
- 19. 不顯示鼠標光標
- 20. 在wpf按鈕的標籤上顯示按鈕工具提示
- 21. 當鼠標懸停到對象上時顯示GUI按鈕
- 22. 光標不顯示在文本字段
- 23. 在表格中顯示按鈕將鼠標懸停在鼠標上方
- 24. Jquery對話框中的按鈕文本鼠標光標更改
- 25. 側欄隱藏/顯示按鈕,跟隨光標鼠標?
- 26. 在鼠標懸停上顯示文字
- 27. PyQt:當鼠標懸停按鈕時改變光標
- 28. 當鼠標懸停在Jssor中的縮略圖菜單上時顯示字幕
- 29. 將鼠標懸停在按鈕上時顯示圖像
- 30. 當鼠標在字母上移動時顯示字母
使用樣式做[像這樣(http://stackoverflow.com/a/32483665/2470362)變化 –
可能重複鼠標懸停按鈕的內容](http://stackoverflow.com/questions/32483610/change-content-of-the-button-on-mouseover) – Gromy
你的意思是一個工具提示? –