raymond chen programmer microsoft corporation pc43

Post on 29-Mar-2015

245 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

What's New with user32 and comctl32 in Win32

Raymond ChenProgrammerMicrosoft Corporation

PC43

Double-buffered painting Cross-fade animation helpers List view tiles List view grouping Cue banners and empty text Images next to menu items Icon scaling

Foreground activation is like love

Eight Things You Didn't Know You HadAnd one essay

Double-Buffering Helpers

// WM_CREATEBufferedPaintInit();

// WM_DESTROYBufferedPaintUnInit();

// WM_PAINT

hdc = BeginPaint(hwnd, &ps);hBuffer = BeginBufferedPaint(…, &hdc);PaintContent(hwnd, hdc);EndBufferedPaint(hBuffer, TRUE);EndPaint(hwnd, &ps);

Double Buffering

demo

Not filling your background Not suppressing WM_ERASEBKGND Remote Desktop / Terminal Services

Double-Buffering Traps

BP_BUFFERFORMAT BP_PAINTPARAMS

dwFlags prcExclude pBlendFunction

GetBufferedPaintBits() BufferedPaintSetAlpha()

Advanced Double-Buffering

Cross-Fade Animation Helpers

// WM_PAINTif (!BufferedPaintRenderAnimation(…)) { parms.dwDuration = ANIMATION_DURATION; hBuffer=BeginBufferedAnimation(…, &hdcFrom, &hdcTo); if (hdcFrom) paint into hdcFrom; if (hdcTo) paint into hdcTo; EndBufferedAnimation(hBuffer, TRUE);}

Identify and isolate states Draw based on state as parameter Maintain last-drawn and current states BufferedPaintStopAllAnimations

Painting With Cross-Fades

Animating And Not Animating

// WM_PAINTif (!BufferedPaintRenderAnimation(…)) { parms.dwDuration = ANIMATION_DURATION; if (m_curState == m_drawnState) parms.dwDuration = 0; hBuffer=BeginBufferedAnimation(…, &hdcFrom, &hdcTo); if (hdcFrom) PaintState(hdcFrom, m_drawnState); if (hdcTo) PaintState(hdcTo, m_curState); EndBufferedAnimation(hBuffer, TRUE); m_drawnState = m_curState;}

Cross Fade Animation

demo

Windows 7 animation engine Windows 7: New Text and Graphics APIs You just missed it But you can still catch the hands-on lab

Oops: Windows 7 Content

Richer item view than icon and label Easier to read than report view but takes

up more space ListView_SetView(LV_VIEW_TILE)

List View Tiles

demo List View Tiles

Specify how many additional lines of text you want to display in the tile

For each item, specify which columns you want to show as additional text Usually the same for each item

Optionally set fixed tile size and margins

Controlling List View Tiles

demo List View Tiles: Round 2

They don’t work Sorry

List View Extended Tiles

Create groups (ListView_InsertGroup) Put each item into a group (iGroupId) Turn on grouping

(ListView_EnableGroupView)

Windows XP List View Grouping

List View Grouping

demo

Don’t forget to assign items to groups Create groups before adding items to them Don't give two groups the same ID

Grouping Traps

Group subtitles (LVGF_SUBTITLE) Group footers (LVGF_FOOTER) Collapsible groups (LVGS_COLLAPSIBLE) Group command links (LVN_LINKCLICK) Enumerating group contents

(LVNI_SAMEGROUPONLY | LVNI_VISIBLEORDER)

Windows Vista List View Grouping

demo List View Grouping: Round 2

Prerequisites for group descriptions Group header image list Group must have a title image Group header must be centered

If you know what’s good for you Don’t actually use a title image

Grouping Insanity

demo List View Grouping: The Insanity

EM_SETCUEBANNER CB_SETCUEBANNER

Cue Banners

LVN_GETEMPTYMARKUP

Empty Text

MENUITEMINFO.hbmItem and MIIM_BITMAP 32bpp PARGB format supported in

Vista via DIBSECTION Don’t forget to DeleteObject it

Alpha-Blended Menu Bitmaps

Menu Bitmaps

demo

LoadIconWithScaleDown implement a new scaling algorithm Icon must include images at sizes 16, 32,

48, 256 LoadImage/Icon still use old algorithm SHDefExtractIcon uses new algorithm

Icon Scaling

Foreground Activation Is Like Love

You can share it with others You cannot steal it

SetForegroundWindow AllowSetForegroundWindow CoAllowSetForegroundWindow

Evals & Recordings

Please fill

out your

evaluation for

this session at:

This session will be available as a recording at:

www.microsoftpdc.com

Please use the microphones provided

Q&A

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market

conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

top related