设为首页收藏本站

『外汇堂』·专业外汇论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 5225|回复: 5
打印 上一主题 下一主题

一个改进的Comment函数

[复制链接]
跳转到指定楼层
1#
发表于 2009-1-2 16:01:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
一个改进的Comment函数
这个函数是我在论坛上看到的,这个函数主要作用是在图表上输出多行的Comment(注释),觉得挺有用,所以和大家分享一下:
//Determines how many of your previous comments are shown
extern int MaxCommentsToShow=25;
//An array to hold all of the comments
string allcomments[];

//+------------------------------------------------------------------+
//|              Manage comments - Written by imt4        |
//|                            www.imt4.com                            |
//+------------------------------------------------------------------+
void managecomments(string addcomment)
   {
   string tempcomments[];
   int commentscroll;
   string output;
   int CommentCount = ArrayRange(allcomments, 0);
   if(CommentCount<MaxCommentsToShow)
      {
      ArrayResize(tempcomments,CommentCount+1);
      ArrayCopy(tempcomments,allcomments,1,0,WHOLE_ARRAY);
      }
   else
      {
      ArrayResize(tempcomments,MaxCommentsToShow);
      ArrayCopy(tempcomments,allcomments,1,0,MaxCommentsToShow-1);
      }   
   tempcomments[0]=addcomment;
   CommentCount = ArrayRange(tempcomments, 0);
   ArrayResize(allcomments,CommentCount);
   ArrayCopy(allcomments,tempcomments,0,0,CommentCount);

   for(commentscroll=0;commentscroll<CommentCount;commentscroll++)
      {
      output = output + allcomments[commentscroll] +"\n";
      }   
   Comment(output);
   }




[ 本帖最后由 wyhtt777 于 2009-1-9 09:49 编辑 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播
2#
 楼主| 发表于 2009-1-2 16:03:34 | 只看该作者
忘了告诉大家怎么用了


那么怎么用呢?很简单,直接调用行了:

帮我顶吧。。。自己做个沙发~
3#
发表于 2009-1-5 10:34:09 | 只看该作者
沙发,帮ding
4#
 楼主| 发表于 2009-1-9 09:48:24 | 只看该作者

回复 4# 的帖子

4楼不会是做烧烤的吧?
5#
发表于 2009-1-9 16:07:18 | 只看该作者
恩 很有用
感谢楼主分享
6#
发表于 2009-1-10 07:35:11 | 只看该作者
听起来不错啊. 你们谁给来个截图看看?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|外汇堂·专业外汇论坛    

GMT+8, 2024-4-26 07:12 , Processed in 0.149971 second(s), 25 queries .

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表