50 % opaque normal window, impossible in WPF?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sin Jeong-hun

    50 % opaque normal window, impossible in WPF?

    With Windows Forms application, just setting the opacity to 0.5 gave
    me a 50% opaque normal styled (with the title bar, familiar three
    buttons, borders and resizable) window. Did the same thing to a WPF
    application, but the window didn't get translucent, instead only the
    client area got gray. Then I found I have to set AllowTransparen cy to
    true but then the window style must be set to None to set the
    AllowTransparen cy to true. In short, those translucent normal styled
    window, which could be achieved just one line of code in Windows Forms
    application, is IMPOSSIBLE in WPF?
  • Peter Duniho

    #2
    Re: 50 % opaque normal window, impossible in WPF?

    On Tue, 05 Aug 2008 13:49:53 -0700, Sin Jeong-hun <typingcat@gmai l.com>
    wrote:
    [...]
    In short, those translucent normal styled
    window, which could be achieved just one line of code in Windows Forms
    application, is IMPOSSIBLE in WPF?
    That was my impression when I played around with this, after you posted
    your previous "transparen t window" question.

    Seems odd, I'd agree. But that's the conclusion I came to.

    Of course, for an expert opinion, you'll probably want to check on
    Microsoft's web-only WPF forum. Microsoft has apparently decided to
    forego the better user experience and efficiency of newsgroups like this
    one for web-based forums. That's the only place I know of to reilably
    find the WPF experts (occasionally some read and post here, but this
    newsgroup isn't a very good place for WPF questions generally).

    Pete

    Comment

    • Sin Jeong-hun

      #3
      Re: 50 % opaque normal window, impossible in WPF?

      On Aug 6, 5:59 am, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
      wrote:
      On Tue, 05 Aug 2008 13:49:53 -0700, Sin Jeong-hun <typing...@gmai l.com 
      wrote:
      >
      [...]
      >
      In short, those translucent normal styled
      >
      window, which could be achieved just one line of code in Windows Forms
      application, is IMPOSSIBLE in WPF?
      >
      That was my impression when I played around with this, after you posted  
      your previous "transparen t window" question.
      >
      Seems odd, I'd agree.  But that's the conclusion I came to.
      >
      Of course, for an expert opinion, you'll probably want to check on  
      Microsoft's web-only WPF forum.  Microsoft has apparently decided to  
      forego the better user experience and efficiency of newsgroups like this  
      one for web-based forums.  That's the only place I know of to reilably  
      find the WPF experts (occasionally some read and post here, but this  
      newsgroup isn't a very good place for WPF questions generally).
      >
      Pete
      Thank you for the information. I searched Google for it. By
      Microsoft's web-pnly WPF forum, you mean this (http://
      forums.msdn.mic rosoft.com/en-US/wpf/threads/) site right? I'll check
      out that forum for WPF issues from now on.

      Comment

      • Peter Duniho

        #4
        Re: 50 % opaque normal window, impossible in WPF?

        On Tue, 05 Aug 2008 15:51:40 -0700, Sin Jeong-hun <typingcat@gmai l.com>
        wrote:
        Thank you for the information. I searched Google for it. By
        Microsoft's web-pnly WPF forum, you mean this (http://
        forums.msdn.mic rosoft.com/en-US/wpf/threads/) site right? I'll check
        out that forum for WPF issues from now on.
        Yup, that's the one.

        I wish we could have been more helpful; I'd love to see a non-web-based
        forum, such as this newsgroup, be viable for WPF questions. But that
        seems like it's just not going to happen. The people who really know WPF
        well I think are mostly elsewhere. :(

        Comment

        • Pavel Minaev

          #5
          Re: 50 % opaque normal window, impossible in WPF?

          On Aug 6, 12:49 am, Sin Jeong-hun <typing...@gmai l.comwrote:
          With Windows Forms application, just setting the opacity to 0.5 gave
          me a 50% opaque normal styled (with the title bar, familiar three
          buttons, borders and resizable)  window. Did the same thing to a WPF
          application, but the window didn't get translucent, instead only the
          client area got gray. Then I found I have to set AllowTransparen cy to
          true but then the window style must be set to None to set the
          AllowTransparen cy to true. In short, those translucent normal styled
          window, which could be achieved just one line of code in Windows Forms
          application, is IMPOSSIBLE in WPF?
          It is quite possible. Here's a bit of code that does it:

          <Window x:Class="WpfApp lication2.Windo w1"
          xmlns="http://schemas.microso ft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microso ft.com/winfx/2006/xaml"
          Title="Window1" Height="300" Width="300" AllowsTranspare ncy="True"
          Background="Gre en" Opacity="0.5" WindowStyle="No ne">
          <Grid>
          <TextBlock>Hell o, world!</TextBlock>
          </Grid>
          </Window>

          The only bummer is that you have to have WindowStyle set to "None"...
          meaning that you'll have to draw your own title bar and border.

          Comment

          • Pavel Minaev

            #6
            Re: 50 % opaque normal window, impossible in WPF?

            Sorry, I missed the point where you explicitly say that you want the
            titlebar.

            Now that is tricky, but one thing that might work is wrapping your
            Window into HwndSource as a top-level Win32 window, and applying
            WS_EX_LAYERED style to that using P/Invoke.

            Comment

            • Chris Jobson

              #7
              Re: 50 % opaque normal window, impossible in WPF?

              See http://blogs.interknowlogy.com/johnb.../20/20458.aspx
              for an article showing how to simulate the title bar and close button.

              Chris Jobson


              Comment

              • Sin Jeong-hun

                #8
                Re: 50 % opaque normal window, impossible in WPF?

                On Aug 8, 3:29 am, "Chris Jobson" <chris.job...@b tinternet.comwr ote:
                Seehttp://blogs.interknow logy.com/johnbowen/archive/2007/06/20/20458.aspx
                for an article showing how to simulate the title bar and close button.
                >
                Chris Jobson
                Thanks. But I have already seen that post before. What I wanted was to
                keep Vista's Aero window frame, not implemening my own.

                Comment

                • Sin Jeong-hun

                  #9
                  Re: 50 % opaque normal window, impossible in WPF?

                  On Aug 6, 7:37 pm, Pavel Minaev <int...@gmail.c omwrote:
                  Sorry, I missed the point where you explicitly say that you want the
                  titlebar.
                  >
                  Now that is tricky, but one thing that might work is wrapping your
                  Window into HwndSource as a top-level Win32 window, and applying
                  WS_EX_LAYERED style to that using P/Invoke.
                  Thanks. That seems to be a solution even though the clue is not
                  detailed. I'll study for more details.

                  Comment

                  Working...