您的位置:程序门 -> c++ builder ->



动态画图怎样实现图形连续


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


动态画图怎样实现图形连续[已结贴,结贴人:xing20xiangzi]
发表于:2007-09-19 10:45:02 楼主
我要从串口接收两串数据(aaaabbbbaaaabbbb...),然后将这些数据分别通过两个条行图显示出来
条形图是在paintbox画的
怎样使图形变化起来连贯一点呢,不要求实时?
还有就是为什么显示一个图形时,另一个就消失了呢

tform1::timertimer(tobject   *sender)
{if(mod==1){                      
                  paintbox1-> refresh();      
                paintbox1-> canvas-> textouta(48,k-10,floattostr(roundto(j,-2)));
                paintbox1-> canvas-> brush-> color=clnavy;
                paintbox1-> canvas-> fillrect(rect(27,318,42,k));
              }
              else   if(mod==2){              
               
                paintbox2-> refresh();
                paintbox2-> canvas-> textouta(48,i-10,floattostr(roundto(j,-2)));
                paintbox2-> canvas-> brush-> color=clnavy;
                paintbox2-> canvas-> fillrect(rect(27,318,42,i));
              }
}
发表于:2007-09-19 12:13:451楼 得分:0
        这些画的动作应该放在pointbox.onpaint事件中,timertimer中用pointbox1-> invalidate()即可。2个图形数据不管更新与否,都应该画,否则就会“显示一个图形时,另一个就消失了”
发表于:2007-09-19 12:17:542楼 得分:15
更正:画的动作应该放在paintbox1和paintbox2各自的onpaint事件中,timertimer中用paintbox1-   > invalidate();paintbox2-   > invalidate();即可。onpaint中不要有refresh()调用
发表于:2007-09-19 14:28:573楼 得分:5
summary

a   sequence   that   supports   random   access   iterators.

synopsis

#include   <vector>
template   <class   t,   class   allocator   =   allocator <t>   >
class   vector   ;

description

vector <t,   allocator>   is   a   type   of   sequence   that   supports   random   access   iterators.   in   addition,   it   supports   amortized   constant   time   insert   and   erase   operations   at   the   end.   insert   and   erase   in   the   middle   take   linear   time.   storage   management   is   handled   automatically.   in   vector,   iterator   is   a   random   access   iterator   referring   to   t.   const_iterator   is   a   constant   random   access   iterator   that   returns   a   const   t&   when   dereferenced.   a   constructor   for   iterator   and   const_iterator   is   guaranteed.   size_type   is   an   unsigned   integral   type.   difference_type   is   a   signed   integral   type.  

any   type   used   for   the   template   parameter   t   must   provide   the   following   (where   t   is   the   type,   t   is   a   value   of   t   and   u   is   a   const   value   of   t):

    copy   constructors           t(t)   and   t(u)
    destructor                         t.~t()
    address   of                         &t   and   &u   yielding   t*   and   const   t*
                                                respectively
    assignment                         t   =   a   where   a   is   a
                                                (possibly   const)   value   of   t

special   case

vectors   of   bit   values,   that   is   boolean   1/0   values,   are   handled   as   a   special   case   by   the   standard   library,   so   that   they   can   be   efficiently   packed   several   elements   to   a   word.   the   operations   for   a   boolean   vector,   vector <bool> ,   are   a   superset   of   those   for   an   ordinary   vector,   only   the   implementation   is   more   efficient.

two   member   functions   are   available   to   the   boolean   vector   data   type.   one   is   flip(),   which   inverts   all   the   bits   of   the   vector.   boolean   vectors   also   return   as   reference   an   internal   value   that   also   supports   the   flip()   member   function.   the   other   vector <bool> -specific   member   function   is   a   second   form   of   the   swap()   function

interface

