double X(double bar){return((double)W.Left_bar-bar)*W.dx_pix;}; //The X coordinate by the bar number. The bar number must be of type double, otherwise, the bar will be interpreted as time.double X(datetime Time) //The X coordinate by the time.
{ if(tester) return X((double)iBarShift(_Symbol,_Period,Time));
elsereturn X(wBarShift(Time,W.time,_Period));}
double Y(double Price) {if(W.dy_pix==0) W.dy_pix=1; return((W.Y_max-Price)/W.dy_pix); }; //The Y coordinate by the price.double Price(int y) {return (W.Y_max-y*(W.Y_max-W.Y_min)/W.Height);}; // Price by the Y coordinatedouble Bar(double x) {return((double)W.Left_bar+1-x/(double)W.dx_pix);}; // bar number by coordinate X datetime TimePos(double x) // time by coordinate X
{
double B=Bar(x);
if (tester || W.BarsInWind == 0) iT[0]=iTime(_Symbol,_Period,(int)B);
else {if(B<0 ) iT[0]=datetime(W.time[W.BarsInWind-1]-(long)B*PeriodSeconds());
elseif(B<W.Right_bar || B>W.Left_bar) iT[0]=iTime(_Symbol,_Period,(int)B);
else iT[0]=W.time[W.BarsInWind-Floor(B)-1+(int)W.Right_bar];}
return iT[0]+int((double)PeriodSeconds()*(1-B+(int)B));
};
谢谢你提供这种解决问题的办法。事实上,渲染速度已经提高了。看来我得学习图书馆了。
我还想澄清以下细微差别。它用这种配方编译时有一个警告。
而用这个编译时没有警告,但速度有点慢。
什么是更正确的?)
啊,对了,我忘了放int。该图书馆是面向双坐标的。
速度不能下降。(int)实际上是免费的。不到纳秒。
你可以这样设置。
它也不会影响速度(+ ~1 ns),但它会定位得更准确一些。
iCanvas内置的Round函数返回int,比普通的round()函数快得多,但双倍参数x必须在int之内(-2 147 483 648 <= x <= 2 147 483 647)
在iCanvas里面看,这个问题就不存在了。
但Kanvas的工作环境更好,你可以应用透明度,速度更快,代码占用的空间也更少))。
谢谢你提供这种解决问题的办法。确实,渲染速度得到了改善。看来我得学习图书馆了。
我还想澄清以下细微差别。它用这种配方编译时有一个警告。
而用这个编译时没有警告,但速度有点慢。
什么是更正确的?)
把你的这段代码从循环中拿出来,在每个重绘事件的循环前调用一次。
这比学习一些图书馆更复杂吗?
如鱼得水 :)
PNB2))
把这段代码从循环中拿出来,在每个重绘事件之前调用一次。
这真的比学习一些库更复杂吗?
这就是我所说的。
我只是想知道--你能不能自己做,而不只是重复我的建议?
,其中两个很容易输出...
代码,谢谢。
,如果你不这样做,明天我醒来后自己写。但这样我就会说费多塞耶夫是个白痴。))
这就是我所说的。
我只是想知道--你能不能自己做,而不只是重复我的建议?
,其中两个很容易输出...
代码,谢谢。
,如果你不这样做,明天我醒来后自己写。但这样我就会说费多塞耶夫是个白痴。))
你对我的想法让人难以置信))
你对我的看法给我留下了难以置信的印象))。
少说话,多行动
谢谢你提供的例子!非常清晰,信息量大,而且不乏快速。
对象列表中Kanvas上的例子的所有图形看起来都是一个单一的对象。
当把鼠标悬停在个别图形项目 上时,是否可以得到不同的工具提示(tooltips)?
还是我可以为每个矩形创建一个单独的画布对象?这不会影响速度吗?
如果你有时间,我在等待你的回答,也许还有一个代码例子。