本文整理汇总了C#中Pad.ClientY方法的典型用法代码示例。如果您正苦于以下问题:C# Pad.ClientY方法的具体用法?C# Pad.ClientY怎么用?C# Pad.ClientY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pad
的用法示例。
在下文中一共展示了Pad.ClientY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Paint
public override void Paint(Pad pad, double minX, double maxX, double minY, double maxY)
{
base.Paint(pad, minX, maxX, minY, maxY);
if (string.IsNullOrWhiteSpace(Text))
return;
var size = pad.Graphics.MeasureString(Text, TextFont);
var w = size.Width;
var h = size.Height;
var clientX = pad.ClientX(X);
var clientY = pad.ClientY(Y);
var point = PointF.Empty;
switch (TextPosition)
{
case ETextPosition.RightTop:
point = new PointF(clientX + TextOffsetX, clientY - h - TextOffsetY);
break;
case ETextPosition.LeftTop:
point = new PointF(clientX - w - TextOffsetX, clientY - h - TextOffsetY);
break;
case ETextPosition.CentreTop:
point = new PointF(clientX - w/2 - TextOffsetX, clientY - h - TextOffsetY);
break;
case ETextPosition.RightBottom:
point = new PointF(clientX + TextOffsetX, clientY + Size/2 + TextOffsetY);
break;
case ETextPosition.LeftBottom:
point = new PointF(clientX - w - TextOffsetX, clientY + Size/2 + TextOffsetY);
break;
case ETextPosition.CentreBottom:
point = new PointF(clientX - w/2 - TextOffsetX, clientY + Size/2 + TextOffsetY);
break;
}
pad.Graphics.DrawString(Text, TextFont, new SolidBrush(TextColor), point.X, point.Y);
}
示例2: Paint
public virtual void Paint(Pad pad, double xMin, double xMax, double yMin, double yMax)
{
int num1 = pad.ClientX(X);
int y = pad.ClientY(Y);
float num2 = (float)this.fSize;
switch (Style)
{
case EMarkerStyle.Rectangle:
if (Filled)
{
pad.Graphics.FillRectangle(new SolidBrush(Color), num1 - num2 / 2f, y - num2 / 2f, num2, num2);
break;
}
else
{
Pen pen = new Pen(this.fColor);
pad.Graphics.DrawRectangle(pen, num1 - num2 / 2f, y - num2 / 2f, num2, num2);
break;
}
case EMarkerStyle.Triangle:
float num3 = (float)(num2 / 2.0 * Math.Tan(Math.PI / 6.0));
float num4 = num2 * (float)Math.Cos(Math.PI / 6.0) - num3;
PointF pointF1 = new PointF(num1, y - num4);
PointF pointF2 = new PointF(num1 - num2 / 2f, y + num3);
PointF pointF3 = new PointF(num1 + num2 / 2f, y + num3);
PointF[] points1 = new PointF[4]
{
pointF1,
pointF2,
pointF3,
pointF1
};
if (this.fFilled)
{
pad.Graphics.FillPolygon(new SolidBrush(this.fColor), points1);
break;
}
else
{
Pen pen = new Pen(this.fColor);
pad.Graphics.DrawLines(pen, points1);
break;
}
case EMarkerStyle.Circle:
if (this.fFilled)
{
pad.Graphics.FillEllipse((Brush)new SolidBrush(this.fColor), (float)num1 - num2 / 2f, (float)y - num2 / 2f, num2, num2);
break;
}
else
{
Pen pen = new Pen(this.fColor);
pad.Graphics.DrawEllipse(pen, (float)num1 - num2 / 2f, (float)y - num2 / 2f, num2, num2);
break;
}
case EMarkerStyle.Bar:
Pen pen1 = new Pen(this.fColor);
pad.Graphics.DrawLine(pen1, num1, pad.ClientY(this.fLow), pad.ClientX(this.fX), pad.ClientY(this.fHigh));
pad.Graphics.DrawLine(pen1, num1, pad.ClientY(this.fLow), pad.ClientX(this.fX) - 3, pad.ClientY(this.fLow));
pad.Graphics.DrawLine(pen1, num1, pad.ClientY(this.fHigh), pad.ClientX(this.fX) + 3, pad.ClientY(this.fHigh));
break;
case EMarkerStyle.Buy:
PointF[] points2 = new PointF[3]
{
(PointF)new Point(num1, y),
(PointF)new Point((int)((double)num1 - (double)num2 / 2.0), (int)((double)y + (double)num2)),
(PointF)new Point((int)((double)num1 + (double)num2 / 2.0), (int)((double)y + (double)num2))
};
pad.Graphics.FillPolygon(new SolidBrush(this.fBuyColor), points2);
break;
case EMarkerStyle.Sell:
Point[] points3 = new Point[3]
{
new Point(num1, y),
new Point((int)((double)num1 - (double)num2 / 2.0), (int)((double)y - (double)num2)),
new Point((int)((double)num1 + (double)num2 / 2.0), (int)((double)y - (double)num2))
};
pad.Graphics.FillPolygon(new SolidBrush(this.fSellColor), points3);
break;
case EMarkerStyle.SellShort:
Point[] points4 = new Point[3]
{
new Point(num1, y),
new Point((int)((double)num1 - (double)num2 / 2.0), (int)((double)y - (double)num2)),
new Point((int)((double)num1 + (double)num2 / 2.0), (int)((double)y - (double)num2))
};
pad.Graphics.FillPolygon(new SolidBrush(this.fSellShortColor), points4);
break;
case EMarkerStyle.BuyShort:
Point[] points5 = new Point[3]
{
new Point(num1, y),
new Point((int)((double)num1 - (double)num2 / 2.0), (int)((double)y + (double)num2)),
new Point((int)((double)num1 + (double)num2 / 2.0), (int)((double)y + (double)num2))
};
pad.Graphics.FillPolygon((Brush)new SolidBrush(this.fBuyShortColor), points5);
break;
case EMarkerStyle.Plus:
Pen pen2 = new Pen(this.fColor);
pad.Graphics.DrawLine(pen2, (float)num1 - num2 / 2f, (float)y, (float)num1 + num2 / 2f, (float)y);
//.........这里部分代码省略.........
示例3: Paint
public void Paint(Pad pad, double minX, double maxX, double minY, double maxY)
{
if (Text == null)
return;
var w = (int) pad.Graphics.MeasureString(Text, Font).Width;
var h = pad.Graphics.MeasureString(Text, Font).Height;
switch (Position)
{
case ETextPosition.RightBottom:
pad.Graphics.DrawString(Text, Font, new SolidBrush(Color), pad.ClientX(X), pad.ClientY(Y));
break;
case ETextPosition.LeftBottom:
pad.Graphics.DrawString(Text, Font, new SolidBrush(Color), pad.ClientX(X) - w, pad.ClientY(Y));
break;
case ETextPosition.CentreBottom:
pad.Graphics.DrawString(Text, Font, new SolidBrush(Color), pad.ClientX(X) - w/2, pad.ClientY(Y));
break;
}
}
示例4: Paint
public virtual void Paint(Pad pad, double xMin, double xMax, double yMin, double yMax)
{
pad.Graphics.DrawImage(Image, pad.ClientX(X), pad.ClientY(Y));
}
示例5: GetPadRangeY
public PadRange GetPadRangeY(Pad pad)
{
DateTime now = Clock.Now;
FIXExecutionReport fIXExecutionReport = null;
if (this.order.Reports.Count != 0)
{
fIXExecutionReport = this.order.Reports[this.order.Reports.Count - 1];
}
if (fIXExecutionReport == null)
{
return new PadRange(0.0, 0.0);
}
if (this.order.OrdType == OrdType.Market && this.order.OrdStatus != OrdStatus.Filled)
{
return new PadRange(0.0, 0.0);
}
FIXExecutionReport fIXExecutionReport2 = this.order.Reports[0];
DateTime t = new DateTime((long)pad.XMin);
DateTime t2 = new DateTime((long)pad.XMax);
DateTime transactTime = fIXExecutionReport2.TransactTime;
DateTime t3;
if (this.order.OrdStatus == OrdStatus.Filled || this.order.OrdStatus == OrdStatus.Cancelled || this.order.OrdStatus == OrdStatus.Rejected)
{
t3 = fIXExecutionReport.TransactTime;
}
else
{
t3 = now;
}
if (!(t <= t3) || !(t2 >= transactTime) || this.order.OrdStatus == OrdStatus.Cancelled || this.order.OrdStatus == OrdStatus.Rejected)
{
return new PadRange(0.0, 0.0);
}
double val = this.order.AvgPx - 1E-10;
double val2 = this.order.AvgPx + 1E-10;
if (this.order.OrdType == OrdType.Limit)
{
int clientY = pad.ClientY(this.order.Price);
if (this.order.Side == Side.Buy)
{
val2 = pad.WorldY(clientY);
val = this.order.Price;
}
else
{
val = pad.WorldY(clientY);
val2 = this.order.Price;
}
}
if (this.order.OrdType == OrdType.Stop)
{
int clientY2 = pad.ClientY(this.order.StopPx);
if (this.order.Side != Side.Buy)
{
val2 = pad.WorldY(clientY2);
val = this.order.StopPx;
}
else
{
val = pad.WorldY(clientY2);
val2 = this.order.StopPx;
}
}
if (this.order.OrdType == OrdType.StopLimit)
{
int clientY3 = pad.ClientY(this.order.Price);
int clientY4 = pad.ClientY(this.order.StopPx);
if (this.order.Side == Side.Buy)
{
val2 = pad.WorldY(clientY3);
val = pad.WorldY(clientY4);
}
else
{
val = pad.WorldY(clientY3);
val2 = pad.WorldY(clientY4);
}
}
return new PadRange(Math.Min(val, val2), Math.Max(val, val2));
}
示例6: Paint
public void Paint(Pad pad, double MinX, double MaxX, double MinY, double MaxY)
{
if (this.order.OrdType == OrdType.TrailingStop || this.order.OrdType == OrdType.TrailingStopLimit)
{
return;
}
DateTime now = Clock.Now;
Color color = Color.Green;
Pen pen;
if (this.order.OrdStatus != OrdStatus.Cancelled && this.order.OrdStatus != OrdStatus.Rejected)
{
pen = new Pen(this.limitColor, 2f);
}
else
{
pen = new Pen(this.limitCancelColor, 2f);
}
pen.DashStyle = DashStyle.Dash;
Pen pen2;
if (this.order.OrdStatus != OrdStatus.Cancelled && this.order.OrdStatus != OrdStatus.Rejected)
{
pen2 = new Pen(this.stopColor, 2f);
}
else
{
pen2 = new Pen(this.stopCancelColor, 2f);
}
pen2.DashStyle = DashStyle.Dash;
switch (this.order.OrdStatus)
{
case OrdStatus.Filled:
color = Color.Green;
break;
case OrdStatus.Cancelled:
case OrdStatus.Rejected:
color = Color.Gray;
break;
case OrdStatus.Stopped:
color = Color.Red;
break;
}
DateTime transactTime = new DateTime(1, 1, 1);
DateTime dateTime = new DateTime(1, 1, 1);
DateTime transactTime2 = new DateTime(1, 1, 1);
DateTime dateTime2 = new DateTime(1, 1, 1);
float num = 12f;
DateTime dateTime3 = DateTime.MaxValue;
if (this.order.OrdStatus == OrdStatus.Cancelled || this.order.OrdStatus == OrdStatus.Rejected || this.order.OrdStatus == OrdStatus.PendingNew || this.order.OrdStatus == OrdStatus.Filled)
{
dateTime3 = this.order.Reports[this.order.Reports.Count - 1].TransactTime;
}
if (this.order.OrdType == OrdType.Stop || this.order.OrdType == OrdType.StopLimit)
{
transactTime = this.order.Reports[0].TransactTime;
if (this.order.OrdStatus == OrdStatus.PendingNew)
{
dateTime = new DateTime(Math.Min(now.Ticks, (long)MaxX));
}
else
{
dateTime = new DateTime(Math.Min(now.Ticks, dateTime3.Ticks));
}
if ((double)transactTime.Ticks > MaxX || (double)dateTime.Ticks <= MinX)
{
return;
}
float num2 = (float)pad.ClientY(this.order.StopPx);
float x = (float)pad.ClientX((double)transactTime.Ticks);
float num3 = (float)pad.ClientX((double)dateTime.Ticks);
pad.Graphics.DrawLine(pen2, x, num2, num3, num2);
string priceDisplay = this.order.Instrument.PriceDisplay;
string text;
if (this.order.OrdStatus == OrdStatus.Filled)
{
text = this.order.Side.ToString() + " Stop at " + this.order.StopPx.ToString(priceDisplay) + " (Executed)";
}
else
{
if (this.order.OrdStatus == OrdStatus.Cancelled)
{
text = this.order.Side.ToString() + " Stop at " + this.order.StopPx.ToString(priceDisplay) + " (Canceled)";
}
else
{
if (this.order.OrdStatus == OrdStatus.Rejected)
{
text = this.order.Side.ToString() + " Stop at " + this.order.StopPx.ToString(priceDisplay) + " (Rejected)";
}
else
{
text = this.order.Side.ToString() + " Stop at " + this.order.StopPx.ToString(priceDisplay) + " (Pending)";
}
}
}
Font font = new Font("Arial", 8f);
double num4;
if (this.order.Side == Side.Buy)
{
num4 = (double)(num2 - 2f - (float)((int)pad.Graphics.MeasureString(text, font).Height));
}
//.........这里部分代码省略.........
示例7: Paint
public virtual void Paint(Pad pad, double minX, double maxX, double minY, double maxY)
{
float height = GetHeight(pad);
float width = GetWidth(pad);
float x = 0f;
float y = 0f;
switch (Position)
{
case ETextBoxPosition.TopRight:
x = (float)(pad.ClientX() + pad.ClientWidth() - X) - width;
y = (float)(pad.ClientY() + Y);
break;
case ETextBoxPosition.TopLeft:
x = (float)(pad.ClientX() + X);
y = (float)(pad.ClientY() + Y);
break;
case ETextBoxPosition.BottomRight:
x = (float)(pad.ClientX() + pad.ClientWidth() - X) - width;
y = (float)(pad.ClientY() + pad.ClientHeight() - Y) - height;
break;
case ETextBoxPosition.BottomLeft:
x = (float)(pad.ClientX() + X);
y = (float)(pad.ClientY() + pad.ClientHeight() - Y) - height;
break;
}
pad.Graphics.FillRectangle((Brush)new SolidBrush(BackColor), x, y, width, height);
if (BorderEnabled)
pad.Graphics.DrawRectangle(new Pen(BorderColor), x, y, width, height);
foreach (TTextBoxItem ttextBoxItem in Items)
{
int num = (int)pad.Graphics.MeasureString(ttextBoxItem.Text, ttextBoxItem.Font).Height;
pad.Graphics.DrawString(ttextBoxItem.Text, ttextBoxItem.Font, (Brush)new SolidBrush(ttextBoxItem.Color), x + 5f, y);
y += (float)(2 + num);
}
}
示例8: Paint
// TODO: rewrite it
public virtual void Paint(Pad pad, double xMin, double xMax, double yMin, double yMax)
{
var num1 = Pieces.Count > 0 ? Pieces.Cast<TPieItem>().Sum(item => item.Weight) : 0;
int num2 = pad.ClientX(0.0);
int num3 = pad.ClientY(100.0);
int num4 = Math.Abs(pad.ClientX(100.0) - pad.ClientX(0.0));
int num5 = Math.Abs(pad.ClientY(100.0) - pad.ClientY(0.0));
int num6 = 0;
int num7 = 0;
if (num4 > num5)
{
num6 = (num4 - num5) / 2;
num4 = num5;
}
else
{
num7 = (num5 - num4) / 2;
num5 = num4;
}
int num8 = num5 / 10;
// double num9 ;
double num10 = 0.0;
for (int index = 0; index < Pieces.Count; ++index)
{
double num11 = ((TPieItem)Pieces[index]).Weight / num1;
var brush = new SolidBrush(((TPieItem)Pieces[index]).Color);
double num12 = num10 + (double)Gap;
num10 += 360.0 * num11;
double num13 = num10 - num12 + 1.0;
pad.Graphics.FillPie(brush, num2 + num6 + num8, num3 + num7 + num8, num4 - 2 * num8, num5 - 2 * num8, (int)num12, (int)num13);
}
if (EnableContour)
{
// num9 = 0.0;
double num11 = 0.0;
for (int index = 0; index < Pieces.Count; ++index)
{
double num12 = ((TPieItem)Pieces[index]).Weight / num1;
Pen pen = new Pen(ContourColor);
double num13 = num11 + Gap;
num11 += 360.0 * num12;
double num14 = num11 - num13 + 1.0;
pad.Graphics.DrawPie(pen, (float)(num2 + num6 + num8), (float)(num3 + num7 + num8), (float)(num4 - 2 * num8), (float)(num5 - 2 * num8), (float)num13, (float)num14);
}
}
// num9 = 0.0;
double num15 = 0.0;
for (int index = 0; index < Pieces.Count; ++index)
{
double num11 = ((TPieItem)Pieces[index]).Weight / num1;
Pen pen = new Pen(ContourColor);
double num12 = num15 + Gap;
num15 += 360.0 * num11;
double num13 = num12 + (num15 - num12) / 2.0 + 90.0;
int num14 = (num4 - 2 * num8) / 4;
int num16 = (num4 - 2 * num8) / 2;
Math.Sin(Math.PI / 180.0 * num13);
int num17 = (num4 - 2 * num8) / 2;
Math.Cos(Math.PI / 180.0 * num13);
int num18 = (num4 - 2 * num8) / 2;
int num19 = (num4 - 2 * num8) / 2 + 10;
int x1 = (int)((double)(num2 + num6 + num8 + (num4 - 2 * num8) / 2) + (double)num18 * Math.Sin(Math.PI / 180.0 * num13));
int y1 = (int)((double)(num3 + num7 + num8 + (num4 - 2 * num8) / 2) - (double)num18 * Math.Cos(Math.PI / 180.0 * num13));
int num20 = (int)((double)(num2 + num6 + num8 + (num4 - 2 * num8) / 2) + (double)num19 * Math.Sin(Math.PI / 180.0 * num13));
int num21 = (int)((double)(num3 + num7 + num8 + (num4 - 2 * num8) / 2) - (double)num19 * Math.Cos(Math.PI / 180.0 * num13));
Font font = new Font("Arial", 8f);
pad.Graphics.DrawLine(new Pen(Color.Gray), x1, y1, num20, num21);
string str = ((TPieItem)Pieces[index]).Text.Replace("&%", (num11 * 100.0).ToString(Format));
if (num20 > num2 + num6 + num4 / 2)
{
pad.Graphics.DrawLine(new Pen(Color.Gray), num20, num21, num20 + 5, num21);
SizeF sizeF = pad.Graphics.MeasureString(str, font);
pad.Graphics.DrawString(str, font, (Brush)new SolidBrush(Color.Black), (float)(num20 + 5), (float)num21 - sizeF.Height / 2f);
}
else
{
pad.Graphics.DrawLine(new Pen(Color.Gray), num20, num21, num20 - 5, num21);
SizeF sizeF = pad.Graphics.MeasureString(str, font);
pad.Graphics.DrawString(str, font, (Brush)new SolidBrush(Color.Black), (float)(num20 - 5) - sizeF.Width, (float)num21 - sizeF.Height / 2f);
}
}
}
示例9: Paint
public virtual void Paint(Pad pad, double xMin, double xMax, double yMin, double yMax)
{
var pen = new Pen(LineColor);
var brush = this.fFillBrush ?? new SolidBrush(FillColor);
for (var i = 0; i < this.fNBins; ++i)
{
pad.Graphics.FillRectangle(brush, pad.ClientX(GetBinMin(i)), pad.ClientY(this.fBins[i]), Math.Abs(pad.ClientX(GetBinMax(i)) - pad.ClientX(GetBinMin(i))), Math.Abs(pad.ClientY(this.fBins[i]) - pad.ClientY(0.0)));
pad.DrawLine(pen, GetBinMin(i), 0.0, GetBinMin(i), this.fBins[i]);
pad.DrawLine(pen, GetBinMin(i), this.fBins[i], GetBinMax(i), this.fBins[i]);
pad.DrawLine(pen, GetBinMax(i), this.fBins[i], GetBinMax(i), 0.0);
}
}
示例10: Paint
// TODO: review it
public override void Paint(object obj, Pad pad)
{
var ts = obj as TimeSeries;
if (ts == null || ts.Count == 0)
return;
double xmin = pad.XMin;
double xmax = pad.XMax;
double ymin = pad.YMin;
double ymax = pad.YMax;
List<Property> list = null;
if (this.metadata.TryGetValue(obj, out list))
{
foreach (var property in list)
{
if (property.Name == "Color")
this.Color = (Color)property.Value;
if (property.Name == "Width")
this.DrawWidth = (int)property.Value;
if (property.Name == "Style")
{
if ((string)property.Value == "Line")
this.DrawStyle = DrawStyle.Line;
if ((string)property.Value == "Bar")
this.DrawStyle = DrawStyle.Bar;
if ((string)property.Value == "Circle")
this.DrawStyle = DrawStyle.Circle;
}
}
}
var pen = new Pen(Color, DrawWidth);
int num1 = 0;
double num2 = 0.0;
double num3 = 0.0;
long num4 = 0L;
long num5 = 0L;
int num6 = 0;
int num7 = 0;
long num8 = 0L;
long num9 = 0L;
int num10 = 0;
int num11 = 0;
DateTime datetime1 = new DateTime((long)xmin);
DateTime datetime2 = new DateTime((long)xmax);
int num12 = !(datetime1 < ts.FirstDateTime) ? ts.GetIndex(datetime1, IndexOption.Prev) : 0;
int num13 = !(datetime2 > ts.LastDateTime) ? ts.GetIndex(datetime2, IndexOption.Next) : ts.Count - 1;
if (num12 == -1 || num13 == -1)
return;
for (int index = num12; index <= num13; ++index)
{
TimeSeriesItem timeSeriesItem = ts.GetItem(index);
double num14 = (double)timeSeriesItem.DateTime.Ticks;
pad.ClientX(num14);
double num15 = timeSeriesItem.Value;
if (this.DrawStyle == DrawStyle.Line)
{
if (num1 != 0)
{
num4 = (long)pad.ClientX(num2);
num6 = pad.ClientY(num3);
num5 = (long)pad.ClientX(num14);
num7 = pad.ClientY(num15);
if ((pad.IsInRange(num14, num15) || pad.IsInRange(num2, num3)) &&
(num4 != num8 || num5 != num9 || (num6 != num10 || num7 != num11)))
{
pad.Graphics.DrawLine(pen, (float) num4, (float) num6, (float) num5, (float) num7);
}
}
num8 = num4;
num10 = num6;
num9 = num5;
num11 = num7;
num2 = num14;
num3 = num15;
++num1;
}
if (this.DrawStyle == DrawStyle.Bar)
{
if (num15 > 0.0)
pad.Graphics.FillRectangle(new SolidBrush(Color), pad.ClientX(num14) - (this.DrawWidth + 1) / 2, pad.ClientY(num15), this.DrawWidth + 1, pad.ClientY(0.0) - pad.ClientY(num15));
else
pad.Graphics.FillRectangle(new SolidBrush(Color), pad.ClientX(num14) - (this.DrawWidth + 1) / 2, pad.ClientY(0.0), this.DrawWidth + 1, pad.ClientY(num15) - pad.ClientY(0.0));
}
if (this.DrawStyle == DrawStyle.Circle)
{
var solidBrush = new SolidBrush(Color);
pad.Graphics.FillEllipse(solidBrush, pad.ClientX(num14) - this.DrawWidth / 2, pad.ClientY(num15) - this.DrawWidth / 2, this.DrawWidth, this.DrawWidth);
}
}
}
示例11: Paint
public override void Paint(object obj, Pad pad)
{
var fs = obj as FillSeries;
if (fs == null || fs.Count == 0)
return;
double xmin = pad.XMin;
double xmax = pad.XMax;
double ymin = pad.YMin;
double ymax = pad.YMax;
List<Viewer.Property> list = null;
if (this.metadata.TryGetValue(obj, out list))
{
foreach (var property in list)
{
if (property.Name == "BuyColor")
this.BuyColor = (Color)property.Value;
if (property.Name == "SellColor")
this.SellColor = (Color)property.Value;
if (property.Name == "TextEnabled")
this.TextEnabled = (bool)property.Value;
}
}
DateTime datetime1 = new DateTime((long)xmin);
DateTime datetime2 = new DateTime((long)xmax);
int num1 = !(datetime1 < fs[0].DateTime) ? fs.GetIndex(datetime1, IndexOption.Prev) : 0;
int num2 = !(datetime2 > fs[fs.Count - 1].DateTime) ? fs.GetIndex(datetime2, IndexOption.Next) : fs.Count - 1;
if (num1 == -1 || num2 == -1)
return;
for (int index = num1; index <= num2; ++index)
{
Fill fill = fs[index];
int x = pad.ClientX((double)fill.DateTime.Ticks);
int y = pad.ClientY(fill.Price);
float num3 = 12f;
string str = string.Format("{0} {1} @ {2} {3}", fill.Side, fill.Qty, fill.Price.ToString(fill.Instrument.PriceFormat), fill.Text);
Font font = new Font("Arial", 8f);
switch (fill.Side)
{
case OrderSide.Buy:
Color buyColor = this.BuyColor;
PointF[] points1 = new PointF[]
{
new Point(x, y),
new Point((int)((double)x - (double)num3 / 2.0), (int)((double)y + (double)num3 / 2.0)),
new Point((int)((double)x + (double)num3 / 2.0), (int)((double)y + (double)num3 / 2.0))
};
pad.Graphics.DrawPolygon(new Pen(Color.Black), points1);
pad.Graphics.DrawRectangle(new Pen(Color.Black), (float)x - num3 / 4f, (float)y + num3 / 2f, num3 / 2f, num3 / 2f);
pad.Graphics.FillPolygon((Brush)new SolidBrush(buyColor), points1);
pad.Graphics.FillRectangle((Brush)new SolidBrush(buyColor), (float)x - num3 / 4f, (float)((double)y + (double)num3 / 2.0 - 1.0), num3 / 2f, (float)((double)num3 / 2.0 + 1.0));
break;
case OrderSide.Sell:
Color sellColor = SellColor;
var points2 = new Point[]
{
new Point(x, y),
new Point((int)((double)x - (double)num3 / 2.0), (int)((double)y - (double)num3 / 2.0)),
new Point((int)((double)x + (double)num3 / 2.0), (int)((double)y - (double)num3 / 2.0))
};
pad.Graphics.DrawPolygon(new Pen(Color.Black), points2);
pad.Graphics.DrawRectangle(new Pen(Color.Black), (float)x - num3 / 4f, (float)y - num3, num3 / 2f, (float)((double)num3 / 2.0 + 1.0));
pad.Graphics.FillPolygon(new SolidBrush(sellColor), points2);
pad.Graphics.FillRectangle(new SolidBrush(sellColor), (float)x - num3 / 4f, (float)y - num3, num3 / 2f, (float)((double)num3 / 2.0 + 1.0));
break;
}
if (TextEnabled)
{
int num4 = (int)pad.Graphics.MeasureString(str, font).Width;
int num5 = (int)pad.Graphics.MeasureString(str, font).Height;
switch (fill.Side)
{
case OrderSide.Buy:
pad.Graphics.DrawString(str, font, (Brush)new SolidBrush(Color.Black), (float)(x - num4 / 2), (float)((double)y + (double)num3 + 2.0));
continue;
case OrderSide.Sell:
pad.Graphics.DrawString(str, font, (Brush)new SolidBrush(Color.Black), (float)(x - num4 / 2), (float)((double)y - (double)num3 - 2.0) - (float)num5);
continue;
default:
continue;
}
}
}
}
示例12: Paint
public virtual void Paint(Pad pad, double xMin, double xMax, double yMin, double yMax)
{
if (Style == EGraphStyle.Line && LineEnabled)
{
Pen Pen = new Pen(LineColor);
Pen.DashStyle = LineDashStyle;
double X1 = 0.0;
double Y1 = 0.0;
bool flag = true;
foreach (TMarker tmarker in Points)
{
if (!flag)
pad.DrawLine(Pen, X1, Y1, tmarker.X, tmarker.Y);
else
flag = false;
X1 = tmarker.X;
Y1 = tmarker.Y;
}
}
if ((Style == EGraphStyle.Line || Style == EGraphStyle.Scatter) && MarkerEnabled)
{
foreach (TMarker tmarker in Points)
tmarker.Paint(pad, xMin, xMax, yMin, yMax);
}
if (Style != EGraphStyle.Bar)
return;
foreach (TMarker tmarker in Points)
{
if (tmarker.Y > 0.0)
pad.Graphics.FillRectangle(new SolidBrush(Color.Black), pad.ClientX(tmarker.X) - BarWidth / 2, pad.ClientY(tmarker.Y), BarWidth, pad.ClientY(0.0) - pad.ClientY(tmarker.Y));
else
pad.Graphics.FillRectangle(new SolidBrush(Color.Black), pad.ClientX(tmarker.X) - BarWidth / 2, pad.ClientY(0.0), BarWidth, pad.ClientY(tmarker.Y) - pad.ClientY(0.0));
}
}
示例13: Paint
public void Paint(Pad pad, double minX, double maxX, double minY, double maxY)
{
if (this.fText == null)
return;
int num1 = (int)pad.Graphics.MeasureString(this.fText, this.fFont).Width;
double num2 = (double)pad.Graphics.MeasureString(this.fText, this.fFont).Height;
switch (this.fPosition)
{
case ETextPosition.RightBottom:
pad.Graphics.DrawString(this.fText, this.fFont, (Brush)new SolidBrush(this.fColor), (float)pad.ClientX(this.fX), (float)pad.ClientY(this.fY));
break;
case ETextPosition.LeftBottom:
pad.Graphics.DrawString(this.fText, this.fFont, (Brush)new SolidBrush(this.fColor), (float)(pad.ClientX(this.fX) - num1), (float)pad.ClientY(this.fY));
break;
case ETextPosition.CentreBottom:
pad.Graphics.DrawString(this.fText, this.fFont, (Brush)new SolidBrush(this.fColor), (float)(pad.ClientX(this.fX) - num1 / 2), (float)pad.ClientY(this.fY));
break;
}
}
示例14: Paint
// TODO: review it
public override void Paint(object obj, Pad pad)
{
var bs = obj as BarSeries;
if (bs == null || bs.Count == 0)
return;
double xmin = pad.XMin;
double xmax = pad.XMax;
double ymin = pad.YMin;
double ymax = pad.YMax;
Pen pen1 = new Pen(Color);
Pen pen2 = new Pen(BarColor);
Pen pen3 = new Pen(CandleColor);
Pen pen4 = new Pen(CandleBorderColor);
Brush brush1 = new SolidBrush(CandleWhiteColor);
Brush brush2 = new SolidBrush(CandleBlackColor);
int num1 = 0;
double num2 = 0.0;
double num3 = 0.0;
int num4 = 0;
int num5 = 0;
int num6 = 0;
int x2 = 0;
long num7 = 0L;
long num8 = 0L;
int num9 = 0;
int num10 = 0;
DateTime datetime1 = new DateTime((long)xmin);
DateTime datetime2 = new DateTime((long)xmax);
int num11 = !(datetime1 < bs.FirstDateTime) ? bs.GetIndex(datetime1, IndexOption.Prev) : 0;
int num12 = !(datetime2 > bs.LastDateTime) ? bs.GetIndex(datetime2, IndexOption.Next) : bs.Count - 1;
if (num11 == -1 || num12 == -1)
return;
for (int index = num11; index <= num12; ++index)
{
Bar bar = bs[index];
long num13 = bar.OpenDateTime.Ticks;
long num14 = bar.CloseDateTime.Ticks;
double num15 = (double)(num13 + (num14 - num13) / 2L);
int num16 = pad.ClientX(num15);
double high = bar.High;
double low = bar.Low;
double open = bar.Open;
double close = bar.Close;
Pen pen5 = pen2;
switch (this.ChartStyle)
{
case ChartStyle.Bar:
switch (this.BarWidthStyle)
{
case EWidthStyle.Pixel:
num6 = pad.ClientX(num15) - this.BarWidth / 2;
x2 = pad.ClientX(num15) + this.BarWidth / 2;
break;
case EWidthStyle.DateTime:
num6 = pad.ClientX(num15 - (double)((long)this.BarWidth * 10000000L / 2L));
x2 = pad.ClientX(num15 + (double)((long)this.BarWidth * 10000000L / 2L));
break;
case EWidthStyle.Auto:
num6 = pad.ClientX((double)num13);
x2 = pad.ClientX((double)num14);
break;
}
pad.Graphics.DrawLine(pen5, num16, pad.ClientY(low), num16, pad.ClientY(high));
if (open != 0.0)
pad.Graphics.DrawLine(pen5, num16, pad.ClientY(open), num6, pad.ClientY(open));
if (close != 0.0)
{
pad.Graphics.DrawLine(pen5, num16, pad.ClientY(close), x2, pad.ClientY(close));
break;
}
else
break;
case ChartStyle.Line:
double num17 = close;
if (num1 != 0)
{
num13 = (long)pad.ClientX(num2);
num4 = pad.ClientY(num3);
num14 = (long)pad.ClientX(num15);
num5 = pad.ClientY(num17);
if ((pad.IsInRange(num15, num17) || pad.IsInRange(num2, num3)) && (num13 != num7 || num14 != num8 || (num4 != num9 || num5 != num10)))
pad.Graphics.DrawLine(pen1, (float)num13, (float)num4, (float)num14, (float)num5);
}
num7 = num13;
num9 = num4;
num8 = num14;
num10 = num5;
num2 = num15;
num3 = num17;
++num1;
break;
case ChartStyle.Candle:
switch (this.CandleWidthStyle)
{
case EWidthStyle.Pixel:
num6 = pad.ClientX(num15) - this.CandleWidth / 2;
x2 = pad.ClientX(num15) + this.CandleWidth / 2;
break;
case EWidthStyle.DateTime:
//.........这里部分代码省略.........
示例15: Paint
public virtual void Paint(Pad pad, double minX, double maxX, double minY, double maxY)
{
float height = GetHeight(pad);
float width = GetWidth(pad);
float x = 0;
float y = 0;
switch (Position)
{
case ETextBoxPosition.TopRight:
x = pad.ClientX() + pad.ClientWidth() - X - width;
y = pad.ClientY() + Y;
break;
case ETextBoxPosition.TopLeft:
x = pad.ClientX() + X;
y = pad.ClientY() + Y;
break;
case ETextBoxPosition.BottomRight:
x = pad.ClientX() + pad.ClientWidth() - X - width;
y = pad.ClientY() + pad.ClientHeight() - Y - height;
break;
case ETextBoxPosition.BottomLeft:
x = pad.ClientX() + X;
y = pad.ClientY() + pad.ClientHeight() - Y - height;
break;
}
pad.Graphics.FillRectangle(new SolidBrush(BackColor), x, y, width, height);
if (BorderEnabled)
pad.Graphics.DrawRectangle(new Pen(BorderColor), x, y, width, height);
foreach (TTextBoxItem item in Items)
{
var h = pad.Graphics.MeasureString(item.Text, item.Font).Height;
pad.Graphics.DrawString(item.Text, item.Font, new SolidBrush(item.Color), x + 5, y);
y += 2 + h;
}
}