我的窗口縮略圖上有幾個ThumbnailToolBarButtons
。一個是播放/暫停按鈕。我其實有兩個按鈕,一個用於播放,另一個用於暫停。當我點擊按鈕時,它會隱藏一個,並使用ThumbnailToolBarButton
的Visible屬性顯示另一個。然而,如果我點擊播放/暫停按鈕,窗口縮略圖就會彈起來,所有的都變得非常寬,突然我只看到兩個按鈕。如果我讓窗口縮略圖消失並再次翻轉,則所有按鈕都會返回並顯示正確的寬度。這裏發生了什麼?謝謝。設置ThumbnailToolBarButton的可見性
更新:好的。這裏有一些代碼作爲例子。
private ThumbnailToolBarButton buttonPrevious;
private ThumbnailToolBarButton buttonNext;
private ThumbnailToolBarButton buttonPlay;
private ThumbnailToolBarButton buttonPause;
private Boolean bPlaying = false;
private void Form1_Load(object sender, EventArgs e)
{
buttonPrevious = new ThumbnailToolBarButton(Properties.Resources.previous, "Previous");
buttonPrevious.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(buttonPrevious_Click);
buttonPrevious.Visible = true;
buttonNext = new ThumbnailToolBarButton(Properties.Resources.next, "Next");
buttonNext.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(buttonNext_Click);
buttonNext.Visible = true;
buttonPlay = new ThumbnailToolBarButton(Properties.Resources.play, "Pause/Pause");
buttonPlay.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(buttonPlay_Click);
buttonPlay.Visible = true;
buttonPause = new ThumbnailToolBarButton(Properties.Resources.pause, "Play");
buttonPause.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(buttonPlay_Click);
buttonPause.Visible = false;
TaskbarManager.Instance.ThumbnailToolBars.AddButtons(this.Handle, buttonPrevious, buttonPlay, buttonPause, buttonNext);
}
private void buttonPlay_Click(object sender, ThumbnailButtonClickedEventArgs e)
{
bPlaying = !bPlaying;
buttonPlay.Visible = bPlaying ? false : true;
buttonPause.Visible = bPlaying ? true : false;
}
也許,而不是顯示一個或隱藏其他的我應該只是被換出的圖像,但唉,我搜遍了網絡,無法找到如何去做。 –
你能用一些代碼來顯示我們如何使用ThumbnailToolBarButtons來編輯你的問題嗎? –