This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
How to set Windows Forms Application (C++) to have an Aero/Glass background?
i want create a transparent window with WinApis with C++ in Windows 7 and i use VS2010 but i know how to make it transparent i can do that like this:
SetWindowLong(hWnd, GWL_EXSTYLE,GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(hWnd, 0, (255 * 70) / 100, LWA_ALPHA);
but i want a transparent window with transparency of title bars of normal windows of windows 7
sample http://ril.site11.com/photos/879ec4dfeaa4.png
This web page has a great tutorial: http://www.codeproject.com/Articles/15770/Vista-Goodies-in-C-Using-Glass-in-Your-UI
It show you how to make a certain portion of you windows transparent, how to add text to the transparent part, and more.
Related
This question already has answers here:
Win32 Splitter Control
(4 answers)
Closed 3 years ago.
Using Win32 not MFC, how would I create a resizable or split controls?
As an example, a window with two edit controls side by side with the ability to resize them with a common divider. In the same way this dialog box can resized.
Not necessarily after a full example just a point in the right direction. Everything I lookup is about resizing entire windows not single controls (windows) inside the parent window.
Edit
Added image is show my example.
Everything I lookup is about resizing windows not controls.
Well, suddenly controls are, in fact, a windows as well, just visually little bit different.
Resizing controls is the same as resizing the window. In Win API it's handled by SetWindowPos function.
To properly resize controls when your window is resized you have to handle WM_SIZE Windows message in your main window and then resize/move your controls accordingly.
Updated:
After looking at your image:
Basically, if i understand your intentions, you need some custom divider/control, dragging which will eventually resize/move corresponding edit controls. Right?
In terms of pure Win API you will have to implement such control/divider in form of... another window.
In this window you will have to handle mouse clicks/moves and then do whatever you want with the (somehow) linked edit controls (basically implement all the logic).
Frankly saying this is not a very trivial task and that is what frameworks are here for (MFC, etc...).
This question already has answers here:
How do I add a background image to the QMainWindow?
(3 answers)
Closed 4 years ago.
Is there a way to change the style of the main window of the program from the standard style to the style of the png file (so that the window's appearance was like in the launcher of some online games)?
something like this (the best example from game GW2)
You don't do this sort of thing by making the image somehow spill out of the window, you do it by making a window large enough to hold the image and making the window background transparent. The Qt way to do this is using the Qt.WA_TranslucentBackground window flag (together with FramelessWindowHint).
ui->setupUi(this);
this->resize(1280,950);
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
this->setStyleSheet("#centralWidget { "
" border-image: url(:/gw2.png);"
"}");
connect(ui->pushButton, SIGNAL(clicked(bool)), qApp,
SLOT(closeAllWindows()));
result
Is it possible to create a "transparent" hwnd window ? What I mean by that is that there is no background or borders of that window but that only text is visible...like if I have a main window background and I have something written on the background ( or if I just want to add text on some area via window ) and I want to make it a clickable option, to create that kind of window that will be invisible but still clickable.
On Windows 2000 and later, you can create a top-level window with the WS_EX_LAYERED style (on Windows 8 and later, child windows can now use the WS_EX_LAYERED style as well), and then use SetLayeredWindowAttributes() or UpdateLayeredWindow() to make the window transparent.
Create a solid background color, and then set that color as the window's transparent color. Anything on the window that is not using that color will not be transparent. The OS will handle the rest for you.
Refer to MSDN for more details:
Layered Windows
Using Layered Windows
SetLayeredWindowAttributes()
UpdateLayeredWindow()
From your tag of hwnd, I'm assuming that you are working with C++ or at least have access to the Win32 API, there are plenty of resources to help you get started. The concept is called Window Compositing.
Transparent win32 window and text
Quick and Dirty Window Transparency
If you use WPF instead of C++, here's a link:
Transparent Windows in WPF
First set the styles to enable the layers:
SetWindowLong(itsec->first, GWL_EXSTYLE, GetWindowLong(itsec->first, GWL_EXSTYLE) & WS_EX_LAYERED);
Then indicate if you want the transparency to be alpha or not:
SetLayeredWindowAttributes(itsec->first, RGB(154,255,214), 200, LWA_ALPHA);
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Transparent window containing opaque text and buttons
I'm trying to manipulate an existing window with C++.
Basically, what I'm trying to do is set the parent window transparent via first setting its window style to WS_EX_LAYERED and then using SetLayeredWindowAttributes() with the right values.
The problem is that that will set the child windows to transparent also, which will make the whole program transparent (obviously a problem).
Any ideas?
EDIT Image demonstrating the problem:
As you might see, I set the taskbars window style to WS_EX_LAYERED, but for example the window MSTaskSwWClass (the window that has the running application icons) is also affected.
EDIT2 Tried UpdateLayeredWindow() with the exact same outcome.
As of http://msdn.microsoft.com/en-us/library/windows/desktop/ms633540%28v=vs.85%29.aspx
Windows 8: The WS_EX_LAYERED style is supported for top-level windows and child windows.
Previous Windows versions support WS_EX_LAYERED only for top-level windows.
So it will not set layered attribute to 'child' windows.
Show us screenshot and/or code.
This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
How to set default font for all the windows in a Win32 Application?
Which Font is the default for MFC Dialog Controls?
I hate default Windows Api Window Font (it is the default system font , i think). I know how to change the font of an individual child, say a button. But isn't there a way to change the font of the entire application so that I don't have to use SendMessage(...WM_SETFONT) on every single widget in my program?
Code examples are welcomed. (I am using C++)
One way would be to use EnumChildWindows:
BOOL CALLBACK SetChildFont(HWND hwndChild, LPARAM lParam)
{
HFONT hFont = (HFONT)lParam;
SendMessage(hwndChild, WM_SETFONT, (WPARAM)hFont, TRUE);
}
EnumChildWindows(hwndParent, SetChildFont, (LPARAM)hFont);
I explain all of this in quite a bit of depth here: Which Font is the default for MFC Dialog Controls? Definitely required reading for any Win32 developer who cares about getting the UI right.
There's no way to set the font for an entire application. The best thing you can do is set the font for a parent window and take advantage of the fact that most controls will inherit their font from their parent. To make extra sure that this works, you can write your own simple SendMessageToChildren function like MFC offers, which just walks down through the children of a particular parent recursively and sends each of them the WM_SETFONT message.
But WM_SETFONT is really your only option here. You can't set a font for an entire class like you can a background brush. Getting this right can be challenging, but I agree that it is a very important to try. The hallmark of an inconsistent UI and an unprofessional application is one that does not use the correct default GUI font. Windows Vista came along and complicated things even further by switching not only the face to Segoe UI, but the default size to 9 point.