Tran Anh Tuan A.  Help to modify a control’s behavior by deriving classes of your own from the MFC control classes  Help to build reusable, self-contained.

Slides:



Advertisements
Similar presentations
Creating and Editing a Web Page Using Inline Styles
Advertisements

Using Macros and Visual Basic for Applications (VBA) with Excel
Tutorial 12: Enhancing Excel with Visual Basic for Applications
Microsoft Office Illustrated Fundamentals Unit N: Polishing and Running a Presentation.
1.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
IS 1181 IS 118 Introduction to Development Tools VB Chapter 03.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Printing and Page Formatting ITSW 1401, Intro to Word Processing Instructor: Glenda H. Easter.
Document Basics Lesson 2. Skills Matrix SKILL #MATRIX SKILL 1.1.2Apply Quick Styles to documents 1.1.3Format documents using themes 1.1.4Customize a theme.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Guided Lesson.  In this lesson, you will learn how to modify existing bullets, insert new bulleted and numbered lists, select symbols as bullets, and.
1 ADVANCED MICROSOFT WORD Lesson 15 – Creating Forms and Working with Web Documents Microsoft Office 2003: Advanced.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Lesson 6: Working with Layout and Graphics
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
© 2002 ComputerPREP, Inc. All rights reserved. Word 2000: Working with Long Documents.
Programming a GUI Hanan sedaghat pisheh. For calling GUI, we need a function with no inputs or outputs First We create a m.file m file has the same name.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 22 Macros.
Find and enter a chat room Use Lync search to find rooms that you have access to. 1.In the Lync main window, click the Chat Rooms tab. 2.In the search.
Microsoft Office 2007 Word Chapter 1 Creating and Editing a Word Document.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 4 1 Microsoft Office FrontPage 2003 Tutorial 4 – Using Shared Borders and Themes.
Microsoft Visual Basic 2008 CHAPTER ELEVEN Multiple Classes and Inheritance.
Lehigh University Introduction to Flash MX Sharmeen Mecklai.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 21 Fields and Forms.
Creating a Web Site to Gather Data and Conduct Research.
Chapter 2 More Controls Programming in C#. NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Microsoft Word 2000 Presentation 5. Major Word Topics Columns Tables Lists.
ACCESS Part 2. OBJECTIVES  Use the Form Wizard  Create a split form  Use Form Layout View  Add fields to a form  Modify form controls  Create calculations.
Chapter 10 Fireworks: Part II The Web Warrior Guide to Web Design Technologies.
AUTO-BUSINESS HOW DO WE USE HYPERLINKS?. Edit an image that represents a hyperlink If a picture, AutoShape, or other graphic is used to represent a hyperlink,
Chapter 2 - More Controls More controls – Text boxes - used for user input – Frames - containers to group items – check boxes - user select an option -
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
Classic Controls Trần Anh Tuấn A. Week 1 How to create a MFC project in VS 6.0 How to create a MFC project in VS 6.0 Introduction to Classic Controls.
Laboratory Exercise # 9 – Inserting Graphics to Documents Office Productivity Tools 1 Laboratory Exercise # 9 Inserting Graphics to Documents Objectives:
Tutorial 2 Drawing Shapes, Adding Text, and Creating Symbols.
Chapter 7 Controls.
BZUPAGES.COM Visual Programming Lecture – 6- 7 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.
Using Microsoft Visual Studio 2005 Original by Suma Rao Revised by John G. McMahon ( 9/6/2008 )
Microsoft Outlook 2010 Chapter 3 Managing Contacts and Personal Contact Information with Outlook.
BIM211 – Visual Programming Interacting with Users Graphics 1.
1. Chapter 15 Creating Charts 3 Charting Data in Word A chart or graph presents data visually. A chart depicts numeric data in a graphical format. If.
Chapter 2 – Introduction to the Visual Studio .NET IDE
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Chapter 7 Controls. Scroll bar control 3 Scroll bar control (1/3) Scroll bar codes (interfaces)
Visual Basic Programming Introduction VB is one of the High level language VB has evolved from the BASIC language. BASIC stands for Beginners All-purpose.
Double –Click on the Netscape Icon on your desktop The following are a series of steps to help you get started with Netscape Composer.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. M I C R O S O F T ® Developing Presentation Text Lesson 2.
© 2006 ITT Educational Services Inc. CD230 Architectural Design & Drafting: Unit 7 Slide 1 Unit 7 AEC Dimensions and Elevations in ADT.
Introducing Dreamweaver. Dreamweaver The web development application used to create web pages Part of the Adobe creative suite.
Creating and Editing a Web Page
Chapter 2 More Controls Programming in C#. NET Objectives Use text boxes, group boxes, check boxes, radio buttons, and picture boxes effectively.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Microsoft PowerPoint Prepared by the Academic Faculty Members of IT.
IMS 3253: Controls 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Check Boxes Radio Buttons Date Time Picker Masked.
Creating and Editing a Web Page Using Inline Styles
TOOLBOX. The Toolbox Intrinsic Controls - always included in the Toolbox ActiveX Controls - separate files with ocx file extension Insertable Objects.
Chapter 7 Controls. List box control 3 List Box Control(1/8) Listbox control: –Display lists of text strings called items –Optionally sort the items.
Microsoft PowerPoint Prepared by the Academic Faculty Members of IT.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Hamilton Software Products The Measure of Excellence Customized dialog.
Mail Merge Introduction to Word Processing ITSW 1401 Instructor: Glenda H. Easter Introduction to Word Processing ITSW 1401 Instructor: Glenda H. Easter.
Lexical Reference Variables in Graphics and List Box in Forms
Chapter 2 – Introduction to the Visual Studio .NET IDE
Working with Dialogs and Controls
Visual C# - GUI and controls - 1
Presentation transcript:

