本文整理汇总了C#中System.Drawing.Font.GetFontBitmap方法的典型用法代码示例。如果您正苦于以下问题:C# Font.GetFontBitmap方法的具体用法?C# Font.GetFontBitmap怎么用?C# Font.GetFontBitmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Font
的用法示例。
在下文中一共展示了Font.GetFontBitmap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UIColorPaletteRenderer
/// <summary>
/// </summary>
/// <param name="anchor"></param>
/// <param name="margin"></param>
/// <param name="size"></param>
/// <param name="zNear"></param>
/// <param name="zFar"></param>
public UIColorPaletteRenderer(int maxMarkerCount,
CodedColor[] codedColors,
System.Windows.Forms.AnchorStyles anchor, System.Windows.Forms.Padding margin,
System.Drawing.Size size, int zNear, int zFar)
: base(anchor, margin, size, zNear, zFar)
{
this.maxMarkerCount = maxMarkerCount;
this.currentMarkersCount = maxMarkerCount;
//// display this UI control's area.
//this.StateList.Add(new ClearColorState());
// color bar using texture.
{
var bar = new UIColorPaletteBarRenderer(
codedColors,
System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right,
new System.Windows.Forms.Padding(marginLeft, 1, marginRight, 0),
new System.Drawing.Size(size.Width - marginLeft - marginRight, size.Height / 3),
zNear, zFar);
//this.StateList.Add(new ClearColorState(Color.Blue));
this.Children.Add(bar);
this.colorPaletteBar = bar;
}
// color bar using vec3 color(hidden as default state)
// just to compare with color bar using texture.
{
var bar = new UIColorPaletteColoredBarRenderer(
maxMarkerCount, codedColors,
System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right,
new System.Windows.Forms.Padding(marginLeft, 1 + size.Height / 3, marginRight, 0),
new System.Drawing.Size(size.Width - marginLeft - marginRight, size.Height / 3),
zNear, zFar);
//this.StateList.Add(new ClearColorState(Color.Blue));
this.Children.Add(bar);
this.colorPaletteBar2 = bar;
bar.Enabled = false;
}
// white vertical lines.
{
var markers = new UIColorPaletteMarkersRenderer(maxMarkerCount,
System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right,
new System.Windows.Forms.Padding(marginLeft, 1, marginRight, 0),
new System.Drawing.Size(size.Width - marginLeft - marginRight, size.Height / 2),
zNear, zFar);
//markers.StateList.Add(new ClearColorState(Color.Red));
this.Children.Add(markers);
this.markers = markers;
}
// labels that display values(float values)
{
int length = maxMarkerCount;
var font = new Font("Arial", 32);
for (int i = 0; i < length; i++)
{
const int width = 100;
float distance = marginLeft;
distance += 2.0f * (float)i / (float)length * (float)(this.Size.Width - marginLeft - marginRight);
distance -= width / 2;
var label = new UIText(
System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Bottom,
new System.Windows.Forms.Padding((int)distance, 0, 0, 0),
new System.Drawing.Size(width, size.Height / 2), zNear, zFar,
font.GetFontBitmap("0123456789.eE+-").GetFontTexture(), 100);
label.Initialize();
//label.StateList.Add(new ClearColorState(Color.Green));
label.Text = ((float)i).ToShortString();
label.BeforeLayout += label_beforeLayout;
this.Children.Add(label);
this.labelList.Add(label);
}
this.currentMarkersCount = 2;
}
}
示例2: Form_Load
private void Form_Load(object sender, EventArgs e)
{
foreach (var item in Enum.GetValues(typeof(PickingGeometryType)))
{
this.cmbPickingGeometryType.Items.Add(item);
}
this.cmbPickingGeometryType.SelectedIndex = 1;
{
var frmBulletinBoard = new FormBulletinBoard();
//frmBulletinBoard.Dump = true;
frmBulletinBoard.Show();
this.bulletinBoard = frmBulletinBoard;
}
{
//this.glCanvas1.ShowSystemCursor = false;
}
{
// default(perspective)
var camera = new Camera(
new vec3(15, 5, 0), new vec3(0, 0, 0), new vec3(0, 1, 0),
CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
var rotator = new FirstPerspectiveManipulater();
rotator.StepLength = 0.5f;
rotator.Bind(camera, this.glCanvas1);
var scene = new Scene(camera, this.glCanvas1);
//scene.Cursor.Enabled = false;
this.scene = scene;
ViewPort rootViewPort = scene.RootViewPort;
rootViewPort.ClearColor = Color.White;
ViewPort viewPort = rootViewPort.Children[0];
viewPort.ClearColor = Color.Gray;
viewPort.BeforeLayout += viewPort_BeforeLayout;
viewPort.AfterLayout += perspectiveViewPort_AfterLayout;
this.glCanvas1.Resize += scene.Resize;
}
{
// top
var camera = new Camera(
new vec3(0, 0, 25), new vec3(0, 0, 0), new vec3(0, 1, 0),
CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
ViewPort viewPort = new ViewPort(camera, AnchorStyles.None, new Padding(), new Size());
viewPort.ClearColor = Color.Gray;
viewPort.BeforeLayout += viewPort_BeforeLayout;
viewPort.AfterLayout += topViewPort_AfterLayout;
this.scene.RootViewPort.Children.Add(viewPort);
}
{
// front
var camera = new Camera(
new vec3(0, 25, 0), new vec3(0, 0, 0), new vec3(0, 0, -1),
CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
ViewPort viewPort = new ViewPort(camera, AnchorStyles.None, new Padding(), new Size());
viewPort.ClearColor = Color.Gray;
viewPort.BeforeLayout += viewPort_BeforeLayout;
viewPort.AfterLayout += frontViewPort_AfterLayout;
this.scene.RootViewPort.Children.Add(viewPort);
}
{
// left
var camera = new Camera(
new vec3(-25, 0, 0), new vec3(0, 0, 0), new vec3(0, 0, -1),
CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
ViewPort viewPort = new ViewPort(camera, AnchorStyles.None, new Padding(), new Size());
viewPort.ClearColor = Color.Gray;
viewPort.BeforeLayout += viewPort_BeforeLayout;
viewPort.AfterLayout += leftViewPort_AfterLayout;
this.scene.RootViewPort.Children.Add(viewPort);
}
{
var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom,
new Padding(3, 3, 3, 3), new Size(128, 128));
uiAxis.Initialize();
this.scene.RootUI.Children.Add(uiAxis);
}
{
var font = new Font("Courier New", 32);
var uiText = new UIText(AnchorStyles.Left | AnchorStyles.Bottom,
new Padding(0, 0, 0, 0), new Size(250, 20), -100, 100,
font.GetFontBitmap("[index: 0123456789]").GetFontTexture());
uiText.Text = "";
this.uiText = uiText;
this.scene.RootUI.Children.Add(uiText);
}
{
GroundRenderer ground = GroundRenderer.Create(new GroundModel(20));
ground.Initialize();
ground.Scale = new vec3(20, 20, 20);
ground.WorldPosition = new vec3(0, 0, 0);
SceneObject obj = ground.WrapToSceneObject(name: "Ground", generateBoundingBox: true);
this.scene.RootObject.Children.Add(obj);
}
{
bool useHighlightedPickingEffect = false;
if (MessageBox.Show("Use highlighted picking effect?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
useHighlightedPickingEffect = true;
}
List<PickableRenderer> list = GetPickableRenderers();
const float distance = 10;
//.........这里部分代码省略.........