Assign one variable to each group of radio buttons To do this, assign one integer variable to the first radio button in each group. All the subsequent.

Slides:



Advertisements
Similar presentations
2D Graphics Drawing Things. Graphics In your GUI, you might want to draw graphics E.g. draw lines, circles, shapes, draw strings etc The Graphics class.
Advertisements

Introduction to Java Programming Lecture 10 Method Benefits, Declaring, and Calling Methods.
多媒體安全 Image J Macros_Change Color 指導老師:黃文禎 學生:張舒函 學號:
Instructor: Ching-Chi Lin 林清池 助理教授
PowerPoint2010 李燕秋 版面配置 版面配置指的是每一個頁面的內容配置 方式,不同的版面配置會有對應的母片。
Introduction to Constructor, Overloading, and Accessibility CS340100, NTHU Yoshi.
BY OX. 檢視表與資料表的差異性 查詢 (query) 檢視表 (View) 的紀錄,是經由查詢 (query) 而來,而檢 視表的資料來源可以是單一資料表或是多資料表,甚 至其他檢視表 但檢視表中的紀錄只存在資料表中.
多媒體安全 Macros Examples Gamma.txt 報告學生:碩專 2A 王朝鵬 ( ) 指導教授:黃文楨 博士.
建立靜態資料成員 關鍵字: static 靜態資料成員不屬於特定物件,而是該類物件 所共同擁有的,可做為類別範圍裡的靜態變數。
第 13 章 常數、靜態成員與朋友關 係 13-1 常數物件與成員 13-1 常數物件與成員 13-2 物件成員與巢狀類別 13-2 物件成員與巢狀類別 13-3 靜態成員資料與函數 13-3 靜態成員資料與函數 13-4 朋友關係 13-4 朋友關係.
JAVA 程式設計與資料結構 第十四章 Linked List. Introduction Linked List 的結構就是將物件排成一列, 有點像是 Array ,但是我們卻無法直接經 由 index 得到其中的物件 在 Linked List 中,每一個點我們稱之為 node ,第一個 node.
JAVA 程式設計與資料結構 第十章 GUI Introdution III. File Chooser  File Chooser 是一個選擇檔案的圖形介面, 無論我們是要存檔還是要開啟檔案,使 用這個物件都會讓我們覺得容易且舒適。
第 7 章 程序與函數 7-1 模組化程式設計 7-1 模組化程式設計 7-2 VB.NET 的程序與函數 7-2 VB.NET 的程序與函數 7-3 程序與函數的變數範圍 7-3 程序與函數的變數範圍 7-4 VB.NET 常用的內建函數 7-4 VB.NET 常用的內建函數 7-5 遞迴函數 7-5.
第 9 章 視窗應用程式的事件處理 9-1 事件的基礎 9-1 事件的基礎 9-2 表單事件 9-2 表單事件 9-3 滑鼠事件 9-3 滑鼠事件 9-4 鍵盤事件 9-4 鍵盤事件 9-5 表單的鍵盤事件 9-5 表單的鍵盤事件 9-6 控制項的事件 9-6 控制項的事件.
Thinking in Objects Outline The this Reference [Sample code] PressEnter.java.
第12章 建立多表單與模組的應用程式 12-1 Visual Basic的方案與專案 12-2 模組化Visual Basic應用程式
各種線上電子資源的特異功能 SwetsWise 的 alert, TOC alert 與 Favorites 2003/4/28 修改.
1 第 9 章 視窗應用程式的事件處理 9-1 事件的基礎 9-1 事件的基礎 9-2 表單事件 9-2 表單事件 9-3 滑鼠事件 9-3 滑鼠事件 9-4 鍵盤事件 9-4 鍵盤事件 9-5 表單的鍵盤事件 9-5 表單的鍵盤事件 9-6 控制項的事件 9-6 控制項的事件.
企二 A 管理程式設計 Visual Basic 6.0 Visual Basic 6.0 Visual Basic 6.0 企二 A 管理程式設計 Visual Basic 6.0 Visual Basic 6.0 Visual Basic 6.0許翠婷
Hung-Hsiang WuWindows Processing Design1 Chapter 4 簡單視窗程式 表單與標籤的屬性 按鈕與編輯的屬性 設計簡單的應用程式 表單常用事件 一般鍵盤及滑鼠常見的事件 表單視窗間的呼叫 表單間資料傳送應用 專案選擇設定.
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2008.
程式設計 Visual Basic 6.0 Visual Basic 6.0 Visual Basic 6.0 程式設計 Visual Basic 6.0 Visual Basic 6.0 Visual Basic 6.0許翠婷
第 17 章 樣板 17-1 樣板的基礎 17-1 樣板的基礎 17-2 樣板函數 17-2 樣板函數 17-3 樣板類別 17-3 樣板類別 17-4 非型態參數的樣板類別 17-4 非型態參數的樣板類別 17-5 樣板類別的繼承 17-5 樣板類別的繼承 17-6 特化樣板與靜態成員 17-6 特化樣板與靜態成員.
MFC Example 游子宜.
第12章 多重表單與模組的應用程式 12-1 VB.NET的方案與專案 12-2 模組化VB.NET應用程式 12-3 多重表單的應用程式
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2009.
程式設計 Visual Basic 6.0 Visual Basic 6.0 Visual Basic 6.0 程式設計 Visual Basic 6.0 Visual Basic 6.0 Visual Basic 6.0許翠婷
第 9 章 視窗應用程式的事件處理 9-1 事件的基礎 9-1 事件的基礎 9-2 表單事件 9-2 表單事件 9-3 滑鼠事件 9-3 滑鼠事件 9-4 鍵盤事件 9-4 鍵盤事件 9-5 表單的鍵盤事件 9-5 表單的鍵盤事件 9-6 控制項的事件 9-6 控制項的事件.
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2010.
Microsoft Excel.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Working with Macros and Visual Basic for Applications (VBA)
Chapter 9 Macros, Navigation Forms, PivotTables, and PivotCharts
Copyright 2007, Information Builders. Slide 1 Maintain & JavaScript: Two Great Tools that Work Great Together Mark Derwin and Mark Rawls Information Builders.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Programming with Microsoft Visual Basic th Edition
Copyright 2007, Information Builders. Slide 1 WebFOCUS Maintain – Enhancing Objects with JavaScript Mark Derwin Information Builders Information Builders.
Visual C++ Lecture 11 Friday, 29 Aug Windows Graphic User Interface l Event driven programming environment l Windows graphic libraries (X11 on Unix,
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
CSE 219 Computer Science III Images. HW1 Has been posted on Blackboard Making a Game of Life with limited options.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
MFC Windows Programming: Document/View Approach More detailed notes at: 360/notes-html/class15.htm.
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.
By Szeto CYVisual C# Text form1Clock (label1) lblHH00 (label2) lblMM00 (label3) lblSS00 label4: label5: timer1Interval 500 Enabled true 按照下表,更改各控制項.
Creating Buttons – Lesson 51 Creating Buttons Lesson 5.
ADO.NET. ADO.NET 精靈化設計 精靈化設計 程式化設計 程式化設計 SQL 指令 SQL 指令 DataGrid, DataList DataGrid, DataList DataBind DataBind.
Data Structures (1st Exam). 1.[5] Suppose there are only two constructors for a class, one that passes in a single integer parameter called amount, for.
BZUPAGES.COM Visual Programming Lecture – 6- 7 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.
Microsoft Outlook 2010 Chapter 3 Managing Contacts and Personal Contact Information with Outlook.
Microsoft Access 2010 Chapter 8 Advanced Form Techniques.
1 PanelView ™ 300 Micro & MicroLogix ™ Lab 1. 2 Today you will receive training on the NEW PanelView 300 Micro operator terminal and the NEW version of.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 6 Creating an Application System Using Macros, Wizards, and the Switchboard.
Chapter2: Drawing a Window. Review: Introducing MFC.
Building the Events Components– Lesson 111 Building the Events Components Lesson 11.
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface Creating a Multiple-Form Interface.
Chapter 8 Dialog Boxes and Property Sheet. 2 Two kinds of dialog boxes Dialog boxes –Modal dialog When appear, it takes all ownership of input. It disables.
Chapter2: Drawing a Window
WORD. Office applications includes Word, Excel, PowerPoint, Access, …. They are Windows applications. We’ll study three applications: Word, Excel, PowerPoint.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
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.
© Anselm Spoerri Lecture 7 Meaning –Guiding Principles for Term Project Mechanics –Interactivity Recap –Simple and Disjointed Rollovers and Image Map –Navigation.
Problem: Take Two Numbers, Add Them Together And Display The Results. Now To Build The Flowchart… We Probably Need One Like This… Let’s Add The Routines…
Creating cast members  Using tool palette window that can be selected from window menu.  The following objects can be created: Push buttons, Radio buttons,
Creating ActiveX Controls at runtime If you need to create an ActiveX Control at runtime without a resource template entry, follow the programming steps.
Group 2 Block 胡貴蓉 Project 2 JMVC code tracing.
Working with Dialogs and Controls
File Upload.
動態版面 建國科技大學 資管系 饒瑞佶 2017/7.
Khongorzul D Window Programming CBNU,
Chapter 14 Drawing in a Window
Presentation transcript:

Assign one variable to each group of radio buttons To do this, assign one integer variable to the first radio button in each group. All the subsequent radio buttons in each group will assigned to the same variable. ObjectNameCategoryTypeAccess IDC_RTPENm_iToolvalueintpublic IDC_RSLINEm_iShapevalueintpublic IDC_RCBLACKm_iColorvalueintpublic

寫 Exit 鈕的事件程序 呼叫父類別的 OnOK 函式 Adding the second dialog – 在「資源檢視」視窗中, insert 一個 dialog 至 dialog folder – 移除 dialog 上已存在的控制項 – 設定屬性值 「 System Menu 」選項設成 False (Prevent users from closing this dialog without exiting the application) 「 ID 」設成 IDD_PAINT_DLG

Adding the second dialog Right-click the dialog and choose 「 Add Class 」 –Specify the name of the new class as 「 CPaintDlg 」, and make sure the base class is set to 「 CDialog 」 –Click 「 Finish 」 to create the new class Now that we have defined the second dialog, we need to add the code in the first dialog to open the second dialog

Add the code in the first dialog to open the second dialog Expand the class tree to show the CXXXDlg class Right-click the CXXXDlg class and choose Add, Add variable Specify the variable type as CPaintDlg, the name as m_dlgPaint, and the access as Private. Click finish to add the variable Expand the CXXXDlg node to show the methods. Double-click the OnInitDialog method

Add the code in the first dialog to open the second dialog 加入以下程式碼(加在 TODO 後面): //Initialize the variables and update the dialog window m_iColor=0; m_iShape=0; m_iTool=0; UpdateData(FALSE); //Create the second dialog window //Pass a pointer to the first dialog as the parent window for the second window //This set up a parent-child relationship between these two windows m_dlgPaint.Create(IDD_PAINT_DLG, this); //Show the second dialog window m_dlgPaint.ShowWindow(SW_SHOW);

Adding the Graphics Capabilities Drawing Lines –Add a new member variable to the second dialog class, CpaintDlg public: static const COLORREF m_crColors[8]; –Open the source code file for the second dialog class(PaintDlg.cpp) and add the color table const COLORREF CPaintDlg::m_crColors[8]= { RGB( 0, 0, 0), //Black RGB( 0, 0,128), //Dark Blue RGB( 0,128, 0), //Dark Green RGB( 0,128,128), //Dark Cyan RGB(128, 0, 0), //Dark Red RGB(128, 0,128), //Dark Magenta RGB(128,128, 0), //Dark Yellow RGB(128,128,128) //----- };

OnPaint Function Whenever a window needs to be redrawn, the O.S. trigger the dialogs OnPaint Function –Add an event handler for the WM_PAINT message on the second dialog class – 加入以下程式碼 CDialog_2Dlg *pWnd = (CDialog_2Dlg*)GetParent(); if (pWnd) { if (pWnd->m_iTool==2) {} else { if (pWnd->m_iShape==0) DrawLine(&dc, pWnd->m_iColor); }

DrawLine Function Add DrawLine Function to CPaintDlg class –Right-click the CPaintDlg class, Choose Add, Add Function from the context menu. Return type : void Function Name : DrawLine Function access : Private First parameter : CpaintDC* pdc Second parameter : int iColor 程式碼內容參照 DrawLine.txt 在 paintDlg.cpp 的程式上方加「 #include “dialog_2Dlg.h” 」

The second window needs to be redrawn whenever users change a selection on the first dialog The function Invalidate –Is a member function of the CWnd clas. –It tells the window, and the Operating system, that the display area is no longer valid and that it needs to be redrawn

Write the event handler for all radio buttons Select the first radio button on the first dialog Add an event handler for the BN_CLICKED event message. –Don’t accept the default name for this function ; Enter the name 「 OnRSelection 」 –Open the XXXDlg.cpp file and locate the Message Map section for the CGraphicsDlg class. –Copy the ON_BN_CLICKED macro, and paste it in the message map 13 more times. Edit these new copies of the ON_BN_CLICKED macro, replacing the ID for the first radio button with the IDs of the other 13 radio buttons.

Write the event handler for all radio buttons 在 XXXDlg.cpp 中的 OnRSelection 函式中加入以下 程式碼: //Synchronize the data UpdateData(TRUE); //Repaint the second dialog m_dlgPaint.Invalidate();

Drawing Circles and Squares Modify OnPaint Function if (pWnd->m_iShape==0) DrawLine(&dc, pWnd->m_iColor); else//We are drawing a ellipse or rectangle DrawRegion(&dc, pWnd->m_iColor, pWnd->m_iTool, pWnd->m_iShape);

Add the DrawRegion Function Add a new function to the second dialog class –Return type : void –Function Name : DrawRegion –Function access : Private –First parameter : CpaintDC* pdc –Second parameter : int iColor –Third parameter : int iTool –Fourth parameter : int iShape 程式內容如 DrawRegion.txt

Loading Bitmaps Add the following variables to the CXXXDlg class Add an event-handler function to the clicked event of the Bitmap button 程式碼詳見 ClickedBitmap.txt NameTypeAccess 用途 m_strBitmapCstringpublicTo hold the bitmap name m_bmtBitmapCBitmapPublicTo hold bitmap image

Displaying Bitmaps Add a member function to the second dialog class –Return type : void –Fuction name : ShowBitmap –Parameter : CPaintDC* pdc –Fuction Acess : private Code in the ShowBitmap Function : ShowBitmap.txt

Modify OnPaint Function if (pWnd->m_iTool==2) { //Is there a bitmap selected and loaded? if (pWnd->m_strBitmap.GetLength() > 0) ShowBitmap(&dc); }