本文整理汇总了C#中System.Drawing.PointD类的典型用法代码示例。如果您正苦于以下问题:C# PointD类的具体用法?C# PointD怎么用?C# PointD使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PointD类属于System.Drawing命名空间,在下文中一共展示了PointD类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawRegionRepresentation
public override void DrawRegionRepresentation(Graphics gc, Render.RenderParameter r, Render.IDrawVisitor drawMethods, PointD mousePosition)
{
if (m_Param.Path.PointCount > 0)
{
GraphicsPath fill = new GraphicsPath();
RectangleF rect = m_Param.Path.GetBounds();
PointD refPt = (PointD)rect.Location + ((PointD)rect.Size.ToPointF()) / 2;
// this will draw beyond the shape's location
for (double i = -rect.Height; i < rect.Height; i++)
{
PointD pt1 = refPt + PointD.Orthogonal(m_Param.V) * i * drawMethods.Spacing(m_Param.C);
PointD pt2 = pt1 + m_Param.V * rect.Width * rect.Height;
PointD pt3 = pt1 - m_Param.V * rect.Width * rect.Height;
fill.StartFigure();
fill.AddLine((Point)pt2, (Point)pt3);
}
GraphicsContainer c = gc.BeginContainer();
gc.SetClip((Tools.Model.VectorPath)m_Param.Path);
gc.DrawPath(r.RegionGuides, fill);
gc.EndContainer(c);
}
}
示例2: ActivateScript
public override string ActivateScript(CandleChartControl chart, PointD worldCoords)
{
this.chart = chart;
scriptActivatedCoords = worldCoords;
// найти робота / роботов на данный тикер / ТФ
var robots = MainForm.Instance.RobotFarm.GetRobotCopies();
robots = robots.Where(r => r.Graphics.Any(g => g.a == chart.chart.Symbol && g.b == chart.chart.Timeframe))
.ToList();
if (robots.Count == 0) return "Нет роботов для " + chart.Symbol + ":" + chart.Timeframe;
selectedBot = robots[0];
// если роботов несколько - предложить пользователю выбрать интересующего
if (robots.Count > 1)
{
object selectedRobot;
string inputText;
if (!Dialogs.ShowComboDialog("Укажите робота",
robots.Cast<object>().ToList(), out selectedRobot,
out inputText))
return "робот не выбран из списка";
selectedBot = (BaseRobot) selectedRobot;
}
ShowRobotDataOnChart();
return "";
}
示例3: CandleData
private string CandleData(PointD chartPoint, out int trend)
{
trend = 0;
int index = (int)(chartPoint.X + 0.5);
if (index < 0 || index >= Owner.Owner.StockSeries.Data.Count)
return "";
float open = Owner.Owner.StockSeries.Data[index].open;
float close = Owner.Owner.StockSeries.Data[index].close;
if (chartPoint.Y > Math.Max(open, close) || chartPoint.Y < Math.Min(open, close))
return "";
float high = Owner.Owner.StockSeries.Data[index].high;
float low = Owner.Owner.StockSeries.Data[index].low;
DateTime date = Owner.Owner.StockSeries.Data[index].timeOpen;
trend = open < close ? 1 : -1;
string dateStr = date.ToString("dd.MM.yyyy HH:mm");
var sb = new StringBuilder();
sb.AppendLine(string.Format("O: {0}", open.ToStringUniformPriceFormat(true)));
sb.AppendLine(string.Format("H: {0}", high.ToStringUniformPriceFormat(true)));
sb.AppendLine(string.Format("L: {0}", low.ToStringUniformPriceFormat(true)));
sb.AppendLine(string.Format("C: {0}", close.ToStringUniformPriceFormat(true)));
sb.AppendLine(dateStr);
return sb.ToString();
}
示例4: ActivateScript
public override string ActivateScript(CandleChartControl chart, PointD worldCoords)
{
var dlg = new OpenFileDialog
{
Filter = "*.csv|*.csv|*.*|*.*",
FilterIndex = 0,
DefaultExt = "csv",
Title = "Открыть файл сделок"
};
if (dlg.ShowDialog() != DialogResult.OK) return "";
// прочитать ордера
var allOrders = ReadOrdersFromCsv(dlg.FileName);
var chartOrders = allOrders.Where(o => o.Symbol.Contains(chart.Symbol)).ToList();
if (chartOrders.Count == 0)
{
var msg = string.Format("{0} ордеров прочитано, ни один не относится к графику {1}",
allOrders.Count, chart.Symbol);
return msg;
}
if (allOrders.Count > 1000)
{
//var msg = string.Format("Прочитано {0} ордеров. Отобразить ордера на выбранном временном отрезке?",
// chartOrders.Count);
var ordersDlg = new Mt4ImportDlg(chartOrders);
if (ordersDlg.ShowDialog() == DialogResult.OK)
chartOrders = ordersDlg.selectedOrders;
}
ShowOrders(chartOrders, chart);
return string.Empty;
}
示例5: SunMoon_Type
public SunMoon_Type(string imagelocation,double initialangle)
: base(BITMAP.FromFile(imagelocation), default(Point), ImagePasteMode.Transparent, EffectDock.Screen)
{
REVOLVE_RADIUS = new PointD(Background.Size.Half());
REVOLVE_PERIOD = CONST.OneDay;
INITIAL_ANGLE = initialangle;
}
示例6: RectangleD
public RectangleD(PointD point, SizeD size)
{
_x = point.X;
_y = point.Y;
_width = size.Width;
_height = size.Height;
}
示例7: GetSpanLenInScreenCoords
internal static double GetSpanLenInScreenCoords(PointD worldPtA, PointD worldPtB,
RectangleD worldRect, RectangleD canvasRect)
{
var scrA = WorldToScreen(new PointD(worldPtA.X, worldPtA.Y), worldRect, canvasRect);
var scrB = WorldToScreen(new PointD(worldPtB.X, worldPtB.Y), worldRect, canvasRect);
return Math.Sqrt((scrA.X - scrB.X) * (scrA.X - scrB.X) +
(scrA.Y - scrB.Y) * (scrA.Y - scrB.Y));
}
示例8: MoveTo
/// <summary>
/// Moves shape to specified position (in world units) relative to the diagram.
/// </summary>
public static void MoveTo(this NodeShape shape, PointD position)
{
var newBounds = new RectangleD(PointD.Empty, shape.AbsoluteBounds.Size);
newBounds.X = position.X;
newBounds.Y = position.Y;
shape.AbsoluteBounds = newBounds;
}
示例9: GetREGION
protected override Rectangle GetREGION()
{
PointD pd1 = new PointD(0, Sky.MaxHeight);
PointD pd2 = new PointD(Block.Width, 0);
Point p1 = Background.WorldToClient(pd1);
Point p2 = Background.WorldToClient(pd2);
return p1.GetRectangle(p2);
}
示例10: HitTest
public override bool HitTest(PointD point)
{
if (m_Param.Path != m_path)
{
m_Param.Path = m_path;
}
return base.HitTest(point);
}
示例11: LevelImageFragment
public LevelImageFragment(byte[] yComponents, int imageWidth, int imageHeight, int xOffset, int yOffset, int width, int height)
{
Offset = new PointD((double)xOffset / imageWidth, (double)yOffset / imageHeight);
YComponents = new byte[width * height];
for (int i = 0; i < height; i++)
for (int j = 0; j < width; j++)
YComponents[i * width + j] = yComponents[(yOffset + i) * imageWidth + (xOffset + j)];
}
示例12: Draw_PANEL_Image
protected override void Draw_PANEL_Image(BitmapData data_bac)
{
base.Draw_PANEL_Image(data_bac);
PointD p = new PointD(225, 225);
Bitmap bmp; ProduceGearImage(out bmp);
data_bac.Paste(bmp, p - bmp.Half(), ImagePasteMode.Transparent);
bmp = ProducePercentImage();
data_bac.Paste(bmp, p - bmp.Half(), ImagePasteMode.Gradient);
}
示例13: Draw
public override void Draw(System.Drawing.Graphics gc, Render.RenderParameter r, Render.RenderHint editState, Render.IDrawVisitor drawMethods, PointD mousePosition)
{
if (m_Param.Path != null)
{
/*if (editState.GetAttributes() == States.StateAttributes.Start)
{
if (r.StrokeFill != null)
gc.FillPath(r.StrokeFill, (Tools.Model.VectorPath) m_Param.Path);
gc.DrawPath(r.StrokeOutline, (Tools.Model.VectorPath)m_Param.Path);
}
else*/ if (editState == Render.RenderHint.Start)
{
Pen dashPen = (Pen)r.StrokeOutline.Clone();
dashPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
if (m_Param.Path.PointCount > 0)
{
PointD firstPoint = (PointD)m_Param.Path.GetFirstPoint();
gc.DrawEllipse(dashPen, (float)firstPoint.X - Tools.Render.DrawHelper.TARGET_SIZE / 2.0f, (float)firstPoint.Y - Tools.Render.DrawHelper.TARGET_SIZE / 2.0f, (float)Tools.Render.DrawHelper.TARGET_SIZE, (float)Tools.Render.DrawHelper.TARGET_SIZE);
if (r.StrokeFill != null)
gc.FillPath(r.StrokeFill, (Tools.Model.VectorPath)m_Param.Path);
gc.DrawPath(r.StrokeOutline, (Tools.Model.VectorPath)m_Param.Path);
DrawRegionRepresentation(gc, r, drawMethods, mousePosition);
}
}
/*else if (editState.GetAttributes() == States.StateAttributes.Change)
{
drawMethods.DrawNegativeSpace(gc, m_Param, r);
drawMethods.DrawPositiveSpace(gc, m_Param, r);
if (editState is States.RegionChange)
{
DrawRegionRepresentation(gc, r, mousePosition);
((States.RegionChange)editState).Handles.DrawHandles(gc, m_Param, r);
}
}*/
else if (editState == Render.RenderHint.Feedback)
{
drawMethods.DrawNegativeSpace(gc, m_Param.Path.InternalPath, r);
drawMethods.DrawPositiveSpace(gc, m_Param.Path.InternalPath, r);
if (!(this is ConveyorBeltFilter))
DrawRegionRepresentation(gc, r,drawMethods, mousePosition);
}
else
{
drawMethods.DrawNegativeSpace(gc, m_Param.Path.InternalPath, r);
drawMethods.DrawPositiveSpace(gc, m_Param.Path.InternalPath, r);
DrawRegionRepresentation(gc, r, drawMethods, mousePosition);
// TODO ((States.IFilterHandles)editState).Handles.DrawHandles(gc, m_Param, r);
}
drawMethods.DrawHandles(gc, this, r);
}
}
示例14: ActivateScript
public override string ActivateScript(CandleChartControl chart, PointD worldCoords)
{
this.chart = chart;
var dlg = new CaymanDivergenceSetupDlg();
if (dlg.ShowDialog() == DialogResult.Cancel) return "";
skippedCandles = dlg.SkipCandles;
checkedPrices = dlg.CheckedPrices;
removeOldSigns = dlg.RemoveOldSigns;
return BuildSeries();
}
示例15: GetPotentialMouseAction
/// <summary>
/// Retrieves a mouse action that should be made active on the next
/// MouseDown event if the mouse is over the specified point.
/// </summary>
/// <param name="mouseButtons">The current mouse button state.</param>
/// <param name="point">The mouse position relative to the diagram's top-left in world units.</param>
/// <param name="hitTestInfo">Information detailing the results of the hit testing.</param>
/// <returns>A mouse action that should be made active on the next MouseDown event if the mouse is over the specified point.</returns>
public override MouseAction GetPotentialMouseAction(MouseButtons mouseButtons, PointD point, DiagramHitTestInfo hitTestInfo)
{
DiagramItem hitDiagramItem = hitTestInfo.HitDiagramItem;
Diagram diagram = (hitDiagramItem != null) ? hitDiagramItem.Diagram : null;
if (diagram == null)
{
return null;
}
return diagram.SelectAction;
}