473,486 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 AllowTransparency to
true but then the window style must be set to None to set the
AllowTransparency 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?
Aug 5 '08 #1
8 3946
On Tue, 05 Aug 2008 13:49:53 -0700, Sin Jeong-hun <ty*******@gmail.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 "transparent 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
Aug 5 '08 #2
On Aug 6, 5:59*am, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Tue, 05 Aug 2008 13:49:53 -0700, Sin Jeong-hun <typing...@gmail.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 "transparent 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.microsoft.com/en-US/wpf/threads/) site right? I'll check
out that forum for WPF issues from now on.

Aug 5 '08 #3
On Tue, 05 Aug 2008 15:51:40 -0700, Sin Jeong-hun <ty*******@gmail.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.microsoft.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. :(
Aug 5 '08 #4
On Aug 6, 12:49*am, Sin Jeong-hun <typing...@gmail.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 AllowTransparency to
true but then the window style must be set to None to set the
AllowTransparency 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="WpfApplication2.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300" AllowsTransparency="True"
Background="Green" Opacity="0.5" WindowStyle="None">
<Grid>
<TextBlock>Hello, 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.
Aug 6 '08 #5
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.
Aug 6 '08 #6
See http://blogs.interknowlogy.com/johnb.../20/20458.aspx
for an article showing how to simulate the title bar and close button.

Chris Jobson
Aug 7 '08 #7
On Aug 8, 3:29*am, "Chris Jobson" <chris.job...@btinternet.comwrote:
Seehttp://blogs.interknowlogy.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.

Aug 14 '08 #8
On Aug 6, 7:37*pm, Pavel Minaev <int...@gmail.comwrote:
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.
Aug 14 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
2471
by: Roger Withnell | last post by:
I open a new window from the current window to display maps. Several maps of different sizes can be displayed. The function is given the size of the map and adjusts the window size accordingly....
1
2900
by: Per Larsson | last post by:
Hi all! I am working with a project and want to make a form that is semi transparent, and transparent to mouse clicks. (Se through and click through.) The form shall be visible but opaque and the...
2
1945
by: jashugun | last post by:
Hello to everybody, I'm trying to write a small program which is meant to interact with an sqlite database. My idea is to create once a database handler, which happens to be an opaque pointer (a...
18
11284
by: chankl | last post by:
Can anyone explain what's an opaque pointer and how it's implemented in C? I read about this concept in the book "C interfaces and implementations". Here's an example from the book (list.h -...
3
2142
by: Ernesto Bascón | last post by:
Hi everybody: I have two questions: 1. I'm using opaque pointers in my classes to hide their data structures; there is a way to use opaque pointers in template classes; since the...
9
3443
by: Nagesh | last post by:
Hi All, I have a requirement to handle the window(browser) close event. When a user tries to close the browser window , we have to prompt him whether he wants to close the window or not. If...
1
1933
by: Don Taylor | last post by:
I want to build an application in Python that can show an opaque window so that you can still see and type into any window that it covers. Sort of like a software mylar transparency sheet placed...
12
1615
by: Prisoner at War | last post by:
Yeah, but that requires installing the Flash plug-in. If it's otherwise possible -- which it seems to be -- CSS/JavaScript is more powerful than I'd thought! Anyway, it's a technical...
27
2485
by: Nate Eldredge | last post by:
Consider the following pseudo-code: #include <opaque.h> struct foo { int a; opaque_t op; int b; };
0
7094
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6839
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3066
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
259
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.