COCO研究院

 找回密碼
 註冊
搜索
查看: 25493|回復: 7

[範例程式碼] 可以移動的欄位文字

[複製鏈接]
發表於 13-3-22 22:49 | 顯示全部樓層 |閱讀模式
純粹好玩

  1. //Button Text
  2. #include <ControlPanelInclude-003c.afl>
  3. SetChartOptions(0, chartShowDates,chartGridMiddle,0,0,0);
  4. SetChartBkColor(colorBlack);
  5. SetChartBkGradientFill(colorBlue,colorBlack);
  6. _SECTION_BEGIN("K Bar");

  7. pxW=Status("pxchartwidth");
  8. pxH=Status("pxchartheight");

  9. a=SelectedValue(BarIndex());



  10. YesTH=TimeFrameGetPrice("H",inDaily,-1);
  11. YesTL=TimeFrameGetPrice("L",inDaily,-1);
  12. TodayH=TimeFrameGetPrice("H",inDaily,0);
  13. TodayL=TimeFrameGetPrice("L",inDaily,0);
  14. TodayO=TimeFrameGetPrice("O",inDaily,0);

  15. Ticker = ParamStr("Symbol","TSEIDX");
  16. TIckerO = Foreign(Ticker, "O");
  17. TIckerH = Foreign(Ticker, "H");
  18. TIckerL = Foreign(Ticker, "L");
  19. TIckerC = Foreign(Ticker, "C");

  20. TYesTH =TimeFrameGetPrice("TickerH",inDaily,-1);
  21. TYesTL =TimeFrameGetPrice("TickerL",inDaily,-1);
  22. TTodayH=TimeFrameGetPrice("TickerH",inDaily,0);
  23. TTodayL=TimeFrameGetPrice("TickerL",inDaily,0);
  24. TTodayO=TimeFrameGetPrice("TickerO",inDaily,0);


  25. if (StaticVarGet("TXON"))
  26. {
  27. SetBarFillColor(IIf(C>O,colorRed,IIf(C<O,colorGreen,colorBlue)));
  28. Plot(C,"Price",IIf(C>O,colorGold,colorTeal),styleCandle|styleNoTitle,0,0,0,0);
  29. }

  30. if (StaticVarGet("TIckerON"))
  31. {
  32. //TIcker = "TIckerIDX";PlotForeign( TIcker, "加權指數", colorGold, GetPriceStyle() );
  33. SetBarFillColor(IIf(TIckerC>TIckerO,colorPink,IIf(TIckerC<TIckerO,colorPaleGreen,colorLightGrey)));
  34. PlotOHLC(TIckerO,TIckerH,TIckerL,TIckerC,Ticker,IIf(TIckerC>TIckerO,colorRed,colorGreen),styleCandle|styleNoTitle,Null,Null,0,0);
  35. }





  36. _SECTION_END(); // End of Cell TEXT


  37. //RequestTimedRefresh(1);
  38. _SECTION_BEGIN("C1");
  39. if (StaticVarGetText("TXON_Text")=="")
  40. {
  41. StaticVarSetText("TXON_Text",Name()+" K關 ");
  42. }


  43. if (StaticVarGetText("TIckerON_Text")=="")
  44. {
  45. StaticVarSetText("TIckerON_Text",Ticker+" K關 ") ;
  46. }

  47. ButtonHeight1 = Param("C1 Button Height",20,5,200,1);
  48. ButtonWidth1 = Param("C1 Button Width",120,5,200,1);
  49. FontRatio1 = Param("C1 Font: ButtonHeight ratio",2,0.5,5,0.1);
  50. // Column Position Setting
  51. PanelXoffset =pxW-20;
  52. PanelYoffset =5;
  53. PositionStr="@ "+NumToStr(GetCursorXPosition(1),1.0,False)+","+NumToStr(GetCursorYPosition(1),1.0,False);
  54. ON_color=StaticVarGet("ON_color");
  55. if (StaticVarGet("XON"))
  56. {
  57. Say( "C 1 Position");

  58. if (ON_color == colorPaleGreen)
  59. {
  60. ON_color= colorPink;
  61. }
  62. else
  63. {
  64. ON_color= colorPaleGreen;
  65. }

  66. XLButtonDown = GetCursorMouseButtons() == 9;
  67. //PositionStr="@ "+NumToStr(GetCursorXPosition(1),1.0,False)+","+NumToStr(GetCursorYPosition(1),1.0,False);
  68. if( XLButtonDown )
  69. {
  70. StaticVarSet("C1_X", pxW-GetCursorXPosition(1));
  71. StaticVarSet("C1_Y", pxH-GetCursorYPosition(1));
  72. StaticVarSet("XON", 0);
  73. Say( "C 1 Position Set");
  74. ON_color= colorWhite;

  75. //PositionStr="@ "+NumToStr(GetCursorXPosition(1),1.0,False)+","+NumToStr(GetCursorYPosition(1),1.0,False);
  76. }
  77. StaticVarSet("ON_color", ON_color);
  78. }

  79. if (IsNull(StaticVarGet("C1_X")))
  80. {
  81. PanelXoffset =5;
  82. StaticVarSet("ON_color", colorGrey50);
  83. }
  84. else
  85. {
  86. PanelXoffset =pxW-StaticVarGet("C1_X");
  87. if (PanelXoffset <10)
  88. {
  89. PanelXoffset =10;
  90. }
  91. }

  92. if (IsNull(StaticVarGet("C1_Y")))
  93. {
  94. PanelYoffset =5;// Param("Button Row Offset (px)",60,0,600,1);
  95. StaticVarSet("ON_color", colorGrey50);
  96. }
  97. else
  98. {
  99. PanelYoffset =pxH-StaticVarGet("C1_Y");
  100. if (PanelYoffset<5)
  101. {
  102. PanelYoffset =5;
  103. }
  104. }


  105. ButtonHeight=ButtonHeight1;
  106. ButtonWidth=ButtonWidth1;
  107. FontRatio=FontRatio1;

  108. If(C[a]>O[a])
  109. {
  110. colorTX_B=colorGold;
  111. colorTX_T=colorDarkRed;
  112. }
  113. else
  114. {
  115. colorTX_B=colorTeal;
  116. colorTX_T=colorDarkGreen;
  117. }

  118. If(TIckerC[a]>TIckerO[a])
  119. {
  120. colorTicker_B=colorPink;
  121. colorTicker_T=colorDarkRed;
  122. }
  123. else
  124. {
  125. colorTicker_B=colorPaleGreen;
  126. colorTicker_T=colorDarkGreen;
  127. }
  128. If(C[a]-TIckerC[a]>0)
  129. {
  130. colorD=colorDarkRed;
  131. }
  132. else
  133. {
  134. colorD=colorDarkGreen;
  135. }

  136. ButtonColumnBegin("1", "微軟正黑體", FontRatio, ButtonHeight) ;
  137. ButtonHeader( "游標價格", colorDarkGreen, colorBrown,colorYellow);
  138. C102=ButtonTrigger("@ "+NumToStr(PanelXoffset,1.0,False)+","+NumToStr(PanelYoffset,1.0,False),ON_color, colorWhite , colorBlue);
  139. TXONSwitch=ButtonTrigger(StaticVarGetText("TXON_Text"), colorTX_B,colorSkyblue ,colorTX_T);
  140. TIckerONSwitch = ButtonTrigger( StaticVarGetText("TIckerON_Text"), colorTicker_B, colorSkyblue, colorTicker_T);
  141. ButtonText( "價差="+NumToStr(C[a]-TIckerC[a],1.0,False), colorLightYellow,colorD);
  142. ButtonColumnEnd(ButtonWidth1);

  143. ClickCoordinates = Nz(StaticVarGet("ClickCoordinates"));
  144. switch( ClickCoordinates )
  145. {
  146. case 101:
  147. Say( "Price at cursor");

  148. //StaticVarSet("C2_X", pxW-(PanelXoffset+ButtonWidth1*2));
  149. //StaticVarSet("C2_Y", pxH-PanelYoffset);
  150. //
  151. //StaticVarSet("C3_X", pxW-(PanelXoffset+ButtonWidth1*3));
  152. //StaticVarSet("C3_Y", pxH-PanelYoffset);

  153. break;
  154. case 102:
  155. if (C102)
  156. {
  157. if (StaticVarGet("XON"))
  158. {
  159. StaticVarSet("XON", 0);
  160. Say( "C 1 Position Set");
  161. }
  162. else
  163. {
  164. StaticVarSet("XON", 1);
  165. }
  166. }
  167. break;
  168. case 103:
  169. if (TXONSwitch && StaticVarGet("TXON"))
  170. {
  171. StaticVarSet("TXON", 0);
  172. StaticVarSetText("TXON_Text",Name()+" K關 ") ;
  173. }
  174. else
  175. {
  176. StaticVarSet("TXON", 1);
  177. StaticVarSetText("TXON_Text",Name()+"="+NumToStr(C[a],1.0,False));
  178. }
  179. Say(NumTostr(C,1.0,False));
  180. break;
  181. case 104:
  182. if (TIckerONSwitch && StaticVarGet("TIckerON"))
  183. {
  184. StaticVarSet("TIckerON", 0);
  185. StaticVarSetText("TIckerON_Text",Ticker+" K關 ") ;
  186. }
  187. else
  188. {
  189. StaticVarSet("TIckerON", 1);
  190. StaticVarSetText("TIckerON_Text",Ticker+"="+NumToStr(TIckerC[a],1.1,false));
  191. }
  192. Say(NumTostr(TIckerC,1.0,False));
  193. break;

  194. }

  195. _SECTION_END(); // End of C1

  196. _SECTION_BEGIN("C2");

  197. ButtonHeight2 = Param("C2 Button Height",20,5,200,1);
  198. ButtonWidth2 = Param("C2 Button Width",120,5,200,1);
  199. FontRatio2 = Param("C2 Font: ButtonHeight ratio",2,0.5,5,0.1);
  200. // Column Position Setting
  201. PanelXoffset =pxW-15;
  202. PanelYoffset =5;

  203. ON2_color=StaticVarGet("ON2_color");
  204. if (StaticVarGet("XON2"))
  205. {
  206. Say( "C 2 Position");

  207. if (ON2_color == colorPaleGreen)
  208. {
  209. ON2_color= colorPink;
  210. }
  211. else
  212. {
  213. ON2_color= colorPaleGreen;
  214. }

  215. XL2ButtonDown = GetCursorMouseButtons() == 9;
  216. if( XL2ButtonDown )
  217. {
  218. StaticVarSet("C2_X", pxW-GetCursorXPosition(1));
  219. StaticVarSet("C2_Y", pxH-GetCursorYPosition(1));
  220. StaticVarSet("XON2", 0);
  221. Say( "C 2 Position Set");
  222. ON2_color= colorWhite;
  223. //PositionStr="@ "+NumToStr(GetCursorXPosition(1),1.0,False)+","+NumToStr(GetCursorYPosition(1),1.0,False);
  224. }
  225. StaticVarSet("ON2_color", ON2_color);
  226. }

  227. if (IsNull(StaticVarGet("C2_X")))
  228. {
  229. PanelXoffset =ButtonWidth1;
  230. StaticVarSet("ON2_color", colorGrey50);
  231. }
  232. else
  233. {
  234. PanelXoffset =pxW-StaticVarGet("C2_X")-ButtonWidth2;
  235. if (PanelXoffset <10)
  236. {
  237. PanelXoffset =10;
  238. }
  239. }

  240. if (IsNull(StaticVarGet("C2_Y")))
  241. {
  242. PanelYoffset =ButtonHeight1;// Param("Button Row Offset (px)",60,0,600,1);
  243. StaticVarSet("ON2_color", colorGrey50);
  244. }
  245. else
  246. {
  247. PanelYoffset =pxH-StaticVarGet("C2_Y");
  248. if (PanelYoffset<5)
  249. {
  250. PanelYoffset =5;
  251. }
  252. }
  253. ButtonHeight=ButtonHeight2;
  254. ButtonWidth=ButtonWidth2;
  255. FontRatio=FontRatio2;

  256. ButtonColumnBegin("2", "微軟正黑體", FontRatio, ButtonHeight) ;
  257. ButtonHeader(Name()+" 高低價格", colorDarkGreen, colorBrown,colorYellow);
  258. C202=ButtonTrigger("@ "+NumToStr(PanelXoffset+ButtonWidth2,1.0,False)+","+NumToStr(PanelYoffset,1.0,False),ON2_color, colorWhite , colorBlue);
  259. ButtonText( "昨高 "+NumToStr(YesTH[BarCount-1],1.0,False), colorPink, colorDarkRed);
  260. ButtonText( "昨低 "+NumToStr(YesTL[BarCount-1],1.0,False), colorPaleGreen, colorDarkGreen);
  261. ButtonText( "今高 "+NumToStr(TodayH[BarCount-1],1.0,False), colorPink, colorDarkRed);
  262. ButtonText( "今低 "+NumToStr(TodayL[BarCount-1],1.0,False), colorPaleGreen, colorDarkGreen);

  263. ButtonColumnEnd(ButtonWidth2);

  264. ClickCoordinates = Nz(StaticVarGet("ClickCoordinates"));
  265. switch( ClickCoordinates )
  266. {
  267. case 201:
  268. Say( "NAME");
  269. break;
  270. case 202:
  271. if (C202)
  272. {
  273. if (StaticVarGet("XON2"))
  274. {
  275. StaticVarSet("XON2", 0);
  276. Say( "C 2 Position Set");
  277. }
  278. else
  279. {
  280. StaticVarSet("XON2", 1);
  281. }
  282. }
  283. break;

  284. }


  285. _SECTION_END(); // End of C2



  286. _SECTION_BEGIN("C3");
  287. ButtonHeight3 = Param("C3 Button Height",20,5,200,1);
  288. ButtonWidth3 = Param("C3 Button Width",120,5,200,1);
  289. FontRatio3 = Param("C3 Font: ButtonHeight ratio",2,0.5,5,0.1);
  290. // Column Position Setting
  291. PanelXoffset =pxW-10;
  292. PanelYoffset =5;

  293. ON3_color=StaticVarGet("ON3_color");
  294. if (StaticVarGet("XON3"))
  295. {
  296. Say( "C 3 Position");

  297. if (ON3_color == colorPaleGreen)
  298. {
  299. ON3_color= colorPink;
  300. }
  301. else
  302. {
  303. ON3_color= colorPaleGreen;
  304. }

  305. XL3ButtonDown = GetCursorMouseButtons() == 9;
  306. if( XL3ButtonDown )
  307. {
  308. StaticVarSet("C3_X", pxW-GetCursorXPosition(1));
  309. StaticVarSet("C3_Y", pxH-GetCursorYPosition(1));
  310. StaticVarSet("XON3", 0);
  311. Say( "C 3 Position Set");
  312. ON3_color= colorWhite;
  313. }
  314. StaticVarSet("ON3_color", ON3_color);
  315. }

  316. if (IsNull(StaticVarGet("C3_X")))
  317. {
  318. PanelXoffset =ButtonWidth1+ButtonWidth2;
  319. StaticVarSet("ON3_color", colorGrey50);
  320. }
  321. else
  322. {
  323. PanelXoffset =pxW-StaticVarGet("C3_X")-ButtonWidth3*2;
  324. if (PanelXoffset <10)
  325. {
  326. PanelXoffset =10;
  327. }
  328. }

  329. if (IsNull(StaticVarGet("C3_Y")))
  330. {
  331. PanelYoffset =ButtonHeight1+ButtonHeight2;// Param("Button Row Offset (px)",60,0,600,1);
  332. StaticVarSet("ON3_color", colorGrey50);
  333. }
  334. else
  335. {
  336. PanelYoffset =pxH-StaticVarGet("C3_Y");
  337. if (PanelYoffset<5)
  338. {
  339. PanelYoffset =5;
  340. }
  341. }
  342. ButtonHeight=ButtonHeight3;
  343. ButtonWidth=ButtonWidth3;
  344. FontRatio=FontRatio3;

  345. ButtonColumnBegin("3", "微軟正黑體", FontRatio, ButtonHeight) ;
  346. ButtonHeader(Ticker+" 高低價格", colorDarkGreen, colorBrown,colorYellow);
  347. C302=ButtonTrigger("@ "+NumToStr(PanelXoffset+ButtonWidth3*2,1.0,False)+","+NumToStr(PanelYoffset,1.0,False),ON3_color, colorWhite , colorBlue);
  348. ButtonText( "昨高 "+NumToStr(TYesTH[BarCount-1],1.0,False), colorPink, colorDarkRed);
  349. ButtonText( "昨低 "+NumToStr(TYesTL[BarCount-1],1.0,False), colorPaleGreen, colorDarkGreen);
  350. ButtonText( "今高 "+NumToStr(TTodayH[BarCount-1],1.0,False), colorPink, colorDarkRed);
  351. ButtonText( "今低 "+NumToStr(TTodayL[BarCount-1],1.0,False), colorPaleGreen, colorDarkGreen);
  352. ButtonColumnEnd(ButtonWidth3);

  353. ClickCoordinates = Nz(StaticVarGet("ClickCoordinates"));
  354. switch(ClickCoordinates)
  355. {
  356. case 301:
  357. Say( "Ticker");

  358. break;
  359. case 302:
  360. if (C302)
  361. {
  362. if (StaticVarGet("XON3"))
  363. {
  364. StaticVarSet("XON3", 0);
  365. Say( "C 3 Position Set");
  366. }
  367. else
  368. {
  369. StaticVarSet("XON3", 1);
  370. }
  371. }
  372. break;

  373. }


  374. _SECTION_END(); // End of C3

  375. //title=PositionStr;