template   <class   t,   class   allocator   =   allocator <t>   >
class   vector   {
public:
//   types
typedef   t   value_type;
typedef   allocator   allocator_type;
typedef   typename   allocator::reference   reference;
typedef   typename   allocator::const_reference   const_reference;  
class   iterator;
class   const_iterator;
typedef   typename   allocator::size_type   size_type;
typedef   typename   allocator::difference_type   difference_type;
typedef   typename   std::reverse_iterator <iterator>
                                  reverse_iterator;

typedef   typename   std::reverse_iterator <const   iterator>
                                  const_reverse_iterator;
//   construct/copy/destroy
explicit   vector   (const   allocator&   =   allocator());
explicit   vector   (size_type,   const   allocator&   =   allocator   ());
vector   (size_type,   const   t&,   const   allocator&   =   allocator());
vector   (const   vector <t,   allocator> &);
template   <class   inputiterator>
vector   (inputiterator,   inputiterator,  
const   allocator&   =   allocator   ());
~vector   ();
vector <t,allocator> &   operator=   (const   vector <t,   allocator> &);

template   <class   inputiterator>
void   assign   (inputiterator   first,   inputiterator   last);
void   assign   (size_type,   const);
allocator_type   get_allocator   ()   const;
//   iterators
iterator   begin   ();
const_iterator   begin   ()   const;
iterator   end   ();
const_iterator   end   ()   const;
reverse_iterator   rbegin   ();
const_reverse_iterator   rbegin   ()   const;
reverse_iterator   rend   ();
const_reverse_iterator   rend   ()   const;
//   capacity
size_type   size   ()   const;
size_type   max_size   ()   const;

void   resize   (size_type);
void   resize   (size_type,   t);
size_type   capacity   ()   const;
bool   empty   ()   const;
void   reserve   (size_type);
//   element   access
reference   operator[]   (size_type);
const_reference   operator[]   (size_type)   const;
reference   at   (size_type);
const_reference   at   (size_type)   const;
reference   front   ();
const_reference   front   ()   const;
reference   back   ();
const_reference   back   ()   const;
//   modifiers
void   push_back   (const   t&);
void   pop_back   ();
iterator   insert   (iterator,   const   t&);

void   insert   (iterator,   size_type,   const   t&);
template   <class   inputiterator>
void   insert   (iterator,   inputiterator,   inputiterator);
iterator   erase   (iterator);
iterator   erase   (iterator,   iterator);
void   swap   (vector <t,   allocator> &);
void   clear()
};
//   non-member   operators
template   <class   t>
bool   operator==   (const   vector <t,allocator> &,  
const   vector   <t,allocator> &);
template   <class   t>
bool   operator!=   (const   vector <t,allocator> &,  
const   vector   <t,allocator> &);
template   <class   t>

bool   operator <   (const   vector <t,allocator> &,  
const   vector <t,allocator> &);
template   <class   t>
bool   operator>   (const   vector <t,allocator> &,  
const   vector <t,allocator> &);
template   <class   t>
bool   operator <=   (const   vector <t,allocator> &,  
const   vector <t,allocator> &);
发表于:2007-09-19 14:29:144楼 得分:0
summary

a   sequence   that   supports   random   access   iterators.

synopsis

#include   <vector>
template   <class   t,   class   allocator   =   allocator <t>   >
class   vector   ;

description

vector <t,   allocator>   is   a   type   of   sequence   that   supports   random   access   iterators.   in   addition,   it   supports   amortized   constant   time   insert   and   erase   operations   at   the   end.   insert   and   erase   in   the   middle   take   linear   time.   storage   management   is   handled   automatically.   in   vector,   iterator   is   a   random   access   iterator   referring   to   t.   const_iterator   is   a   constant   random   access   iterator   that   returns   a   const   t&   when   dereferenced.   a   constructor   for   iterator   and   const_iterator   is   guaranteed.   size_type   is   an   unsigned   integral   type.   difference_type   is   a   signed   integral   type.  

any   type   used   for   the   template   parameter   t   must   provide   the   following   (where   t   is   the   type,   t   is   a   value   of   t   and   u   is   a   const   value   of   t):

    copy   constructors           t(t)   and   t(u)
    destructor                         t.~t()
    address   of                         &t   and   &u   yielding   t*   and   const   t*
                                                respectively
    assignment                         t   =   a   where   a   is   a
                                                (possibly   const)   value   of   t

