Using per-pixel opacity and there's nothing to see

Hi,

I'm experimenting with the per-pixel opacity and I used the "MSN stockwatch" example from unni's blog http://blogs.msdn.com/unnir/archive/2006/03/01/541154.aspx

Problem is that I don't see anything. At first, I had two windows open, but I fixed that. But all I see now is that there's a window open, but not visible. Anyone who had this problem that can/wants to help me

thanks in advance,

kimme



Answer this question

Using per-pixel opacity and there's nothing to see

  • moleman

  • Wilfred Tang

    Hi,

    Can you include some code for me to take a look at, might be easier to see what the problem is

    Thanks

    Andy


  • HSS Guido

    Hi Kimme,

    > At first, I had two windows open, but I fixed that. But all I see now is that there's a window open, but not visible.

    Can you describe the problem in a bit more detail Do you see the chrome of the window with a black box No window/chrome at all

    thx, Seema



  • MARUN

    Here it is...

    public partial class MyApp : Application {
    HwndSource testHwnd;

    protected override void OnStartup(StartupEventArgs e) {
    base.OnStartup(e);
    Rect workArea = SystemParameters.WorkArea;
    HwndSourceParameters parameters = new HwndSourceParameters("TestWindow");
    parameters.PositionX = (int)(workArea.Width/2);
    parameters.PositionY = (int)(workArea.Height/2);
    parameters.UsesPerPixelOpacity = true;
    testHwnd = new HwndSource(parameters);
    object o = Application.LoadComponent(new Uri("Window1.baml",
    UriKind.Relative));
    FrameworkElement child = o as FrameworkElement;
    testHwnd.RootVisual = child;
    testHwnd.Disposed += new EventHandler(testHwnd_Disposed);
    }

    void testHwnd_Disposed(object sender, EventArgs e) {
    this.Shutdown();
    }
    }

  • DOlmsted

    still don't get it. Can somebody guide me through it

  • daz1

    It's a single window app. but when it debugs, the window is there (can see this in the taskbar), but there nothing to see

  • Teppei

    Hi,

    A few words of advice on this.

    it will only work with single window applications and not applications that use NavigationWindow or mutiple window containers. The reason for this is pixel ownership, when you set opactity on window its for that window while window containers sit at a level below that and can't channel opacity into any windows within it. For this to work I suspect would need a big change to the API that won't happen in the v1 timeframe (but who's to say it won't make it into the v2 timeframe). So in general for opque windows to work you will need a single window.

    HTH

    Andy


  • Using per-pixel opacity and there's nothing to see