5

I would like to know how to open an image without having a window open, so its like the the image is floating on my desktop with no border. thanks

Paul R
  • 202,568
  • 34
  • 375
  • 539
Parker Olson
  • 295
  • 1
  • 3
  • 7
  • This [Link](http://stackoverflow.com/questions/1536141/how-to-draw-directly-on-the-windows-desktop-c) may help you.you need to draw the picture pixel by pixel using the same technic. – Galaxydreams Dec 01 '11 at 22:33

3 Answers3

6

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

Create a window, making sure to set the following in InitializeComponent():

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

Then, override OnPaintBackground for that window, as follows:

protected override void OnPaintBackground( WinForms.PaintEventArgs e )
{
    e.Graphics.DrawImage( Image, 0, 0, Width, Height );
}
Mike Nakis
  • 50,434
  • 8
  • 92
  • 124
6

If all you want is a splash screen, there's a framework component for that: http://msdn.microsoft.com/en-us/library/system.windows.splashscreen.aspx

dtanders
  • 1,795
  • 12
  • 13
3

Show a window without the title bar

In case of winforms -

FormBorderStyle = None
ControlBox = false

taken from - Windows Form with Resizing Frame and no Title Bar?

In case of XAML use this to show window without title bar -

<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?

Community
  • 1
  • 1
Unmesh Kondolikar
  • 9,136
  • 3
  • 33
  • 51