複製代碼
ControlPanelInclude-003c.afl 要放置於  \Formulas\Include 下
  1. // ControlPanelInclude-003c.afl
  2. procedure kStaticVarSet(SName,SValue)
  3. {
  4. ChartID = GetChartID();
  5. InIndicator = Status("Action") == 1;
  6. if( InIndicator ) StaticVarSet(Sname+ChartID, Svalue);
  7. }

  8. function kStaticVarGet(SName)
  9. {
  10. ChartID = GetChartID();
  11. Var = StaticVarGet(Sname+ChartID);
  12. return Var;
  13. }

  14. procedure kStaticVarSetText(SName,SValue)
  15. {
  16. ChartID = GetChartID();
  17. InIndicator = Status("Action") == 1;
  18. if( InIndicator ) StaticVarSetText(Sname+ChartID, Svalue);
  19. }

  20. function kStaticVarGetText(SName)
  21. {
  22. ChartID = GetChartID();
  23. return StaticVarGetText(Sname+ChartID);
  24. }

  25. function NewColumn()
  26. {
  27. VarSet("ColNumber", 0);
  28. }

  29. function GetMouseClick(ColNumber, RowNumber)
  30. {
  31. global PanelYoffset, PanelXoffset, ButtonHeight, ButtonWidth;
  32. LButtonDown = GetCursorMouseButtons() == 9;
  33. Click = 0;
  34. if( LButtonDown )
  35. {
  36. TotalW=0;
  37. for(Col=0;Col<ColNumber;col++)
  38. {
  39. TotalW= Nz(kStaticVarGet("W"+Col))+TotalW;
  40. }
  41. W=Nz(kStaticVarGet("W"+ColNumber));
  42. ULButtonX = PanelXoffset + TotalW;
  43. LRButtonX = ULButtonX + W;
  44. //ULButtonX = PanelXoffset + (ColNumber-1) * ButtonWidth;
  45. //LRButtonX = ULButtonX + ButtonWidth;
  46. ULButtonY = (RowNumber -1) * ButtonHeight + PanelYoffset;
  47. LRButtonY = ULButtonY + ButtonHeight;
  48. MouseCoord = Nz(StaticVarGet("ClickCoordinates"));
  49. if( MouseCoord == 0 AND LButtonDown )
  50. {
  51. MousePx = GetCursorXPosition( 1 );
  52. MousePy = GetCursorYPosition( 1 );
  53. if( MousePx > ULButtonX AND MousePx < LRButtonX AND MousePy > ULButtonY AND MousePy < LRButtonY )
  54. {
  55. StaticVarSet("ClickCoordinates",ColNumber*100+RowNumber);
  56. Click = 1;
  57. }
  58. }
  59. }
  60. return Click;
  61. }

  62. function ButtonColumnBegin(ColName, FoneType, FontRatio, ButtonHeight)
  63. {
  64. //global ;
  65. global ColNumber,ColName;
  66. ColNumber = VarGet("ColNumber");
  67. if( IsEmpty(ColNumber) )
  68. {
  69. VarSet("ColNumber",1);
  70. StaticVarSet("ClickCoordinates",0);
  71. }
  72. else VarSet("ColNumber", ++ColNumber);
  73. ColName = ColName+GetChartID();
  74. kStaticVarSet("RowNumber"+ColName, 0);
  75. VarSetText("ColName",ColName);

  76. GfxSetOverlayMode( 0 );
  77. //GfxSelectFont( "Tahoma", ButtonHeight/FontRatio, 800 );
  78. GfxSelectFont( FoneType, ButtonHeight/FontRatio,700 );
  79. GfxSelectPen( colorBlack );
  80. GfxSetBkMode( 1 );
  81. }

  82. function ButtonText( TextButton, backColor, TextColor)
  83. {
  84. global ColNumber, RowNumber, Colname;
  85. ColExpanded = Nz(kStaticVarGet(ColName+"ColExpanded"));
  86. if( ColExpanded )
  87. {
  88. ColName = VarGetText("ColName");
  89. RowNumber = Nz(kStaticVarGet("RowNumber"+ColName))+1;
  90. kStaticVarSet("RowNumber"+ColName, RowNumber);
  91. kStaticVarSetText("TextButton"+ColName+RowNumber, TextButton);
  92. kStaticVarSet("TextColor"+ColName+RowNumber, TextColor);
  93. kStaticVarSet("BackColor"+ColName+RowNumber, backColor);
  94. }
  95. }

  96. function ButtonHeader( Label, backColor1, BackColor2, TextColor)
  97. {
  98. global ColNumber, RowNumber, ColExpanded, Colname;
  99. RowNumber = Nz(kStaticVarGet("RowNumber"+ColName))+1;
  100. kStaticVarSet("RowNumber"+ColName, RowNumber);
  101. Trigger = GetMouseClick( ColNumber, RowNumber );
  102. if( Trigger )
  103. {
  104. ColExpanded = Nz(kStaticVarGet(ColName+"ColExpanded"));
  105. if(ColExpanded)
  106. {
  107. BackColor = backColor2;
  108. kStaticVarSet(ColName+"ColExpanded", False);
  109. }
  110. else
  111. {
  112. BackColor = backColor1;
  113. kStaticVarSet(ColName+"ColExpanded", True);
  114. }
  115. }
  116. else
  117. {
  118. if(Nz(kStaticVarGet(ColName+"ColExpanded")))
  119. {
  120. BackColor = backColor2;
  121. }
  122. else
  123. {
  124. BackColor = backColor1;
  125. }
  126. }
  127. ColExpanded = Nz(kStaticVarGet(ColName+"ColExpanded"));
  128. kStaticVarSetText("TextButton"+ColName+RowNumber, Label);
  129. kStaticVarSet("TextColor"+ColName+RowNumber, TextColor);
  130. kStaticVarSet("BackColor"+ColName+RowNumber, backColor);
  131. }

  132. function ButtonTrigger(Label, backColor1, BackColor2, TextColor)
  133. {
  134. global ColNumber, RowNumber, ColName;
  135. ColExpanded = Nz(kStaticVarGet(ColName+"ColExpanded"));
  136. if( ColExpanded )
  137. {
  138. ColName = VarGetText("ColName");
  139. RowNumber = Nz(kStaticVarGet("RowNumber"+ColName))+1;
  140. kStaticVarSet("RowNumber"+ColName, RowNumber);
  141. Trigger = GetMouseClick( ColNumber, RowNumber );
  142. if( Trigger )
  143. {
  144. BackColor = backColor2;
  145. }
  146. else
  147. {
  148. BackColor = backColor1;
  149. }
  150. kStaticVarSetText("TextButton"+ColName+RowNumber, Label);
  151. kStaticVarSet("TextColor"+ColName+RowNumber, TextColor);
  152. kStaticVarSet("BackColor"+ColName+RowNumber, backColor);
  153. }
  154. else Trigger = 0;
  155. return Trigger;
  156. }

  157. // Final drawing of the column
  158. function ButtonColumnEnd(W)
  159. {
  160. global ButtonHeight, PanelYoffset, PanelXoffset, ColNumber, RowNumber, ColName;//, ButtonWidth
  161. ChartIDStr = NumToStr(GetChartID(),1.0,False);

  162. TotalW=0;
  163. for(Col=0;Col<ColNumber;col++)
  164. {
  165. TotalW= Nz(kStaticVarGet("W"+Col))+TotalW;
  166. }

  167. ULButtonX = PanelXoffset + TotalW;
  168. kStaticVarSet("W"+ColNumber, W);
  169. LRButtonX = ULButtonX + W;

  170. //ULButtonX = PanelXoffset + (ColNumber-1) * ButtonWidth;
  171. //LRButtonX = ULButtonX + ButtonWidth;
  172. for( Row = 1; Row <= RowNumber; Row++ )
  173. {
  174. ULButtonY = (Row-1) * ButtonHeight + PanelYoffset;
  175. LRButtonY = ULButtonY + ButtonHeight;
  176. Label = kStaticVarGetText("TextButton"+ColName+Row);
  177. TextColor = Nz(kStaticVarGet("TextColor"+ColName+Row));
  178. BackColor = Nz(kStaticVarGet("BackColor"+ColName+Row));
  179. //GfxSelectSolidBrush( BackColor);
  180. //GfxRectangle(ULButtonX, ULButtonY, LRButtonX, LRButtonY );
  181. //GfxSetBkColor( BackColor);
  182. GfxGradientRect(ULButtonX, ULButtonY, LRButtonX, LRButtonY,colorBlend(BackColor, colorWhite,0.1), colorBlend(BackColor, colorBlack,0.3));
  183. GfxSetTextColor( TextColor );
  184. //GfxSelectFont( "微軟正黑體", abs(ULButtonY-LRButtonY)/FontRatio,700 );
  185. GfxDrawText( Label, ULButtonX, ULButtonY, LRButtonX, LRButtonY, 32 | 1 | 4);
  186. }

  187. }


