Note that there are some explanatory texts on larger screens.

plurals
  1. POWindow not being redrawn when changing Opacity
    text
    copied!<p>I have been trying to create a notification window, but I'm struggling to figure out why this opacity shift is not happening when I run it. Instead the window will hold for a second then close without any visible changes. All my other attempts via other methods have failed too, so it must be some property I am missing. Thanks for any help!</p> <pre><code> public void RunForm(string error, MessageBoxIcon icon, int duration) { lblMessage.Text = error; Icon i = ToSystemIcon(icon); if (i != null) { BitmapSource bs = System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(i.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); imgIcon.Source = bs; } this.WindowStartupLocation = WindowStartupLocation.Manual; this.Show(); this.Left = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Right - this.RestoreBounds.Width - 20; this.Top = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom - this.RestoreBounds.Height - 20; while (this.Opacity &gt; 0) { this.Opacity -= 0.05; Thread.Sleep(50); } this.Close(); } &lt;Window Width="225" Height="140" VerticalContentAlignment="Center" HorizontalAlignment="Center" ShowActivated="True" ShowInTaskbar="False" ResizeMode="NoResize" Grid.IsSharedSizeScope="False" SizeToContent="Height" WindowStyle="None" BorderBrush="Gray" BorderThickness="1.5" Background="White" Topmost="True" AllowsTransparency="True" Opacity="1"&gt; &lt;Grid Height="Auto" Name="grdNotificationBox" &gt; &lt;Image Margin="12,12,0,0" Name="imgIcon" Stretch="Fill" HorizontalAlignment="Left" Width="32" Height="29" VerticalAlignment="Top" /&gt; &lt;TextBlock Name="lblMessage" TextWrapping="Wrap" Margin="57,11,17,11"&gt;&lt;/TextBlock&gt; &lt;/Grid&gt; </code></pre> <p></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload