本文整理汇总了C#中Pad.IsInRange方法的典型用法代码示例。如果您正苦于以下问题:C# Pad.IsInRange方法的具体用法?C# Pad.IsInRange怎么用?C# Pad.IsInRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pad
的用法示例。
在下文中一共展示了Pad.IsInRange方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
}
示例2: 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:
//.........这里部分代码省略.........
示例3: Paint
// TODO: review it
public override void Paint(object obj, Pad pad)
{
var tickSeries = obj as TickSeries;
if (tickSeries.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;
}
}
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 < tickSeries.FirstDateTime) ? tickSeries.GetIndex(datetime1, IndexOption.Prev) : 0;
int num13 = !(datetime2 > tickSeries.LastDateTime) ? tickSeries.GetIndex(datetime2, IndexOption.Next) : tickSeries.Count - 1;
if (num12 == -1 || num13 == -1)
return;
for (int index = num12; index <= num13; ++index)
{
Tick tick = tickSeries[index];
double num14 = (double)tick.DateTime.Ticks;
pad.ClientX(num14);
double price = tick.Price;
if (num1 != 0)
{
num4 = (long)pad.ClientX(num2);
num6 = pad.ClientY(num3);
num5 = (long)pad.ClientX(num14);
num7 = pad.ClientY(price);
if ((pad.IsInRange(num14, price) || 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 = price;
++num1;
}
}