本文整理汇总了C#中IPoint.ToPointF方法的典型用法代码示例。如果您正苦于以下问题:C# IPoint.ToPointF方法的具体用法?C# IPoint.ToPointF怎么用?C# IPoint.ToPointF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPoint
的用法示例。
在下文中一共展示了IPoint.ToPointF方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawPoint
private void DrawPoint(IPoint point, Image image)
{
var g = Renderer.Graphics;
var winPoint = point.ToWinPoint();
var width = (float)Evaluate(_scaleXEvaluator, _scaleX);
var height = (float)Evaluate(_scaleYEvaluator, _scaleY);
var alignment = Evaluate(_alignEvaluator, _alignment);
winPoint.Y += GetVerticalAlignentOffset(alignment, height);
winPoint.X += GetHorizontalAligmentOffset(alignment, width);
if (image == null)
{
var pScreenF = Renderer.Transform(winPoint).ToPointF();
var color = GetRenderColor(_opacityEvaluator, _opacity, _colorEvaluator, _color);
using (var brush = new SolidBrush(color))
g.FillEllipse(brush, pScreenF.X - width / 2, pScreenF.Y - height / 2, width, height);
}
else
{
float scaleX = _marker.ScaleX != null ? float.Parse(_marker.ScaleX, System.Globalization.NumberFormatInfo.InvariantInfo) : 1;
float scaleY = _marker.ScaleY != null ? float.Parse(_marker.ScaleY, System.Globalization.NumberFormatInfo.InvariantInfo) : 1;
float angle = _marker.Angle != null ? float.Parse(_marker.Angle, System.Globalization.NumberFormatInfo.InvariantInfo) : 0;
float opacity = _marker.Opacity != null ? float.Parse(_marker.Opacity, System.Globalization.NumberFormatInfo.InvariantInfo) : 1;
float[][] matrixAlpha =
{
new float[] {1, 0, 0, 0, 0},
new float[] {0, 1, 0, 0, 0},
new float[] {0, 0, 1, 0, 0},
new float[] {0, 0, 0, opacity, 0},
new float[] {0, 0, 0, 0, 1}
};
ColorMatrix colorMatrix = new ColorMatrix(matrixAlpha);
ImageAttributes imageAttributes = new ImageAttributes();
imageAttributes.SetColorMatrix(
colorMatrix,
ColorMatrixFlag.Default,
ColorAdjustType.Bitmap);
var dest = new Rectangle((int)(point.X), (int)(point.Y), 10, 10);
var src = new Rectangle(0, 0, image.Width, image.Height);
//_g.DrawImage(image, dest, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imageAttributes, null, IntPtr.Zero);
var oldMatrix = (Matrix)g.Transform.Clone();
using (var m = new Matrix())
{
m.Scale(scaleX, scaleY);
//m.Rotate(angle);
//m.Translate(offsetX, offsetY);
//_g.MultiplyTransform(m, MatrixOrder.Append);
using (var f = new Font("Sppc", 10))
g.DrawString("B", f, Brushes.Red, point.ToPointF());
using (var pen = new Pen(Color.Black, 0.1f))
g.DrawLine(pen, (float)point.X, (float)point.Y, (float)point.X + 10, (float)point.Y);
g.Transform = oldMatrix;
}
}
}