複製代碼


B.png

欄位移動 要先按 @x,y 列
之後按要移動的位置


評分

參與人數 2金錢 +7 收起 理由
kilroy + 5 太強了
仔仔 + 2 太強了

查看全部評分

發表於 13-3-22 23:02 | 顯示全部樓層
謝謝分享

請問要怎麼弄才不會亂碼?
發表於 13-3-23 01:27 | 顯示全部樓層
大大寫 AFL 的功力真的是很讚~

有機會再多跟您請教一下
發表於 13-3-23 04:59 | 顯示全部樓層
CalvinHornG

there is one error in your code

Replace
  1. Ticker = ParamStr("Symbol","TSEIDX");
  2. TIckerO = Foreign(Ticker, "O");
  3. TIckerH = Foreign(Ticker, "H");
  4. TIckerL = Foreign(Ticker, "L");
  5. TIckerC = Foreign(Ticker, "C");

  6. TYesTH =TimeFrameGetPrice("TickerH",inDaily,-1);
  7. TYesTL =TimeFrameGetPrice("TickerL",inDaily,-1);
  8. TTodayH=TimeFrameGetPrice("TickerH",inDaily,0);
  9. TTodayL=TimeFrameGetPrice("TickerL",inDaily,0);
  10. TTodayO=TimeFrameGetPrice("TickerO",inDaily,0);
