本文整理汇总了C#中System.Drawing.Graphics.ResetTransform方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.ResetTransform方法的具体用法?C# Graphics.ResetTransform怎么用?C# Graphics.ResetTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.ResetTransform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderSymbols
private void RenderSymbols( Graphics g )
{
float radius = _textureSize / 2 * 0.84f;
float centerX = _textureSize / 2;
float centerY = _textureSize / 2;
var symbols = GetSymbols();
using ( var font = new Font( "Meroitic - Hieroglyphics", _fontSize, FontStyle.Bold ) )
{
for ( int index = 0; index < _symbolCount; index++ )
{
char character = symbols[index];
float arc = 360f / _symbolCount;
float thetaDegrees = arc * index;
float thetaRadians = AsRadians( thetaDegrees );
var characterSize = MeasureCharacter( g, font, character );
var centerPoint = new PointF( centerX - characterSize.Width / 2, centerY - characterSize.Height / 2 );
float x = centerX + (float) Math.Cos( thetaRadians ) * radius;
float y = centerY + (float) Math.Sin( thetaRadians ) * radius;
g.TranslateTransform( x, y );
g.RotateTransform( thetaDegrees + 90 );
g.TranslateTransform( -x, -y );
g.TranslateTransform( -( characterSize.Width / 2 ), -( characterSize.Height / 2 ) );
g.DrawString( character.ToString(), font, _greenBrush, x, y );
g.ResetTransform();
}
}
}
示例2: OnRender
public override void OnRender(Graphics g)
{
#if !PocketPC
if(!Bearing.HasValue)
{
g.DrawImageUnscaled(Resources.shadow50, LocalPosition.X, LocalPosition.Y);
}
g.TranslateTransform(ToolTipPosition.X, ToolTipPosition.Y);
if(Bearing.HasValue)
{
g.RotateTransform(Bearing.Value - Overlay.Control.Bearing);
g.FillPolygon(Brushes.Lime, Arrow);
}
g.ResetTransform();
if(!Bearing.HasValue)
{
g.DrawImageUnscaled(Resources.bigMarkerGreen, LocalPosition.X, LocalPosition.Y);
}
#else
DrawImageUnscaled(g, Resources.shadow50, LocalPosition.X, LocalPosition.Y);
DrawImageUnscaled(g, Resources.marker, LocalPosition.X, LocalPosition.Y);
#endif
}
示例3: Draw
public void Draw(Graphics g, Player player)
{
if (ShootingPoints.Count > 0)
{
try
{
g.DrawCurve(shootingPen, ShootingPoints.ToArray());
g.TranslateTransform(1, 0);
g.DrawCurve(shootingPen1, ShootingPoints.ToArray());
g.ResetTransform();
}
catch (Exception e)
{
Console.WriteLine("Shot.cs-Draw-EXCEPTION : {0}", e.Message);
}
//STRELKA
Point lastOne = (Point)ShootingPoints[ShootingPoints.Count-1];
trianglePoints = new Point[3];
trianglePoints[0] = new Point(lastOne.X - 2, lastOne.Y - 10);
trianglePoints[1] = new Point(lastOne.X - 8, lastOne.Y + 2);
trianglePoints[2] = new Point(lastOne.X + 4, lastOne.Y + 2);
g.FillPolygon(new SolidBrush(Color.Black), trianglePoints);
trianglePoints = new Point[3];
}
}
示例4: ShowEditor
/// <summary>
/// Here we will show editor
/// </summary>
public void ShowEditor(Graphics gc, Rectangle clipRect)
{
gc.ResetTransform();
gc.FillRectangle(Brushes.LightGray, clipRect);
// draw Report
//project.PrepareDraw(0, 0, 0, 0, 0, gc, clipRect);
System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix();
project.CurrentReportPage.Viewer.UpdateValues(clipRect);
project.CurrentReportPage.MakeViewMatrix(clipRect);
project.CurrentReportPage.MakeDrawMatrix(mat);
project.CurrentReportPage.Draw(gc, clipRect);
// draw commands
// draw page boundries
/*gc.DrawLine(Pens.Black, 100, 100, clipRect.Width - 100, 100);
gc.DrawLine(Pens.Black, 100, 100, 100, clipRect.Height-100);
gc.DrawLine(Pens.Black, 100, clipRect.Height-100, clipRect.Width - 100, clipRect.Height-100);
gc.DrawLine(Pens.Black, clipRect.Width-100, 100, clipRect.Width - 100, clipRect.Height-100);*/
// draw items on page
// draw gray mask
//gc.FillRectangle(Brushes.LightGray, 0, 0, 99, clipRect.Height);
//gc.FillRectangle(Brushes.LightGray, 0, 0, clipRect.Width, 99);
//gc.FillRectangle(Brushes.LightGray, clipRect.Width-99, 0, clipRect.Width, clipRect.Height);
//gc.FillRectangle(Brushes.LightGray, 0, clipRect.Height-99, clipRect.Width, clipRect.Height);
}
示例5: onManagedDraw
public override void onManagedDraw(Graphics graphics)
{
graphics.TranslateTransform (this.CenterX, this.CenterY);
graphics.RotateTransform (90 + this.Angle / (float)Math.PI * 180);
graphics.TranslateTransform (-this.CenterX, -this.CenterY);
base.onManagedDraw (graphics);
graphics.ResetTransform ();
}
示例6: Draw
public override void Draw(Graphics gr)
{
gr.TranslateTransform(location.X, location.Y);
gr.DrawPath(pen, path);
if (!string.IsNullOrEmpty(text))
gr.DrawString(text, SystemFonts.DefaultFont, Brushes.Black, textRect, StringFormat.GenericDefault);
gr.ResetTransform();
}
示例7: Draw
public void Draw(Graphics g)
{
g.ResetTransform();
var rnd = new Random();
g.TranslateTransform((float)rnd.NextDouble() * g.VisibleClipBounds.Width, (float)rnd.NextDouble() * g.VisibleClipBounds.Height / 2f);
g.DrawString(text, new Font("Comic Sans", 14), new SolidBrush(Color.Black), 0,0);
}
示例8: Draw
public override void Draw(Graphics gfx, Point offset)
{
gfx.TranslateTransform(offset.X, offset.Y);
if (Points.Count > 1)
gfx.DrawCurve(pen, Points.ToArray());
gfx.ResetTransform();
}
示例9: Draw
public override void Draw(Graphics g, GraphPane pane)
{
SizeF size;
PointF pos;
float x, y1, y2, y3;
string label;
//Draw Axis Title
if (mTitle.Visible) {
using (Brush brush = new SolidBrush(mTitle.Color)) {
if (mTitle.Orientation == Orientation.Vertical) {
g.RotateTransform(-90);
g.TranslateTransform(-mPane.ClientRectangle.Height, 0);
size = g.MeasureString(mTitle.Text, mTitle.Font);
pos = new PointF(mTitle.Padding, mRect.Left + mRect.Width / 2 - size.Height / 2);
g.DrawString(mTitle.Text, mTitle.Font, brush, pos);
g.ResetTransform();
} else {
size = g.MeasureString(mTitle.Text, mTitle.Font);
pos = new PointF(mRect.Left + (mRect.Width / 2 - size.Width / 2), mRect.Top + mTitle.Padding);
if (mLabels.Visible) pos.Y += (mLabels.Font.Height + (mLabels.Padding * 2));
g.DrawString(mTitle.Text, mTitle.Font, brush, pos);
}
}
}
//Draw Minor Gridlines and Marks
y1 = mRect.Top - mMinorMark.Size;
y2 = mRect.Top;
for (double dx = Minimum; dx <= Maximum; dx += mMinorStep) {
x = mRect.X + (float)((dx - mMinimum) * mScale);
if (mMinorMark.Visible) g.DrawLine(mMinorMark.Pen, x, y1, x, y2);
}
//Draw Major Gridlines, Marks and Labels
y1 = mRect.Top - mMajorMark.Size;
y2 = mRect.Top;
y3 = y2 + mLabels.Padding;
using (Brush b = new SolidBrush(mLabels.Color)) {
for (double dx = Minimum; dx <= Maximum; dx += mMajorStep) {
x = mRect.X + (float)((dx - mMinimum) * mScale);
if (mMajorMark.Visible) g.DrawLine(mMajorMark.Pen, x, y1, x, y2);
if (mLabels.Visible) {
label = FormatLabel(dx);
size = g.MeasureString(label, mLabels.Font);
x = x - size.Width / 2;
if (mPane.ClientRectangle.Contains(x, y3) && mPane.ClientRectangle.Contains(x + size.Width, y3 + size.Height))
g.DrawString(label, mLabels.Font, b, x, y3);
}
}
}
//Draw The Axis
g.DrawLine(mPen, mRect.Left, mRect.Top, mRect.Right, mRect.Top);
}
示例10: Draw
public override void Draw(Graphics g, List<Matrix> listMatrix)
{
//单位一定要是MM。
g.PageUnit = GraphicsUnit.Millimeter;
//定义画笔
Pen _myPen = new Pen(PenColor, _penWidth);
_myPen.DashStyle = PenDashStyle;
GraphicsPath path = base.getGraphicsPath();//首先取得没有偏移但有旋转的路径
//再反转这个个变换
listMatrix.Reverse();
if ((listMatrix != null) && (listMatrix.Count > 0))//只有数量大于0才能做如下的
{
for (int i = 0; i < listMatrix.Count; i++)
{
path.Transform((Matrix)listMatrix[i]);
}
}
//如下这个就是画边界
try
{
g.DrawPath(_myPen, path);
}
catch (Exception ex)
{
////ClsErrorFile.WriteLine(ex);
//throw;
}
//throw new NotImplementedException();
if (_isFill)
{
try
{
g.FillPath(new SolidBrush(_FillColor), path);
}
catch (Exception ex)
{
////ClsErrorFile.WriteLine(ex);
//throw;
}
}
g.ResetTransform();
//base.Draw(g, arrlistMatrix);
}
示例11: DrawRectangleRotated
public static void DrawRectangleRotated(Graphics g, Rectangle r, float angle, Pen pen)
{
using (Matrix m = new Matrix())
{
m.RotateAt(angle, new PointF(r.Left + (r.Width / 2), r.Top + (r.Height / 2)));
g.Transform = m;
g.DrawRectangle(pen, r);
g.ResetTransform();
}
}
示例12: Draw
public override void Draw(Graphics gr, Point position, Range range)
{
foreach (Place p in range)
{
int time = (int)(DateTime.Now.TimeOfDay.TotalMilliseconds/2);
int angle = (int)(time % 360L);
int angle2 = (int)((time - (p.iChar - range.Start.iChar)*20) % 360L)*2;
int x = position.X + (p.iChar - range.Start.iChar) * range.tb.CharWidth;
Range r = range.tb.GetRange(p, new Place(p.iChar+1, p.iLine));
Point point = new Point(x, position.Y + (int)(5 + 5 * Math.Sin(Math.PI * angle2 / 180)));
gr.ResetTransform();
gr.TranslateTransform(point.X + range.tb.CharWidth / 2, point.Y +range.tb.CharHeight / 2);
gr.RotateTransform(angle);
gr.ScaleTransform(0.8f, 0.8f);
gr.TranslateTransform(- range.tb.CharWidth / 2, -range.tb.CharHeight / 2);
base.Draw(gr, new Point(0, 0), r);
}
gr.ResetTransform();
}
示例13: Draw
public override void Draw(Graphics g, GraphPane pane)
{
SizeF size;
PointF pos;
float y, x1, x2, x3;
string label;
//Draw Axis Title
if (mTitle.Visible) {
using (Brush b = new SolidBrush(mTitle.Color)) {
if (mTitle.Orientation == Orientation.Vertical) {
g.RotateTransform(-90);
g.TranslateTransform(-mRect.Height, 0);
size = g.MeasureString(mTitle.Text, mTitle.Font);
pos = new PointF(mRect.Height / 2 - size.Width / 2, mRect.Left + mTitle.Padding);
g.DrawString(mTitle.Text, mTitle.Font, b, pos);
g.ResetTransform();
} else {
size = g.MeasureString(mTitle.Text, mTitle.Font);
pos = new PointF(mRect.Left + mTitle.Padding, mRect.Height / 2 - size.Width / 2);
g.DrawString(mTitle.Text, mTitle.Font, b, pos);
}
}
}
//Draw Minor Grid and Mark
x1 = mRect.Right + mMinorMark.Size;
x2 = x1 - mMinorMark.Size;
for (double dy = Minimum; dy < Maximum; dy += mMinorStep) {
y = mRect.Bottom - (float)((dy - mMinimum) * mScale);
if (mMinorMark.Visible) g.DrawLine(mMinorMark.Pen, x1, y, x2, y);
}
//Draw Major Gridlines, Marks and Labels
x1 = mRect.Right + mMajorMark.Size;
x2 = x1 - mMajorMark.Size;
using (Brush b = new SolidBrush(mLabels.Color)) {
for (double dy = Minimum; dy <= Maximum; dy += mMajorStep) {
y = mRect.Bottom - (float)((dy - mMinimum) * mScale);
if (mMajorMark.Visible) g.DrawLine(mMajorMark.Pen, x1, y, x2, y);
if (mLabels.Visible) {
label = dy.ToString(mLabels.Format);
size = g.MeasureString(label, mLabels.Font);
y = y - size.Height / 2;
x3 = x2 - (size.Width + mLabels.Padding);
if (mPane.ClientRectangle.Contains(x3, y) && mPane.ClientRectangle.Contains(x3, y + size.Height))
g.DrawString(label, mLabels.Font, b, x3, y);
}
}
}
//Draw The Axis
g.DrawLine(mPen, mRect.Right, mRect.Top, mRect.Right, mRect.Bottom);
}
示例14: Draw
public virtual void Draw(Graphics g, Tank t)
{
// TODO: Fill here
Rectangle rect = new Rectangle((int)pos.X - width / 2, (int)pos.Y - height / 2, width, height);
Matrix m = new Matrix();
m.RotateAt((float)orientation, pos);
g.FillRectangle(new SolidBrush(color), rect);
g.ResetTransform();
}
示例15: RotateRect
public static void RotateRect(Graphics g, Rectangle r, float angle, Color color)
{
using (Matrix m = new Matrix())
{
m.RotateAt(angle, new PointF(r.Left + (r.Width / 2), r.Top + (r.Height / 2)));
g.Transform = m;
SolidBrush br = new SolidBrush(color);
g.FillRectangle(br, r);
g.ResetTransform();
}
}