special   case

vectors   of   bit   values,   that   is   boolean   1/0   values,   are   handled   as   a   special   case   by   the   standard   library,   so   that   they   can   be   efficiently   packed   several   elements   to   a   word.   the   operations   for   a   boolean   vector,   vector <bool> ,   are   a   superset   of   those   for   an   ordinary   vector,   only   the   implementation   is   more   efficient.

two   member   functions   are   available   to   the   boolean   vector   data   type.   one   is   flip(),   which   inverts   all   the   bits   of   the   vector.   boolean   vectors   also   return   as   reference   an   internal   value   that   also   supports   the   flip()   member   function.   the   other   vector <bool> -specific   member   function   is   a   second   form   of   the   swap()   function

interface

template   <class   t,   class   allocator   =   allocator <t>   >
class   vector   {
public:
//   types
typedef   t   value_type;
typedef   allocator   allocator_type;
typedef   typename   allocator::reference   reference;
typedef   typename   allocator::const_reference   const_reference;  
class   iterator;
class   const_iterator;
typedef   typename   allocator::size_type   size_type;
typedef   typename   allocator::difference_type   difference_type;
typedef   typename   std::reverse_iterator <iterator>
                                  reverse_iterator;

typedef   typename   std::reverse_iterator <const   iterator>
                                  const_reverse_iterator;
//   construct/copy/destroy
explicit   vector   (const   allocator&   =   allocator());
explicit   vector   (size_type,   const   allocator&   =   allocator   ());
vector   (size_type,   const   t&,   const   allocator&   =   allocator());
vector   (const   vector <t,   allocator> &);
template   <class   inputiterator>
vector   (inputiterator,   inputiterator,  
const   allocator&   =   allocator   ());
~vector   ();
vector <t,allocator> &   operator=   (const   vector <t,   allocator> &);

template   <class   inputiterator>
void   assign   (inputiterator   first,   inputiterator   last);
void   assign   (size_type,   const);
allocator_type   get_allocator   ()   const;
//   iterators
iterator   begin   ();
const_iterator   begin   ()   const;
iterator   end   ();
const_iterator   end   ()   const;
reverse_iterator   rbegin   ();
const_reverse_iterator   rbegin   ()   const;
reverse_iterator   rend   ();
const_reverse_iterator   rend   ()   const;
//   capacity
size_type   size   ()   const;
size_type   max_size   ()   const;

void   resize   (size_type);
void   resize   (size_type,   t);
size_type   capacity   ()   const;
bool   empty   ()   const;
void   reserve   (size_type);
//   element   access
reference   operator[]   (size_type);
const_reference   operator[]   (size_type)   const;
reference   at   (size_type);
const_reference   at   (size_type)   const;
reference   front   ();
const_reference   front   ()   const;
reference   back   ();
const_reference   back   ()   const;
//   modifiers
void   push_back   (const   t&);
void   pop_back   ();
iterator   insert   (iterator,   const   t&);

void   insert   (iterator,   size_type,   const   t&);
template   <class   inputiterator>
void   insert   (iterator,   inputiterator,   inputiterator);
iterator   erase   (iterator);
iterator   erase   (iterator,   iterator);
void   swap   (vector <t,   allocator> &);
void   clear()
};
//   non-member   operators
template   <class   t>
bool   operator==   (const   vector <t,allocator> &,  
const   vector   <t,allocator> &);
template   <class   t>
bool   operator!=   (const   vector <t,allocator> &,  
const   vector   <t,allocator> &);
template   <class   t>

bool   operator <   (const   vector <t,allocator> &,  
const   vector <t,allocator> &);
template   <class   t>
bool   operator>   (const   vector <t,allocator> &,  
const   vector <t,allocator> &);
template   <class   t>
bool   operator <=   (const   vector <t,allocator> &,  
const   vector <t,allocator> &);
发表于:2007-09-19 14:30:035楼 得分:0
用tchart更好。


快速检索

最新资讯
热门点击