91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 9.87M
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發布日期: 2020-12-14
  • 語言: C#
  • 標簽: winform??C#??c??ORM??顯示??

資源簡介

直接讀取ttc、oft、ttf格式的字庫,顯示出來。

本例字庫在bin文件夾里面,字庫網上很多,自行下載。


static class NativeMethods
		{
			const string GDI32 = "gdi32.dll";
			const string USER32 = "user32.dll";

			struct Rect
			{
				public long Left, Top, Right, Bottom;
				public Rect (Rectangle rect) {
					this.Left = rect.Left;
					this.Top = rect.Top;
					this.Right = rect.Right;
					this.Bottom = rect.Bottom;
				}
			}

			static uint ToGdiColor (Color color) {
				return (uint)(color.R | color.G << 8 | color.B << 16);
			}

			[DllImport (GDI32)]
			internal static extern IntPtr CreateFont (
				int nHeight,
				int nWidth,
				int nEscapement,
				int nOrientation,
				int fnWeight,
				uint fdwItalic,
				uint fdwUnderline,
				uint fdwStrikeOut,
				uint fdwCharSet,
				uint fdwOutputPrecision,
				uint fdwClipPrecision,
				uint fdwQuality,
				uint fdwPitchAndFamily,
				string lpszFace
				);
			[DllImport (GDI32)]
			internal static extern IntPtr SelectObject (HandleRef hdc, IntPtr obj);

			[DllImport (GDI32)]
			internal static extern bool DeleteObject (HandleRef obj);

			[DllImport (USER32, CharSet = CharSet.Auto)]
			static extern int DrawText (HandleRef hDC, string lpchText, int nCount, ref Rect lpRect, uint uFormat);
			internal static int DrawText (HandleRef hDC, string text, Rectangle rect, uint format) {
				var r = new Rect (rect);
				return DrawText (hDC, text, text.Length, ref r, format);
			}

			[DllImport (GDI32)]
			static extern uint SetTextColor (HandleRef hdc, uint crColor);
			internal static uint SetTextColor (HandleRef hdc, Color color) {
				return SetTextColor (hdc, ToGdiColor (color));
			}

			[DllImport (GDI32)]
			internal static extern uint SetBkMode (HandleRef hdc, int mode);
		}

資源截圖

代碼片段和文件信息

using?System;
using?System.Drawing;
using?System.Runtime.InteropServices;
using?System.Windows.Forms;

namespace?WindowsFormsApplication1
{
public?partial?class?Form1?:?Form
{
public?Form1?()?{
InitializeComponent?();
}

public?static?void?RenderText?(IDeviceContext?hdc?string?text?string?fontFamily?Color?color?Rectangle?region?int?size)
????????{
var?h?=?new?HandleRef?(null?hdc.GetHdc?());
var?p?=?new?HandleRef?(null?NativeMethods.CreateFont?(size?0?0?0?0?0?0?0?1/*Ansi_encoding*/?0?0?4?0?fontFamily));
try?{
NativeMethods.Selectobject?(h?p.Handle);
NativeMethods.SetBkMode?(h?1);
NativeMethods.SetTextColor?(h?color);
NativeMethods.DrawText?(h?text?region?0x0100);
}
finally?{
NativeMethods.DeleteO

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

????..A..H.?????30208??2017-05-03?13:08??UserFONT\.vs\GdiTextRendererDemo\v14\.suo

?????文件?????????69??2017-04-28?13:09??UserFONT\app.config

?????文件??????12800??2017-05-03?13:08??UserFONT\bin\Debug\GdiTextRendererDemo.exe

?????文件?????????69??2017-04-28?13:09??UserFONT\bin\Debug\GdiTextRendererDemo.exe.config

?????文件??????22016??2017-05-03?13:08??UserFONT\bin\Debug\GdiTextRendererDemo.pdb

?????文件??????21680??2017-05-03?13:08??UserFONT\bin\Debug\GdiTextRendererDemo.vshost.exe

?????文件?????????69??2017-04-28?13:09??UserFONT\bin\Debug\GdiTextRendererDemo.vshost.exe.config

?????文件????????490??2016-07-16?19:44??UserFONT\bin\Debug\GdiTextRendererDemo.vshost.exe.manifest

?????文件????6589188??2007-11-30?12:47??UserFONT\bin\Debug\琉麗字體.ttc

?????文件????3410628??2012-08-28?09:27??UserFONT\bin\Debug\白舟侍書體.ttf

?????文件????7347872??2012-11-13?21:55??UserFONT\bin\Debug\良懷行書.otf

?????文件???????4177??2017-05-03?13:06??UserFONT\Form1.cs

?????文件???????6981??2017-05-03?11:23??UserFONT\Form1.Designer.cs

?????文件???????5814??2017-05-03?11:23??UserFONT\Form1.resx

?????文件???????3472??2017-04-28?13:09??UserFONT\GdiTextRendererDemo.csproj

?????文件???????1840??2017-04-28?13:09??UserFONT\GdiTextRendererDemo.sln

?????文件????????374??2013-03-06?17:17??UserFONT\Program.cs

?????文件???????1392??2013-03-06?14:52??UserFONT\Properties\AssemblyInfo.cs

?????文件???????2888??2017-04-28?13:09??UserFONT\Properties\Resources.Designer.cs

?????文件???????5612??2013-03-06?14:52??UserFONT\Properties\Resources.resx

?????文件???????1124??2017-04-28?13:09??UserFONT\Properties\Settings.Designer.cs

?????文件????????249??2013-03-06?14:52??UserFONT\Properties\Settings.settings

?????目錄??????????0??2017-05-02?14:05??UserFONT\.vs\GdiTextRendererDemo\v14

?????目錄??????????0??2017-05-02?13:59??UserFONT\.vs\GdiTextRendererDemo

?????目錄??????????0??2017-05-03?13:08??UserFONT\bin\Debug

?????目錄??????????0??2017-04-28?13:09??UserFONT\bin\Release

?????目錄??????????0??2017-05-03?13:09??UserFONT\obj\Debug

????...D.H.?????????0??2017-05-02?13:59??UserFONT\.vs

?????目錄??????????0??2017-05-02?13:58??UserFONT\bin

?????目錄??????????0??2017-05-02?13:58??UserFONT\obj

............此處省略5個文件信息

評論

共有 條評論