メッセンジャーのようなタスクバーのポップアップウィンドウを作成することができました。タスクバーの後ろに消えるのではなく下に移動すると、後ろに移動するという問題。
タスクバーの後ろに表示されないようにするにはどうすればよいですか?Windows 7では、タスクバーが透明であることを忘れないでください。
これが私のコードです:
public partial class WindowNotifier : Window
{
double xPos = 0;
double yPos = 0;
Timer closeTimer;
public WindowNotifier()
{
InitializeComponent();
closeTimer = new Timer();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
SetValues();
closeTimer.Tick+=new EventHandler(closeTimer_Tick);
closeTimer.Start();
}
private void SetValues()
{
xPos = System.Windows.SystemParameters.WorkArea.Width;
yPos = System.Windows.SystemParameters.WorkArea.Height;
this.Left = xPos - this.Width;
this.Top = yPos - this.Height;
}
private void closeTimer_Tick(object sender, EventArgs e)
{
closeTimer.Interval = 50;
double curYPos = this.Top;
if (curYPos < yPos)
{
this.Top = curYPos + 8;
this.Opacity = this.Opacity - 0.050;
}
else
{
this.Close();
}
}
}
編集:タイマー部分を変更したので、コントロールの高さを下げて再配置します。今問題はそれが点滅することです。どうすれば解決できますか?
コードは次のとおりです。
closeTimer.Interval = 50;
double curYPos = this.Top;
int decAmount = 8;
if(this.Height - decAmount > 0)
{
this.Height = this.Height - decAmount;
this.Top = this.Top + decAmount;
this.Opacity = this.Opacity - 0.010;
}
else
{
this.Height = 0;
this.Close();
closeTimer.Stop();
}