CST238 Week 8 • Questions / Concerns? • Announcements – Check-off Take Home lab#7 • GUI Bloopers presentations (#5&#6) • New topics – Printing • Richtext box • Graphics / Entire Form – WinForms User control – WinForms using WPF control • No take home lab. Work on final project • Coming up in Week 9, Week 10 & Finals week: – Week 9: No class. Take home test available on Sunday 5/25, due on Wednesday 5/28 at midnight. Work on final project. – Week 10: GUI Bloopers presentations (#7 & #8), project work day, no additional labs or topics covered. – Finals Week: project demo in class & pizza party. • No office hours / lab on Saturday (holiday weekend) but available for questions online or by email. Printing • • • • • • Using System.Drawing.Printing; PrintDialog PrintDocument PrintPage event BeginPrint event Richtextbox demo • Print Form demo User Controls • Control made up of other controls • Building a user control is very similar to building a form • Enables consolidation of common UI • User control can only be used in the project where it’s defined. • If you want a library of controls that you can reuse, then you need to build a custom control. – One reference: http://www.codeproject.com/Articles/2016/Writing-yourCustom-Control-step-by-step User Control • Add a user control to the project. • In Tools->Option->Windows Forms Designer: – Set Automatically Populate Toolbox to true. • Look for the user control in the toolbox. • Add it to the form. • Demo Incorporating WPF Controls • WinForms & WPF interoperability. – You can use WPF controls in WinForms. – You can use WinForm controls in WPF apps. • This is done through ElementHost WPF • Windows Presentation Foundation • Advantage of WPF – Greater degree of control over layout and appearance with WPF. – UI, data binding and events can be specified in a XML file (XAML) – Same XAML specification can be used for Windows Apps and Web Apps. – Richer UI content support for videos, 3D, animation, etc. – Walk through tutorial: http://msdn.microsoft.com/enus/library/ms752299.aspx WPF Control Demo • Create a Windows Forms Project • Add a WPF User Control project in the same solution. • Build the WPF user control using designer & XAML editor • Build the project. • Add a ElementHost to the Windows Form and select the WPF user control just created.