本文整理汇总了C#中SharpDX.DirectWrite.TextFormat类的典型用法代码示例。如果您正苦于以下问题:C# TextFormat类的具体用法?C# TextFormat怎么用?C# TextFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextFormat类属于SharpDX.DirectWrite命名空间,在下文中一共展示了TextFormat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Initialize
protected override void Initialize(DemoConfiguration demoConfiguration)
{
base.Initialize(demoConfiguration);
// Initialize a TextFormat
TextFormat = new TextFormat(FactoryDWrite, "Calibri", 128) {TextAlignment = TextAlignment.Center, ParagraphAlignment = ParagraphAlignment.Center};
RenderTarget2D.TextAntialiasMode = TextAntialiasMode.Cleartype;
// Initialize a TextLayout
TextLayout = new TextLayout(FactoryDWrite, "SharpDX D2D1 - DWrite", TextFormat, demoConfiguration.Width, demoConfiguration.Height);
}
开发者ID:Nezz,项目名称:SharpDX,代码行数:12,代码来源:Program.cs
示例2: Radar
public Radar(CSGOTheme theme, TextFormat font, float resolution) : base(theme, font) {
this.Width = 256f;
this.Height = 256f;
this.dotSize = 6f;
this.viewX = 24f;
this.viewY = 48f;
}
开发者ID:nkarpey,项目名称:Zat-s-External-CSGO-Multihack,代码行数:7,代码来源:Radar.cs
示例3: FormattedTextImpl
public FormattedTextImpl(
string text,
string fontFamily,
double fontSize,
FontStyle fontStyle,
TextAlignment textAlignment,
FontWeight fontWeight,
TextWrapping wrapping)
{
var factory = AvaloniaLocator.Current.GetService<DWrite.Factory>();
using (var format = new DWrite.TextFormat(
factory,
fontFamily,
(DWrite.FontWeight)fontWeight,
(DWrite.FontStyle)fontStyle,
(float)fontSize))
{
format.WordWrapping = wrapping == TextWrapping.Wrap ?
DWrite.WordWrapping.Wrap : DWrite.WordWrapping.NoWrap;
TextLayout = new DWrite.TextLayout(
factory,
text ?? string.Empty,
format,
float.MaxValue,
float.MaxValue);
}
TextLayout.TextAlignment = textAlignment.ToDirect2D();
}
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:31,代码来源:FormattedTextImpl.cs
示例4: OnLoad
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// Direct2D
var renderTargetProperties = new RenderTargetProperties()
{
PixelFormat = new PixelFormat(SharpDX.DXGI.Format.B8G8R8A8_UNorm, AlphaMode.Ignore)
};
var hwndRenderTargetProperties = new HwndRenderTargetProperties()
{
Hwnd = this.Handle,
PixelSize = new Size2(bounds.Width, bounds.Height),
PresentOptions = PresentOptions.Immediately,
};
renderTarget = new WindowRenderTarget(factory, renderTargetProperties, hwndRenderTargetProperties);
var bitmapProperties = new BitmapProperties()
{
PixelFormat = new PixelFormat(SharpDX.DXGI.Format.B8G8R8A8_UNorm, AlphaMode.Ignore)
};
bitmap = new SharpDX.Direct2D1.Bitmap(renderTarget, new Size2(bounds.Width, bounds.Height), bitmapProperties);
textFormat = new TextFormat(directWriteFacrtory, "Arial", FontWeight.Normal, SharpDX.DirectWrite.FontStyle.Normal, 96.0f);
textFormat.ParagraphAlignment = ParagraphAlignment.Center;
textFormat.TextAlignment = TextAlignment.Center;
solidColorBrush = new SolidColorBrush(renderTarget, Color4.White);
}
开发者ID:dmak78,项目名称:RoomAliveToolkit,代码行数:29,代码来源:ProjectorForm.cs
示例5: ListPanel
public ListPanel(Theme theme, TextFormat font, float x, float y, float width, float height, float paddingX, float paddingY, float spaceY)
: base(theme, font, x, y, width, height)
{
this.paddingX = paddingX;
this.paddingY = paddingY;
this.spaceY = spaceY;
}
开发者ID:nkarpey,项目名称:Zat-s-External-CSGO-Multihack,代码行数:7,代码来源:ListPanel.cs
示例6: MenuItem
public MenuItem(Theme theme, TextFormat font, float x, float y, float width, float height, Menu parentMenu, string text, string extraData)
: base(theme, font, x, y, width, height)
{
this.parentMenu = parentMenu;
this.Text = text;
this.extraData = extraData;
}
开发者ID:nkarpey,项目名称:Zat-s-External-CSGO-Multihack,代码行数:7,代码来源:MenuItem.cs
示例7: Label
public Label(Theme theme, TextFormat font, float x, float y, float width, float height, string text)
: base(theme, font, x, y, width, height)
{
this.Text = text;
this.align = HorizontalAlign.Left;
this.castShadow = false;
}
开发者ID:nkarpey,项目名称:Zat-s-External-CSGO-Multihack,代码行数:7,代码来源:Label.cs
示例8: Initialize
public virtual void Initialize(DeviceManager deviceManager)
{
sceneColorBrush = new SolidColorBrush(deviceManager.ContextDirect2D, Color.Blue);
textFormat = new TextFormat(deviceManager.FactoryDirectWrite, "Calibri", 20) { TextAlignment = TextAlignment.Leading, ParagraphAlignment = ParagraphAlignment.Center };
clock = Stopwatch.StartNew();
deviceManager.ContextDirect2D.TextAntialiasMode = TextAntialiasMode.Grayscale;
}
开发者ID:j796160836,项目名称:Multi-Touch-Example,代码行数:7,代码来源:FpsRenderer.cs
示例9: FormattedTextImpl
public FormattedTextImpl(
string text,
string fontFamily,
double fontSize,
FontStyle fontStyle,
TextAlignment textAlignment,
FontWeight fontWeight)
{
var factory = Locator.Current.GetService<DWrite.Factory>();
var format = new DWrite.TextFormat(
factory,
fontFamily,
(DWrite.FontWeight)fontWeight,
(DWrite.FontStyle)fontStyle,
(float)fontSize);
TextLayout = new DWrite.TextLayout(
factory,
text ?? string.Empty,
format,
float.MaxValue,
float.MaxValue);
TextLayout.TextAlignment = textAlignment.ToDirect2D();
}
开发者ID:healtech,项目名称:Perspex,代码行数:26,代码来源:FormattedTextImpl.cs
示例10: InfoText
public InfoText(SharpDX.Direct3D11.Device device, int width, int height)
{
_immediateContext = device.ImmediateContext;
_rect.Size = new Size2F(width, height);
_bitmapSize = width * height * 4;
IsEnabled = true;
using (var factoryWic = new SharpDX.WIC.ImagingFactory())
{
_wicBitmap = new SharpDX.WIC.Bitmap(factoryWic,
width, height, _pixelFormat, SharpDX.WIC.BitmapCreateCacheOption.CacheOnLoad);
}
var renderTargetProperties = new RenderTargetProperties(RenderTargetType.Default,
new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.R8G8B8A8_UNorm,
SharpDX.Direct2D1.AlphaMode.Premultiplied), 0, 0, RenderTargetUsage.None,
SharpDX.Direct2D1.FeatureLevel.Level_DEFAULT);
using (var factory2D = new SharpDX.Direct2D1.Factory())
{
_wicRenderTarget = new WicRenderTarget(factory2D, _wicBitmap, renderTargetProperties);
_wicRenderTarget.TextAntialiasMode = TextAntialiasMode.Default;
}
using (var factoryDWrite = new SharpDX.DirectWrite.Factory(SharpDX.DirectWrite.FactoryType.Shared))
{
_textFormat = new TextFormat(factoryDWrite, "Tahoma", 20);
}
Color4 color = new Color4(1, 1, 1, 1);
_sceneColorBrush = new SolidColorBrush(_wicRenderTarget, color);
_clearColor = color;
_clearColor.Alpha = 0;
_renderTexture = new Texture2D(device, new Texture2DDescription()
{
ArraySize = 1,
BindFlags = BindFlags.ShaderResource,
CpuAccessFlags = CpuAccessFlags.Write,
Format = Format.R8G8B8A8_UNorm,
Height = height,
Width = width,
MipLevels = 1,
OptionFlags = ResourceOptionFlags.None,
SampleDescription = new SampleDescription(1, 0),
Usage = ResourceUsage.Dynamic
});
OverlayBufferRes = new ShaderResourceView(device, _renderTexture, new ShaderResourceViewDescription()
{
Format = _renderTexture.Description.Format,
Dimension = ShaderResourceViewDimension.Texture2D,
Texture2D = new ShaderResourceViewDescription.Texture2DResource()
{
MipLevels = 1,
MostDetailedMip = 0
}
});
}
开发者ID:sinkingsugar,项目名称:BulletSharpPInvoke,代码行数:59,代码来源:InfoText.cs
示例11: Initialize
//public static Brush TEXT_BRUSH;
public static void Initialize(RenderTarget g)
{
SCBRUSH_RED = new SolidColorBrush(g, Color.Red);
SCBRUSH_BLACK = new SolidColorBrush(g, Color.Black);
WRITE_FACTORY = new SharpDX.DirectWrite.Factory();
TEXT_FORMAT = new TextFormat(WRITE_FACTORY, "Arial", 14);
//TEXT_BRUSH = new SolidColorBrush(g, Color.Red);
}
开发者ID:Harrum,项目名称:TestGamePlsIgnore,代码行数:9,代码来源:Resources.cs
示例12: ProgressBar
public ProgressBar(ProgressBarTheme theme, TextFormat font, float x, float y, float width, float height, float value, float maxValue, bool blinkingEnabled, float blinkingThreshold)
: base(theme, font, x, y, width, height)
{
this.currValue = value;
this.maxValue = maxValue;
this.blinkingEnabled = blinkingEnabled;
this.blinkingThreshold = blinkingThreshold;
}
开发者ID:nkarpey,项目名称:Zat-s-External-CSGO-Multihack,代码行数:8,代码来源:ProgressBar.cs
示例13: KeyMenuItem
public KeyMenuItem(Theme theme, TextFormat font, float x, float y, float width, float height, Menu parentMenu, string text, string extraData, Keys key)
: base(theme, font, x, y, width, height, parentMenu, text, extraData)
{
this.Key = key;
this.acceptKey = false;
if (Program.GameImplementation.HasKey(this.ExtraData))
this.Key = Program.GameImplementation.GetValue<Keys>(this.ExtraData);
}
开发者ID:nkarpey,项目名称:Zat-s-External-CSGO-Multihack,代码行数:8,代码来源:KeyMenuItem.cs
示例14: TrackbarMenuItem
public TrackbarMenuItem(Theme theme, TextFormat font, float x, float y, float width, float height, Menu parentMenu, string text, float min, float max, float step, float value, string extraData)
: base(theme, font, x, y, width, height, parentMenu, text, extraData)
{
this.minimum = min;
this.maximum = max;
this.value = value;
this.step = step;
if (Program.GameImplementation.HasKey(this.ExtraData))
this.value = Program.GameImplementation.GetValue<float>(this.ExtraData);
}
开发者ID:nkarpey,项目名称:Zat-s-External-CSGO-Multihack,代码行数:10,代码来源:TrackbarMenuItem.cs
示例15: EngineInfoDrawer
public EngineInfoDrawer(RenderTarget renderTarget)
{
var factory = new DW.Factory(DW.FactoryType.Shared);
defaultBrush = new SolidColorBrush(renderTarget, Color.Black);
defaultTextFormat = new TextFormat(factory, "Microsoft Yahei Mono", FONT_SIZE);
defaultRectangleFList = new RectangleF[MAX_ROW_COUNT];
for (int i = 0; i < MAX_ROW_COUNT; i++) {
defaultRectangleFList[i] = new RectangleF(0, i * FONT_SIZE, ROW_WEIGHT, FONT_SIZE);
}
}
开发者ID:fcym97,项目名称:FadeGE,代码行数:10,代码来源:EngineInfoDrawer.cs
示例16: Initialize
protected override void Initialize(DemoConfiguration demoConfiguration)
{
base.Initialize(demoConfiguration);
// Initialize a TextFormat
TextFormat = new TextFormat(FactoryDWrite, "Gabriola", 96) { TextAlignment = TextAlignment.Center, ParagraphAlignment = ParagraphAlignment.Center };
RenderTarget2D.TextAntialiasMode = TextAntialiasMode.Cleartype;
ClientRectangle = new RectangleF(0, 0, demoConfiguration.Width, demoConfiguration.Height);
SceneColorBrush.Color = Color.Black;
}
开发者ID:MaybeMars,项目名称:SharpDX-Samples,代码行数:13,代码来源:Program.cs
示例17: Menu
public Menu(Theme theme, Theme themeSelected, Theme themeUnselected, TextFormat font, TextFormat fontCaption, float x, float y, float width, float height, string caption, float paddingX, float paddingY, float spacingY, bool fixedPosition)
: base(theme, font, x, y, width, height, paddingX, paddingY, spacingY)
{
//themeUnselected = new Theme(Theme.ForeColor * 0.9f, Theme.BackColor * 0.9f, Theme.ForeColor * 0.9f, Color.Transparent, 0f, 0f);
//themeSelected = new Theme(Theme.ForeColor * 1.1f, Theme.BackColor * 1.1f, Theme.ForeColor * 1.1f, Color.Transparent, 0f, 0f);
this.themeSelected = themeSelected;
this.themeUnselected = themeUnselected;
this.fontCaption = fontCaption;
lblCaption = new Label(theme, fontCaption, 0, 0, width, 20f, caption);
this.menuItemIndex = 1;
this.AddChildControl(lblCaption);
this.fixedPosition = fixedPosition;
}
开发者ID:nkarpey,项目名称:Zat-s-External-CSGO-Multihack,代码行数:13,代码来源:Menu.cs
示例18: Control
public Control(Theme theme, TextFormat font, float x, float y, float width, float height, bool visible, bool enabled)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.theme = theme;
this.font = font;
this.childControls = new List<Control>();
this.Parent = null;
this.visible = visible;
this.enabled = enabled;
this.autoSize = true;
}
开发者ID:nkarpey,项目名称:Zat-s-External-CSGO-Multihack,代码行数:14,代码来源:Control.cs
示例19: ValueMenuItem
public ValueMenuItem(Theme theme, TextFormat font, float x, float y, float width, float height, Menu parentMenu, string text, string extraData, object[] options, int selectedOption)
: base(theme, font, x, y, width, height, parentMenu, text, extraData)
{
this.options = options;
if (Program.GameImplementation.HasKey(this.ExtraData))
{
for (int i = 0; i < this.Options.Length; i++)
if (this.options[i] == Program.GameImplementation.GetValue(this.ExtraData))
this.CurrentOptionIndex = i;
}
else
{
this.CurrentOptionIndex = selectedOption;
}
}
开发者ID:nkarpey,项目名称:Zat-s-External-CSGO-Multihack,代码行数:15,代码来源:ValueMenuItem.cs
示例20: Direct2D1FormattedText
public Direct2D1FormattedText(string text, Typeface typeface, double fontSize)
{
Factory factory = ((Direct2D1PlatformInterface)PlatformInterface.Instance).DirectWriteFactory;
TextFormat format = new TextFormat(
factory,
typeface.FontFamily.Source,
(float)fontSize);
this.DirectWriteTextLayout = new TextLayout(
factory,
text ?? string.Empty,
format,
float.MaxValue,
float.MaxValue);
}
开发者ID:modulexcite,项目名称:Avalonia,代码行数:16,代码来源:Direct2D1FormattedText.cs
注:本文中的SharpDX.DirectWrite.TextFormat类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论