component to string

string to component

StringToComponent

ComponentToString

ObjectTextToBinary

ObjectBinaryToText

ReadComponent

RegisterClass

WriteComponentResFile

ReadComponentResFile

#include <memory>       //For STL auto_ptr class

class MyScrollBar : public TScrollBar
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall MyScrollBar(TComponent* Owner);
}; __fastcall MyScrollBar::MyScrollBar(TComponent* Owner)
: TScrollBar(Owner)
{
} void RegisterClassesWithStreamingSystem(void)
{
// Make sure that, as part of the startup
// code, the streaming classes are registered
// with the streaming system. #pragma startup RegisterClassesWithStreamingSystem Classes::RegisterClass(__classid(MyScrollBar));
} MyScrollBar *ScrollBar1; String __fastcall ComponentToString(TComponent *c)
{
String as;
std::auto_ptr<TMemoryStream> pms(new TMemoryStream);
std::auto_ptr<TStringStream> pss(new TStringStream(as)); try
{
pms->WriteComponent(c);
pms->Seek(, soFromBeginning);
ObjectBinaryToText(pms.get(), pss.get());
pss->Seek(, soFromBeginning);
as = pss->DataString;
}
catch(...)
{
ShowMessage("Streaming error.");
} return as;
} void __fastcall TForm1::Button1Click(TObject *Sender)
{
Memo1->Text = ComponentToString(ScrollBar1);
} TComponent *__fastcall StringToComponent(String as) {
std::auto_ptr<TMemoryStream> pms(new TMemoryStream);
std::auto_ptr<TStringStream> pss(new TStringStream(as));
TComponent *pc; try
{
ObjectTextToBinary(pss.get(), pms.get());
pms->Seek(, soFromBeginning);
}
catch(...)
{
ShowMessage("Streaming error.");
} pc = pms->ReadComponent(NULL);
return pc;
} void __fastcall TForm1::Button2Click(TObject *Sender)
{
TComponent *temp = StringToComponent(Memo1->Text);
ScrollBar1->Free(); ScrollBar1 = dynamic_cast<MyScrollBar *>(temp);
ScrollBar1->Parent = Form1;
ScrollBar1->Visible = TRUE;
} __fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
ScrollBar1 = new MyScrollBar(Form1); // Form1 will clean up the scroll bar.
ScrollBar1->Parent = Form1;
ScrollBar1->Visible = TRUE;
ScrollBar1->Top = ;
ScrollBar1->Left = ;
ScrollBar1->Name = "Ricksbar";
}

RegisterClass(TPersistentClass(aFrom.ClassType));

UnRegisterClass(TPersistentClass(aFrom.ClassType));

dwscript,paxcompiler 支持pas格式的语法

RegisterComponentEditor

http://blog.csdn.net/henreash/article/details/7371897

属性编辑器

http://www.rgzz.sdedu.net/ebook/hdbook/computer/bc/DELPHIzhuanti/rmjq/028.htm

component to string的更多相关文章

  1. component to string 自定义窗体

    component to string string to component StringToComponent ComponentToString ObjectTextToBinary Objec ...

  2. TComponent与String的转换(得到控件的DFM格式的描述)

    现看下面这两个方法,把一个TComponent做成String,再就是把String转成TComponent function ComponentToStringProc(Component: TCo ...

  3. Spring Framework 组件注册 之 @Component

    Spring Framework 组件注册 之 @Component 写在前面 在spring大行其道的今天,对于spring的使用和掌握乃是不可缺少的必备技能.但是spring的整个体系尤为庞大,对 ...

  4. React源码 React.Component

    React中最重要的就是组件,写的更多的组件都是继承至 React.Component .大部分同学可能都会认为 Component 这个base class 给我们提供了各种各样的功能.他帮助我们去 ...

  5. [php]laravel框架容器管理的一些要点

    本文面向php语言的laravel框架的用户,介绍一些laravel框架里面容器管理方面的使用要点.文章很长,但是内容应该很有用,希望有需要的朋友能看到.php经验有限,不到位的地方,欢迎帮忙指正. ...

  6. 通过中看不中用的代码分析Ioc容器,依赖注入....

    /** * 通过生产拥有超能力的超人实例 来理解IOC容器 */ //超能力模组接口 interface SuperModuleInterface{ public function activate( ...

  7. 【腾讯Bugly干货分享】打造“微信小程序”组件化开发框架

    本文来自于腾讯Bugly公众号(weixinBugly),未经作者同意,请勿转载,原文地址:http://mp.weixin.qq.com/s/2nQzsuqq7Avgs8wsRizUhw 作者:Gc ...

  8. C#设计模式之工厂

    IronMan之工厂 前言 实用为主,学一些用得到的技术更能在如今的社会里保命. 虽然在日常的工作中设计模式不是经常的用到,但是呢,学习它只有好处没有坏处. 设计模式像是一种“标签”,它是代码编写者思 ...

  9. C#设计模式系列:组合模式(Composite)

    1.组合模式简介 1.1>.定义 组合模式主要用来处理一类具有“容器特征”的对象——即它们在充当对象的同时,又可以作为容器包含其他多个对象. 1.2>.使用频率 中高 2.组合模式结构图 ...

随机推荐

  1. Evaluate Reverse Polish Notation(堆栈)

    Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, ...

  2. ajaxFileUpload插件上传文件 返回 syntaxError :unexpected token

    Html 代码<table id="deploy_application" class="bordered-table"> <tr> & ...

  3. ASP.NET 4.0 Webform Bundles 压缩css, js,为什么放到服务器不行

    参考文章: http://blog.csdn.net/dyllove98/article/details/8758149 文章说的很详细. 但是本地是可以完美展示(我的本地环境有4.0 也有4.5) ...

  4. Couchbase的web管理员后台 查看缓存提示警告 Warning: Editing of document with size more than 2.5kb is not allowed的解决方法

    这个警告仅仅只会发生在web管理员后台,实际在缓存中的数据是不会有影响的(好像默认单个key对应的缓存大小是20M) 但是有时候我们就是想在web后台里面看看到底保存了什么数据,怎么能突破这个限制呢? ...

  5. BZOJ 1984 月下“毛景树”

    我觉得我要把BZOJ上的链剖写完了吧.... #include<iostream> #include<cstdio> #include<cstring> #incl ...

  6. XmlElement可以避免由XmlSerializer多余生成的代码

    public class Program { static void Main(string[] args) { var alarm = new Alarm() { Code = "1588 ...

  7. 配置Linux 11G R2 RAC NTP服务

    安装Oracle 11g RAC时,我们需要配置ntp服务.在使用虚拟机的情况下对于时钟同步方式的配置有很多种方式,可以使用vmware自带的时钟同步功能,也可以直接将本地的一个节点用作时间服务器.本 ...

  8. background-size background-positon合并的写法

    background:url('../../image/banner/banner1.jpg') #fff no-repeat 5px center/50px 50px; "/"前 ...

  9. vim的保存误认为utf8问题

     用vim改脚本改到一处写到'太原':w一下,再打开,,结果给乱码了...我默认sql是用cp936的,,,想到到和记录本的联通问题一样....   可能会问我为什么不用utf8,,,,因为ms200 ...

  10. hdu 4301(基本dp)

    题意:就是给你一块2*n的巧克力,让你把它分成x块,并且每一个单位的巧克力各不相同,问有多少种分法? 分析:用dp[i][j][k],表示到巧克力的第二列时,巧克力被分成了j快,k用来表示第i列上下两 ...