How to display image without window in C #

I would like to know how to open an image without opening a window, so its image, like an image, floats on my desktop without a frame. thank

+5
source share
3 answers

What you want to do is draw an image on the screen without the visible border of the window around it. Whether a window will be created is a completely different question. And as it turned out, you should have a window. It just won't be visible. So:

Create a window, making sure that the InitializeComponent()following is installed:

this.ControlBox = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.ShowIcon = false;
this.ShowInTaskbar = false;

Then override OnPaintBackgroundfor this window as follows:

protected override void OnPaintBackground( WinForms.PaintEventArgs e )
{
    e.Graphics.DrawImage( Image, 0, 0, Width, Height );
}
+6
source

Show window without title

In case of winforms -

FormBorderStyle = None
ControlBox = false

taken from - Windows form with frame resizing and without title?

If you use XAML to display a window without a title -

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="640" Height="480" 
    WindowStyle="None"
    AllowsTransparency="True"
    ResizeMode="CanResizeWithGrip">

    <!-- Content -->

</Window>

taken from - Is it possible to display a wpf window without an icon in the title bar?

+3
source

All Articles