本文整理汇总了C#中Point2D.P方法的典型用法代码示例。如果您正苦于以下问题:C# Point2D.P方法的具体用法?C# Point2D.P怎么用?C# Point2D.P使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2D
的用法示例。
在下文中一共展示了Point2D.P方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawScreen
private void DrawScreen(System.Drawing.Graphics gfx)
{
// to prevent unecessary drawing
if (pts_.Count == 0)
return;
// pens used for drawing elements of the display
System.Drawing.Pen polyPen = new Pen(Color.Blue, 1.0f);
System.Drawing.Pen shellPen = new Pen(Color.Red, 0.5f);
System.Drawing.Pen splinePen = new Pen(Color.Black, 1.5f);
if (Menu_Shell.Checked && Menu_Shell.Enabled)
{
// draw the shell
DrawShell(gfx, shellPen, pts_, tVal_);
}
if (Menu_Polyline.Checked && Menu_Polyline.Enabled)
{
DrawPolyline(gfx, polyPen, pts_);
}
if (Menu_Points.Checked && Menu_Points.Enabled)
{
DrawPoints(gfx, polyPen, pts_);
}
if(assignment_ == 0)
{
return;
}
///////////////////////////////////////////////////////////////////////////////
// Drawing code for algorithms goes in here //
///////////////////////////////////////////////////////////////////////////////
// you can change these variables at will; i have just chosen there
// to be six sample points for every point placed on the screen
float steps = pts_.Count * 6;
float alpha = 1 / steps;
//HUD drawing code
Font arial = new Font("Arial", 12);
int widthoffset, heightoffset;
//bool somethingselected = true;
//String DrawLabel;
widthoffset = 10;
heightoffset = 30;
gfx.DrawString("Assignment " + assignment_.ToString() + ": " + method_.ToString(), arial, Brushes.Black, widthoffset, heightoffset);
heightoffset += arial.Height;
/*
if (assignment_ == 1)
{
//Draws the mouse projected onto our curve
gfx.DrawString("Mouse(" + ProjectedMouse_.x.ToString() + ", " + ProjectedMouse_.y.ToString() + ") ", arial, Brushes.Black, widthoffset, heightoffset);
gfx.DrawEllipse(splinePen, ProjectedMouse_.P().X - 2.0f, ProjectedMouse_.P().Y - 2.0f, 4.0f, 4.0f);
heightoffset += arial.Height;
}
*/
if (assignment_ == 1 || assignment_ == 7)
{
gfx.DrawString("Coefficients :" + pts_.Count.ToString(), arial, Brushes.Black, widthoffset, heightoffset);
widthoffset += 150;
}
else
{
gfx.DrawString("points: " + pts_.Count.ToString(), arial, Brushes.Black, widthoffset, heightoffset);
widthoffset += 100;
}
if (pts_.Count > 0)
{
gfx.DrawString("t-value: " + tVal_.ToString("F"), arial, Brushes.Black, widthoffset, heightoffset);
widthoffset += 150;
gfx.DrawString("t-step: " + alpha.ToString("F6"), arial, Brushes.Black, widthoffset, heightoffset);
}
widthoffset = 10;
heightoffset += arial.Height;
if (assignment_ == 1 || assignment_ == 7)
{
for (int i = 0; i < pts_.Count; ++i)
{
gfx.DrawString("A" + i.ToString() + ": " + pts_[i].y.ToString(), arial, Brushes.Black, widthoffset, heightoffset + i * arial.Height);
}
}
else
{
for (int i = 0; i < pts_.Count; ++i)
{
gfx.DrawString("points" + i.ToString() + ": " + pts_[i].ToString(), arial, Brushes.Black, widthoffset, heightoffset + i * arial.Height);
}
}
//.........这里部分代码省略.........
示例2: DrawPoint
private void DrawPoint(System.Drawing.Graphics gfx, System.Drawing.Pen pen, Point2D pt)
{
gfx.DrawEllipse(pen, pt.P().X - 2.0f, pt.P().Y - 2.0f, 4.0f, 4.0f);
}