<small id='OQ0YB'></small><noframes id='OQ0YB'>

    • <bdo id='OQ0YB'></bdo><ul id='OQ0YB'></ul>
  • <tfoot id='OQ0YB'></tfoot>
      <legend id='OQ0YB'><style id='OQ0YB'><dir id='OQ0YB'><q id='OQ0YB'></q></dir></style></legend>
      1. <i id='OQ0YB'><tr id='OQ0YB'><dt id='OQ0YB'><q id='OQ0YB'><span id='OQ0YB'><b id='OQ0YB'><form id='OQ0YB'><ins id='OQ0YB'></ins><ul id='OQ0YB'></ul><sub id='OQ0YB'></sub></form><legend id='OQ0YB'></legend><bdo id='OQ0YB'><pre id='OQ0YB'><center id='OQ0YB'></center></pre></bdo></b><th id='OQ0YB'></th></span></q></dt></tr></i><div id='OQ0YB'><tfoot id='OQ0YB'></tfoot><dl id='OQ0YB'><fieldset id='OQ0YB'></fieldset></dl></div>
      2. 迭代结构;在 RichEdit 框中轻松显示结构字段和值

        Iterate Over Struct; Easily Display Struct Fields And Values In a RichEdit Box(迭代结构;在 RichEdit 框中轻松显示结构字段和值)

        1. <legend id='45BHb'><style id='45BHb'><dir id='45BHb'><q id='45BHb'></q></dir></style></legend>

            <small id='45BHb'></small><noframes id='45BHb'>

              <bdo id='45BHb'></bdo><ul id='45BHb'></ul>
                <tbody id='45BHb'></tbody>

              <tfoot id='45BHb'></tfoot>

                <i id='45BHb'><tr id='45BHb'><dt id='45BHb'><q id='45BHb'><span id='45BHb'><b id='45BHb'><form id='45BHb'><ins id='45BHb'></ins><ul id='45BHb'></ul><sub id='45BHb'></sub></form><legend id='45BHb'></legend><bdo id='45BHb'><pre id='45BHb'><center id='45BHb'></center></pre></bdo></b><th id='45BHb'></th></span></q></dt></tr></i><div id='45BHb'><tfoot id='45BHb'></tfoot><dl id='45BHb'><fieldset id='45BHb'></fieldset></dl></div>
                  本文介绍了迭代结构;在 RichEdit 框中轻松显示结构字段和值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否有更简单的方法来显示 RichEdit 控件中的 struct 字段及其对应的值?

                  Is there an easier way to display the struct fields and their corresponding values in RichEdit control?

                  这就是我现在正在做的:

                  This is what I am doing now:

                  AnsiString s;
                  
                  s = IntToStr(wfc.fontColor);
                  RichEdit1->Lines->Append(s);
                  

                  等等...

                  有没有比单独呼叫每个人更简单的方法?我想读取一个二进制文件,然后在 RichEdit 控件中为我正在构建的一个小实用程序显示相应的结构,但没有找到其他方法.我已经知道如何读取二进制文件并将值读入 struct.

                  Is there an easier way than having to individually call each one? I want to read a binary file and then display the corresponding structure in a RichEdit control for a small utility I am building and have found no other way. I know how to read binary files and read the values into the struct already.

                  推荐答案

                  BOOST_FUSION_ADAPT_STRUCT 似乎很适合这里.例如:

                  BOOST_FUSION_ADAPT_STRUCT seems to fit well here. For example:

                  // Your existing struct
                  struct Foo
                  {
                      int i;
                      bool j;
                      char k[100];
                  };
                  
                  // Generate an adapter allowing to view "Foo" as a Boost.Fusion sequence
                  BOOST_FUSION_ADAPT_STRUCT(
                      Foo,
                      (int, i)
                      (bool, j)
                      (char, k[100])
                  )
                  
                  // The action we will call on each member of Foo
                  struct AppendToTextBox
                  {
                      AppendToTextBox(RichEditControl& Ctrl) : m_Ctrl(Ctrl){}
                  
                      template<typename T>
                      void operator()(T& t)const
                      {
                  
                          m_Ctrl.Lines.Append(boost::lexical_cast<std::string>(t));
                      }
                  
                      RichEditControl& m_Ctrl;
                  
                  };
                  
                  // Usage:
                  void FillTextBox(Foo& F, RichEditControl& Ctrl)
                  {
                      boost::fusion::for_each(F, AppendToTextBox(Ctrl));
                  }
                  

                  这篇关于迭代结构;在 RichEdit 框中轻松显示结构字段和值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)
                  Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)
                  STL BigInt class implementation(STL BigInt 类实现)
                  Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)
                  Move list element to the end in STL(在 STL 中将列表元素移动到末尾)
                  Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)
                    <tbody id='U2a6G'></tbody>
                  <i id='U2a6G'><tr id='U2a6G'><dt id='U2a6G'><q id='U2a6G'><span id='U2a6G'><b id='U2a6G'><form id='U2a6G'><ins id='U2a6G'></ins><ul id='U2a6G'></ul><sub id='U2a6G'></sub></form><legend id='U2a6G'></legend><bdo id='U2a6G'><pre id='U2a6G'><center id='U2a6G'></center></pre></bdo></b><th id='U2a6G'></th></span></q></dt></tr></i><div id='U2a6G'><tfoot id='U2a6G'></tfoot><dl id='U2a6G'><fieldset id='U2a6G'></fieldset></dl></div>
                    <bdo id='U2a6G'></bdo><ul id='U2a6G'></ul>
                    <legend id='U2a6G'><style id='U2a6G'><dir id='U2a6G'><q id='U2a6G'></q></dir></style></legend>

                      • <small id='U2a6G'></small><noframes id='U2a6G'>

                        <tfoot id='U2a6G'></tfoot>