Tran Anh Tuan A

 Help to modify a control’s behavior by deriving classes of your own from the MFC control classes  Help to build reusable, self-contained control classes that respond to their own notification message  Modify: MFC Control Classes + Control Events  New Style of Controls

 Numeric Edit Controls  Owner-Draw List Boxes  Graphical Push Buttons  Customizing a Control’s Colors

 A normal edit control accepts a wide range of characters, including numbers, letters of the alphabet, and punctuation symbols.  A numeric edit control accepts only numbers. It's perfect for entering phone numbers, serial numbers, IP addresses, and other numeric data.

 Example : Create an edit control which allows user input Student ID and the length must be 7 characters.

 Step 1 : New a class name : CNumEdit that is derived from MFC Classes CEdit

 When an edit control has the input focus and a character key is pressed, the control receives a WM_CHAR message.

 Step 2: Code in OnChar function to make the constrains

 Step 3 : Create variable for a object from class CNumEdit in class Dialog

 Transfer of data between a control in a dialog box and a data member.  Result in running:

 By default, items in a list box consist of strings of text. Should you need a list box that displays graphical images instead of text, you can create an owner-draw list box—one whose contents are drawn by your application, not by Windows—by following two simple steps. ◦ Derive a new list box class from CListBox, and override CListBox::MeasureItem and CListBox::DrawItem. Also override PreCreateWindow, and make sure that either LBS_OWNERDRAWFIXED or LBS_OWNERDRAWVARIABLE is included in the list box style. ◦ Instantiate the derived class, and use Create or CreateEx to create the list box.

 Example: Create a Graphical ListBox and show the Graphical Image when choose a Item in ListBox

 Step 1: Design the Dialog with a ListBox and Picture Control  Remember : in the ListBox ◦ Owner Draw : Variable ◦ Has strings : Check

 Step 2 : In Resource Tab. Insert Bitmap and remember these bitmap ID for later using

 Choose a series of bmp Image in your Drives

 Step 3: Create a new class COwnerDrawListBox to customize your ListBox

 Add needed functions into the class

 Make the code to customize the ListBox

 Step 4: Add a object variable from COwnerDrawListBox into Class Dialog and make the transfer of data.

 OnInitDialog : I do AddItem into Custom ListBox

 Step 5: When Choose a Item In ListBox. Image will be showed. Remember Event LBN_SELCHANGE for ListBox

 Create control variable m_samplePic for Picture control and :

 Result :

 Two button styles that were first introduced in Windows 95—BS_BITMAP and BS_ICON— make graphical push buttons a breeze by taking a single image and creating a push button from it.  A BS_BITMAP-style push button (henceforth, a bitmap push button) displays a bitmap on the face of a push button.  A BS_ICON-style push button (an icon push button) displays an icon.

 Example : change the button OK and Cancel into Graphical ones  Step 1: Insert new Icons into resource

 Step 2: Change the properties of two button and add control valuable for them

 Step 3: Make the code change apperance of OK and Cancel button in OnInitDialog

 MFC supports two mechanisms for changing a control's colors. Both rely on the fact that before a control paints itself, it sends its parent a message containing the handle of the device context used to do the painting.  The parent can call CDC::SetTextColor and CDC::SetBkColor on that device context to alter the attributes of any text drawn by the control. It can also alter the control's background color by returning a brush handle (HBRUSH).

 Example : Change the background and text of input Name value for Edit Box  Step 1: Create Class CEditColor Derived from CEdit and Add variable about color and function ton change them into class

 Remember : Event WM_CTLCOLOR

 Step 2: Make the Transfer Data and change color in OnInitDialog

 Result :