How to draw button in title bar like in Google Chrome? - windows

I tried several components from 2000-2001, but none of them works for win7. How do I do it?

If you are looking for a way to make use of glass frame in Windows 7 using Delphi, you can follow this tutorial. There is also an update available dedicated to a 64 bit bug. You can also look at some examples by Chris Rolliston available on embarcadero developer network.

Or they probably just draw their own components like a video game would do and they emulated the windows 7 look and feel.

You could use rkSmartTabs:
Or IceTabSet:
Finally, check out the answers to these StackOverflow questions:
Google Chrome Tabs Style UI in Delphi
Resources for Windows Aero Glass and Compositing dwm

Take a look at my TChromeTabs component (http://code.google.com/p/delphi-chrome-tabs/downloads/list). As well as the Chrome Tabs implementation it includes a TForm descendant that will show you how to draw in an Aero title bar.

.NET Framework Windows Vista & 7 Features
This maybe

Related

Panning and zooming over a large image just like in Bing Map control

I am looking for a solution where I am able to do all the gestures (flick, pinch, drag) with a local picture in my Windows Phone 7 application with acceptable performance. The Silverlight Bing Map control for WP7 does all of this perfectly, but it cannot do this with a local image.
I started to write my own control, but I was wondering if there is anything out there written by someone else. Is there anything out there?
Is it possible to reuse the Map control, but with my own image?
Laurent Bugnion's Multitouch Behaviour from beta might also be worth a look for this purpose.
MultiTouch Behavior for Windows Phone 7
MultiTouch Behavior: Update for Windows Phone 7 tools beta
You need a MultiScaleImage. You can use this with DeepZoom.
There's an (old) example here.

Documentation and API Samples for drawing on Windows Aero Glass (DWM, GDI, GDI+) for all Win32 programmers

I am looking for good resources for learning to use the Win32/GDI APIs or whatever supercedes it to draw and paint directly using the Win32 API to a glass form.
While I am using Delphi, I tagged this as Delphi or Visual C++. Any code samples and articles that you can find would be appreciated. MSDN articles do not seem to be written about this.
As a goal, let's imagine you want to either:
(a) Reproduce what Google Chrome does (tabs as part of the glass frame)
(b) Reproduce what MS Office 2010 does (save button on the glass frame, referred to in MFC for VS 2010, as "Quick Access Toolbar" (see picture below).
I am not using MFC, but if examining the MFC sources would be a good source of information, I am curious to know where in the MFC sources or BCG original sources (I have both) are implemented the Quick Access Toolbar rendering/painting code.
Update: A related neato link from one of the answers below shows the NC (nonclient) Paint message, and how to handle it when painting on a glass frame, and an MSDN article about it here.
This is a subset of my "Glass" bookmarks folder, the result of a lot of research / searching on this topic. I've found all of these useful for learning about glass and solving various problems drawing on it. Most of these include Delphi code, but I've noted where it's for another language.
Plain Glass links
Using translucent windows with Delphi: good introduction (from the very basics) for using Glass in Delphi forms
Custom drawing on glass: covers how to draw a bitmap or other image on a glass area of the window. Covers alpha channels etc too, good overview
Using glass in a VC++ project: covers turning glass on, drawing text, handling notifications etc - a good general introduction to how it works. A lot of the underlying details are handled by the VCL (eg the GlassFrame property and TForm internals look after a lot of this) but it's very useful to understand the basics of how it's implemented at an API level anyway
How to draw on the non-client area: this shows how to draw something like Office's toolbar in the title bar. .Net code, but translatable
Setting up a custom title bar: very detailed article about non-client-area drawing (in Delphi, so Delphi code). Followed up by part 2, which demonstrates completely taking over the entire window and mimicking the standard title bar yourself. These two articles will let you mimic Office and Chrome as you requested in the question
How to set up various VCL controls to work best on a glass area: the VCL does not support glass very well. You'll often get artifacts, or controls simply not drawing properly at all, no matter what you do to try and solve it. This article lists the basic VCL visual components (labels, buttons, progress bars, etc) and what to set up for each so they draw perfectly, or at least 'as well as possible' when they're placed on a glass area
Advanced, or tangentially related:
How desktop composition works, with GDI and DirectX surfaces
List of desktop manager APIs (only some of which are Aero-related)
These posts on drawing a custom title bar under Vista/Windows 7 might interest you.
Sample image:
I'm sure you've found the MSDN page about the DWM. It has jumps many topics and a few examples. Some of the "overview" articles there have examples (like the DWM Blur Behind Overview).
Unfortunately, other than the documentation, there are precious few good articles. You can start with Using glass on codeproject, and take a look at a detecting glass in delphi - after that using the functions straight from the docs is not too bad. Luckily they are all pretty straight-forward in practice.
Good web site for glass components, including a Glass button:
http://rmklever.com/
In addition, these old articles may help you:
Creating Windows Vista Ready Applications with Delphi
Creating Windows Vista Ready Applications with Delphi Update - January 2007

Screenshot of window

I'm trying to take screenshots of all open windows, also the minimized ones. Currently I'm using this code:
http://www.developerfusion.com/code/4630/capture-a-screen-shot/
But it doesn't work for minimized windows and the areas where there is a Glass effect since Vista like the explorer title bar are black. Can anyone help me out?
My objective is to create something similar to Flip 3D; it would be great if someone also knew something about how to create a live preview.
For the glass effect areas: I think it doesn't work because those areas may be drawn with some strange DirectX method instead of normal GDI.
For the minimized windows problem: if a window is minimized, its DC isn't painted (conceptually, it doesn't even have a reason to exist); you should try to send to such windows a WM_PRINT message, asking them to paint themselves on the DC you'll provide them. The problem with this approach is that not all the windows handle correctly WM_PRINT.
I've found the API that is used for the taskbar previews a.s.o.:
DWM Thumbnail Overview
Pretty awesome, it even allows you to do live previews!

XNA and GUI controls (eg. xaml and xna)

Is there a way to get textboxes, labels and other wpf controls in xna that supports margins, etc that flexes for window size?
You might give CeGui a shot.
If your game needs advanced GUI capabilities, CeGui# might just hit the nail on the head for you. Marketese aside, this is a seriously good GUI library with Buttons, ListBoxes, Scrollbars, ProgressBars, Sliders, ComboBoxes and more.
To access the Xna version you'll need to check out the latest copy from the project's SVN and load up CeGui-XNA.sln.
There are other options listed in this thread, but I have no idea how well any of the others work (and it probably isn't a comprehensive list anymore).
The official GUI systems FAQ thread in the XNA Forum:
What GUI systems are there for the XNA framework?
CEGUI# is powerful, but it doesn't support the Xbox 360 (eg. its design doesn't include responding to game pad input) - a major overhaul would be required to refit it to be usable with something else than mouse and keyboard.
Not exactly what you're looking for, but here is an example of getting winforms GUI elements mixed in with XNA 3d content:
http://creators.xna.com/en-US/sample/winforms_series1
Check out SQUID: http://www.ionstar.org/
It's a really clean, fast, and engine independent UI system. I've worked with it extensively and really enjoy using it. The download includes sample code for XNA 3.1, Truevision3D, and SlimDX.
It is possible to embed an XNA game in a WPF form (google: XNA in WPF) if you target only Windows system. You will then have access to all the controls available in XPF for your 2D GUI.
If you also target Xbox 360 or Zune; you must make your own GUI library :(

Change min/max/close buttons theme

im currently overiding the WM_NCPAINT, WM_NCCALCSIZE and WM_NCACTIVATE to paint my own color/themed title bar for an application im working on. Now this is working great however the min, max and close buttons still are xp default theme.
I looked into what controls them and the mouse messages do. However they also contol resizing and other functions that I dont want to lose.
Is there an easy way to just change the theme of these buttons?
Windows XP
MFC Forms
Visual studio 2005
I think your best bet here is to disable the buttons and redraw them with something akin to to the code I posted in this answer. It's in C# with WinForms, but the vast majority of it is overloaded WndProc() anyway, which you should be able to use almost copy/paste into MFC.
Implementing click handlers to do what you want them to do is trivial.
Note: The asker of that question said the code didn't work in Vista. I don't have a Vista box, but it works for me in XP.
This also helped: http://www.catch22.net/tuts/titlebar
You can also check out how it's done in MFC Next (VS2008 SP1). The theming support there does custom draw of the whole title bar, you can get a few ideas from that. I presume they tested it on Vista, too ;)

Resources