TAILIEUCHUNG - Professional C# Third Edition phần 6

Tất nhiên, các kết quả mà bạn nhận được sẽ phụ thuộc vào các phông chữ mà bạn đã cài đặt trên máy tính của bạn. Đối với mẫu này, chúng tôi đã như bình thường được tạo ra một tiêu chuẩn C # Windows Application, EnumFontFamilies. Chúng tôi bắt đầu bằng cách bổ sung thêm một không gian tên được tìm kiếm. Chúng tôi sẽ sử dụng lớp | Chapter 20 ----Simpo PDF Merge and Split Unregistered Version - http Of course the results that you get will depend on the fonts you have installed on your computer. For this sample we have as usual created a standard C Windows Application EnumFontFamilies. We start off by adding an extra namespace to be searched. We will be using the InstalledFontCollection class which is defined in . using System using using We then add the following constant to the Form1 class private const int margin 10 margin is the size of the left and top margin between the text and the edge of the document it stops the text from appearing right at the edge of the client area. This is designed as a quick-and-easy way of showing off font families therefore the code is crude and in many instances doesn t do things the way you ought to in a real application. For example here we hardcode an estimated value for the document size of 200 1500 and set the AutoScrollMinSize property to this value using the Visual Studio .NET Properties window. Normally you would have to examine the text to be displayed to work out the document size. We do that in the next section. Here is the OnPaint method protected override void OnPaint PaintEventArgs e e int verticalCoordinate margin Point topLeftCorner installedFontCollection insFont new installedFontCollection FontFamily families foreach FontFamily family in families if Font f new Font 12 topLeftCorner new Point margin verticalCoordinate verticalCoordinate e. f topLeftCorner f. Dispose In this code we start off by using an InstalledFontCollection object to obtain an array that contains details of all the available font families. For each family we instantiate a 12-point Font. We use a

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.