1

I want to make an application with transparent window. I want to put one picture at the background of this window and make window transparent for inputs (i.e. if I click at window, it will be same as if I click there at screen if there is no this application). I want to make input box at application startup for input alpha. Is it possible to make an application like this one in c#? If yes, what is the best way to do this?

  • This is something you can likely do on any platform, in any programming language, as it's something provided by the Operating System rather than a specific platform. You should pick your platform first and then look how to do that on that platform (and ask if you don't find anything on Google) – Pekka Mar 01 '15 at 18:52
  • @Pekka웃. I know how to make window transparent on some platforms. Problem is how to make "transparent input", i.e. if I click somewhere on my application, system will behave like this application is not running, it will be the same if I clicked on that place on screen if there is no my application. If it can be done on any platform, I will choose C#, but I do not have an idea how to do this. –  Mar 01 '15 at 19:22
  • Ah, OK. Then I think you should edit your question's title, and add the tags for your preferred platform – Pekka Mar 01 '15 at 19:27
  • @Pekka웃. Edited. So, do you know how to do this in c#? –  Mar 01 '15 at 19:38
  • 1
    Seems related to this (although it uses WinForms, not WPF) http://stackoverflow.com/q/855826/103167 – Ben Voigt Mar 01 '15 at 20:46
  • 1
    Also read this: http://blogs.msdn.com/b/nickkramer/archive/2005/06/24/432517.aspx – Ben Voigt Mar 01 '15 at 20:47
  • @BenVoigt. Thank you, I almost succeeded, but I still have one problem. When I click on my application, it move behind other windows. How to make my application to be always in front of other applications? –  Mar 01 '15 at 21:25
  • 1
    You mean you clicked past your application, within its rectangle but not within its non-rectangular area? And the window that received the mouse click came to the front? I suggest you make your window "topmost". The Win32 way uses `SetWindowPos`, but WinForms has a Topmost property and WPF probably has something also. – Ben Voigt Mar 01 '15 at 21:54

1 Answers1

1

You can create a transparent window by the below XAML code in a WPF application. You can vary the opacity values between 0 and 1 to get the desired transparency. To get full transparency use 0.

<Window x:Class="WpfApplication3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        AllowsTransparency="True" WindowStyle="None" IsActive="False">
    <Window.Background>
        <SolidColorBrush Opacity="0.5" Color="White"/>
    </Window.Background>
    <Grid>
        <TextBox Width="200" Height="50"/>
    </Grid>
</Window>
Utsav Dawn
  • 7,896
  • 2
  • 29
  • 44
  • I know this, but this is not exactly what I asked. What about "transparent input"? –  Mar 01 '15 at 19:54
  • You want a transparent textbox? – Utsav Dawn Mar 01 '15 at 19:56
  • No, i want "transparent input", i.e. if I click somewhere on my application, system will behave like this application is not running, it will be the same if I clicked on that place on screen if there is no my application. –  Mar 01 '15 at 19:59
  • What is the relation between transparent input and " if I click somewhere on my application, system will behave like this application is not running, it will be the same if I clicked on that place on screen if there is no my application."? I am not getting you. How do you want to take an input? – Utsav Dawn Mar 01 '15 at 20:03
  • I want to make application with following features: 1. Window of that application must be semi-transparent 2. If I click on window of my application, system would behave like I clicked on that place on screen, like my application is not runing. For example, if I play some game and I run my application, I would see semi-transparent window of my application over game window. Also, I could play game absolutelly normal, like my application is not running (that includes if I click on my application, system will behave like I clicked on game window). –  Mar 01 '15 at 20:17
  • For that you have to make the IsActive property of the window to be false. I have updated the answer check it. – Utsav Dawn Mar 01 '15 at 20:44