实例介绍
【实例截图】[Microsoft Press] Programming Windows 6th Edition.pdf
【核心代码】
Introduction ......................................................................................................... 9 The Versions of Windows 8 ....................................................................................................................................................... 9 The Focus of This Book .............................................................................................................................................................10 The Approach ...............................................................................................................................................................................12 My Setup........................................................................................................................................................................................13 The Programming Windows Heritage ..................................................................................................................................13 Behind the Scenes .......................................................................................................................................................................16 Errata & Book Support ..............................................................................................................................................................17 We Want to Hear from You .....................................................................................................................................................17 Stay in Touch ................................................................................................................................................................................17 Chapter 1: Markup and Code ..........................................................................18 The First Project ...........................................................................................................................................................................18 Graphical Greetings ....................................................................................................................................................................24 Variations in Text .........................................................................................................................................................................28 Media As Well ..............................................................................................................................................................................36 The Code Alternatives ...............................................................................................................................................................37 Images in Code ............................................................................................................................................................................41 Not Even a Page ..........................................................................................................................................................................43 Chapter 2: XAML Syntax ..................................................................................45 The Gradient Brush in Code ....................................................................................................................................................45 Property Element Syntax ..........................................................................................................................................................48 Content Properties......................................................................................................................................................................51 The TextBlock Content Property.............................................................................................................................................55 Sharing Brushes (and Other Resources) ...............................................................................................................................57 Resources Are Shared ................................................................................................................................................................61 A Bit of Vector Graphics ............................................................................................................................................................62 Stretching with Viewbox ...........................................................................................................................................................71 Styles ...............................................................................................................................................................................................74 A Taste of Data Binding ............................................................................................................................................................80 3 Chapter 3: Basic Event Handling .................................................................... 83 The Tapped Event ........................................................................................................................................................................83 Routed Event Handling .............................................................................................................................................................86 Overriding the Handled Setting .............................................................................................................................................92 Input, Alignment, and Backgrounds .....................................................................................................................................93 Size and Orientation Changes ................................................................................................................................................97 Bindings to Run? .......................................................................................................................................................................101 Timers and Animation .............................................................................................................................................................103 Chapter 4: The Border Element ..................................................................... 111 The Border Element ..................................................................................................................................................................111 Rectangle and Ellipse ...............................................................................................................................................................115 The StackPanel ...........................................................................................................................................................................117 Horizontal Stacks .......................................................................................................................................................................121 WhatSize with Bindings (and a Converter) .......................................................................................................................124 The ScrollViewer Solution .......................................................................................................................................................128 Layout Weirdness or Normalcy? ..........................................................................................................................................134 Making an E-Book ....................................................................................................................................................................135 Fancier StackPanel Items ........................................................................................................................................................138 Deriving from UserControl.....................................................................................................................................................141 Creating Windows Runtime Libraries .................................................................................................................................143 The Wrap Alternative ...............................................................................................................................................................146 The Canvas and Attached Properties .................................................................................................................................148 The Z-Index .................................................................................................................................................................................153 Canvas Weirdness .....................................................................................................................................................................153 Chapter 5: Control Interaction ...................................................................... 155 The Control Difference ............................................................................................................................................................155 The Slider for Ranges ...............................................................................................................................................................157 The Grid........................................................................................................................................................................................161 Orientation and Aspect Ratios ..............................................................................................................................................168 Slider and the Formatted String Converter ......................................................................................................................171 4 Tooltips and Conversions .......................................................................................................................................................171 Sketching with Sliders ..............................................................................................................................................................174 The Varieties of Button Experience .....................................................................................................................................176 Defining Dependency Properties .........................................................................................................................................184 RadioButton Tags ......................................................................................................................................................................194 Keyboard Input and TextBox .................................................................................................................................................200 Touch and Thumb.....................................................................................................................................................................204 Chapter 6: WinRT and MVVM .......................................................................211 MVVM (Brief and Simplified).................................................................................................................................................211 Data Binding Notifications .....................................................................................................................................................212 A View Model for ColorScroll ................................................................................................................................................214 Syntactic Shortcuts ...................................................................................................................................................................219 The DataContext Property .....................................................................................................................................................222 Bindings and TextBox...............................................................................................................................................................224 Buttons and MVVM ..................................................................................................................................................................230 The DelegateCommand Class ................................................................................................................................................231 Chapter 7: Building an Application ..............................................................238 Commands, Options, and Settings ......................................................................................................................................238 The Segoe UI Symbol Font.....................................................................................................................................................240 The Application Bar ..................................................................................................................................................................246 Popups and Dialogs .................................................................................................................................................................248 Windows Runtime File I/O .....................................................................................................................................................251 Await and Async ........................................................................................................................................................................258 Calling Your Own Async Methods .......................................................................................................................................260 Controls for XamlCruncher ....................................................................................................................................................263 Application Settings and Isolated Storage........................................................................................................................278 The XamlCruncher Page .........................................................................................................................................................282 Parsing the XAML......................................................................................................................................................................286 XAML Files In and Out .............................................................................................................................................................288 The Settings Dialog ..................................................................................................................................................................292 5 Beyond the Windows Runtime .............................................................................................................................................298 Chapter 8: Animation ..................................................................................... 299 The Windows.UI.Xaml.Media.Animation Namespace ....................................................................................................299 Animation Basics .......................................................................................................................................................................300 Animation Variation Appreciation .......................................................................................................................................303 Other Double Animations ......................................................................................................................................................310 Animating Attached Properties ............................................................................................................................................317 The Easing Functions ...............................................................................................................................................................320 All-XAML Animations...............................................................................................................................................................329 Animating Custom Classes .....................................................................................................................................................333 Key Frame Animations.............................................................................................................................................................337 The Object Animation ..............................................................................................................................................................341 Predefined Animations and Transitions .............................................................................................................................343 Chapter 9: Transforms .................................................................................... 347 A Brief Overview ........................................................................................................................................................................347 Rotation (Manual and Animated) ........................................................................................................................................350 Visual Feedback .........................................................................................................................................................................356 Translation ...................................................................................................................................................................................358 Transform Groups .....................................................................................................................................................................361 The Scale Transform .................................................................................................................................................................366 Building an Analog Clock .......................................................................................................................................................370 Skew...............................................................................................................................................................................................375 Making an Entrance .................................................................................................................................................................378 Transform Mathematics ..........................................................................................................................................................379 The CompositeTransform .......................................................................................................................................................386 Geometry Transforms ..............................................................................................................................................................389 Brush Transforms .......................................................................................................................................................................391 Dude, Where’s My Element? .................................................................................................................................................395 Projection Transforms ..............................................................................................................................................................398 Deriving a Matrix3D .................................................................................................................................................................405 6 Chapter 13: Touch, Etc. ...................................................................................416 A Pointer Roadmap ..................................................................................................................................................................417 A First Dab at Finger Painting ...............................................................................................................................................420 Capturing the Pointer ..............................................................................................................................................................423 Editing with a Popup Menu ...................................................................................................................................................431 Pressure Sensitivity ...................................................................................................................................................................435 How Do I Save My Drawings? ...............................................................................................................................................438 A Touch Piano ............................................................................................................................................................................439 Manipulation, Fingers, and Elements .................................................................................................................................444 Working with Inertia ................................................................................................................................................................452 An XYSlider Control ..................................................................................................................................................................456 Centered Scaling and Rotation .............................................................................................................................................462 Single-Finger Rotation.............................................................................................................................................................466 Chapter 14: Bitmaps .......................................................................................473 Pixel Bits .......................................................................................................................................................................................474 Transparency and Premultiplied Alphas ............................................................................................................................480 A Radial Gradient Brush ..........................................................................................................................................................485 Loading and Saving Image Files...........................................................................................................................................493 In Progress ...................................................................................................................................................................................503 Completed ...................................................................................................................................................................................503 Chapter 15: Printing .......................................................................................504 Basic Printing ..............................................................................................................................................................................504 Printable and Unprintable Margins .....................................................................................................................................511 The Pagination Process ...........................................................................................................................................................515 Custom Printing Properties....................................................................................................................................................522 Printing a Monthly Planner ....................................................................................................................................................527 Printing a Range of Pages ......................................................................................................................................................537 Where to Do the Big Jobs? ....................................................................................................................................................548 7 Chapter 16: Going Native .............................................................................. 549 An Introduction to P/Invoke..................................................................................................................................................549 Some Help ...................................................................................................................................................................................555 Time Zone Information ...........................................................................................................................................................555 A Windows Runtime Component Wrapper for DirectX ...............................................................................................577 About the Author ........................................................................................... 578
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论