tailieunhanh - Using Common Dialog Controls

Sử dụng thường Dialog Controls The Bell Ringers ứng dụng bây giờ cho phép bạn lưu thông tin, nhưng nó luôn luôn lưu dữ liệu vào cùng một tập tin, ghi đè lên bất cứ điều gì đã có. Ngoài ra, các chức năng in ấn vẫn còn mất tích. Bây giờ là thời gian để giải quyết những vấn đề này. | Using Common Dialog Controls The Bell Ringers application now allows you to save information but it always saves data to the same file overwriting anything that is already there. Also the print functionality is still missing. Now is the time to address these issues. There are a number of everyday tasks that require the user to specify some sort of information. For example if the user wants to print a file the user is usually asked which printer to use and the user can set additional properties such as the number of copies. You might have noticed that the same Print dialog box is used by many different applications. This is not due to lack of imagination by applications developers it is just that the requirement is so common that Microsoft has standardized it and made it available as a common dialog a component supplied with the Microsoft Windows operating system that you can use in your own applications. There are a number of other common dialog boxes available as well including dialog boxes for opening and saving files selecting colors and fonts specifying page formats and performing print previews. You can use any of these common dialog boxes in Visual Studio 2005 through the common dialog controls. Using the SaveFileDialog Control In the following exercise you will use the SaveFileDialog control. In the BellRingers application when the user saves details to a file you will prompt the user for the name and location of the file by using a SaveFileDialog control. Use a SaveFileDialog control 1. Display MemberForm in the Design View window. 2. In the Toolbox expand the Dialogs category. 3. Drag a SaveFileDialog control onto the form. The control appears under the form and is given the name saveFileDialog1. 4. Click the saveFileDialogl control. In the Properties window set its properties by using the values specified in the following table. Property Value Description Name saveFileDialog The name of the control. . r Setting this property to True allows the dialog .