複製代碼
with
  1. Ticker = ParamStr( "Symbol", "TSEIDX" );
  2. SetForeign(Ticker);
  3. TIckerO = O;
  4. TIckerH = H;
  5. TIckerL = L;
  6. TIckerC = C;

  7. TYesTH = TimeFrameGetPrice( "H", inDaily, -1 );
  8. TYesTL = TimeFrameGetPrice( "L", inDaily, -1 );
  9. TTodayH = TimeFrameGetPrice( "H", inDaily, 0 );
  10. TTodayL = TimeFrameGetPrice( "L", inDaily, 0 );
  11. TTodayO = TimeFrameGetPrice( "O", inDaily, 0 );
  12. RestorePriceArrays();
複製代碼
 樓主| 發表於 13-3-23 06:40 | 顯示全部樓層
joshsmi 發表於 13-3-23 04:59
CalvinHornG

there is one error in your code

THANK YOU VERY MUCH
YES YOU ARE RIGHT
I JUST FOCUS ON THE TEXT
發表於 13-3-23 10:55 | 顯示全部樓層
非常不錯的程式,很實用,可以用來學習及看盤,版大的程式功力很強,以後要多向大版請益!!
發表於 13-3-23 20:55 | 顯示全部樓層
感謝分享
盡力學習中
發表於 17-8-11 16:14 | 顯示全部樓層
感謝版主的分享,謝謝
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-11-22 14:34

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 |