tailieunhanh - Beginning Microsoft Visual Basic 2008 phần 4

Chuyển Editor Mã số dự án trong WPF biên tập văn bản của bạn và thêm mã này: "Gets hoặc bộ các văn bản mà bạn đang chỉnh sửa EditText tài sản công cộng () As String End Return Get Set (ByVal giá trị String) = tài sản Cuối giá trị End Set | Chapter 7 Building Windows Applications 4. Switch to the Code Editor in your WPF Text Editor project and add this code Gets or sets the text that you re editing Public Property EditText As String Get Return End Get Set ByVal value As String value End Set End Property 5. Add the following code to create the ClearEditBox method Clears the txtEdit control Public Sub ClearEditBox Set the EditText property EditText Reset the font color Set the status bar text StatusText Text box cleared End Sub 6. Finally select txtEdit in the Class Name combo box and the TextChanged event in the Method Name combo box at the top of the code editor. Add this code Private Sub txtEdit_TextChanged ByVal sender As Object _ ByVal e As _ Handles Reset the status bar text StatusText Ready End Sub How It Works The first thing you want to do is clear your text box. In the next Try It Out you see how you can call ClearEditBox from the toolbar. All this procedure does is set the EditText property to an empty string by using the Empty field of the String class. Then it sets the ForeColor property of the text box which is the color of the actual text to black and places the text Text box cleared in the status bar. Clears the txtEdit control Public Sub ClearEditBox Set the EditText property EditText Reset the font color Set the status bar text StatusText Text box cleared End Sub 243 Chapter 7 Building Windows Applications The code in the EditText property of your WPF Text Editor project is slightly different in that you need to set the Foreground property of the text box using the Black property from the Brushes class. Reset the font color As mentioned EditText abstracts the action of getting and setting the text in the box away from your actual implementation. This makes it easier for other

TÀI LIỆU MỚI ĐĂNG
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.