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. WPF自定义控件与样式(13)-自定义窗体Window & 自适应内容大小消息框MessageBox

    一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等,若有不明白的地方可以参考本系列前面的文章,文末附有部分文章链接. 本文主要内容: 自定义 ...

  2. 通过用 .NET 生成自定义窗体设计器来定制应用程序

    通过用 .NET 生成自定义窗体设计器来定制应用程序 https://www.microsoft.com/china/MSDN/library/netFramework/netframework/Cu ...

  3. 【转】WPF自定义控件与样式(13)-自定义窗体Window & 自适应内容大小消息框MessageBox

    一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等. 本文主要内容: 自定义Window窗体样式: 基于自定义窗体实现自定义MessageB ...

  4. Winform自定义窗体样式,实现标题栏可灵活自定义

    最近在编写C/S结构应用程序时,感觉窗体的标题栏样式太死板了,标题文字不能更改大小.颜色.字体等,按钮不能隐藏等问题,在网上也查找了许多相关的资料,没有找到合适的解决方案,发现许多人也在寻求这个问题, ...

  5. wpf 自定义窗体的实现

    首先创建自定义窗体的资源文件 <ControlTemplate x:Key="BaseWindowControlTemplate" TargetType="Wind ...

  6. Unity 编辑器扩展自定义窗体

    这次看见Unity还可以自定义弹出窗体,让我很好奇.于是就去网上找文章看了看. 如果想自定义窗体需要把类放入Editor文件夹下面. 代码如下: using UnityEngine; using Un ...

  7. INNO SETUP卸载程序中加入自定义窗体

    原文:INNO SETUP卸载程序中加入自定义窗体 [Setup] AppName=My Program AppVerName=My Program v.1.2 DefaultDirName={pf} ...

  8. c#winform自定义窗体,重绘标题栏,自定义控件学习

    c#winform自定义窗体,重绘标题栏 虽然现在都在说winform窗体太丑了,但是我也能尽量让桌面应用程序漂亮那么一点点话不多说,先上图 重绘标题栏先将原生窗体设置成无边框,FormBoderSt ...

  9. Java 自定义窗体(标题栏、窗体背景)

    感谢大佬:https://blog.csdn.net/ltx06/article/details/28996839 最近在书上看到这篇文章,觉得挺有意思.与大家分享一下,具体可以参见明日科技出版的&l ...

随机推荐

  1. 使用display:inline-block产生间隙

    使用display:inline-block产生间隙 一.产生的原因:当初设立标准的不是亚洲而是欧洲,inline元素为了正确显示英文字母如y j g等带有尾巴的,就在底下留空.二.解决办法: 四个d ...

  2. jsp的运行内幕--Tomcat容器对自定义标签的解析过程

    http://blog.sina.com.cn/s/blog_4adc4b090101daqb.html

  3. Ubuntu語言支持爲灰色修復方法

    Ubuntu語言支持爲灰色修復方法 在Ubuntu12.04中,在下不知爲何將 語言支持 中 應用到整個系統 和 添加語言 這2個按弄成了灰色,導致ibus不能輸入中文,現在唔將修復方法公告天下: 1 ...

  4. libwebsockets 运行问题

    /****************************************************************************** * libwebsockets 运行问题 ...

  5. HihoCoder 1158 : 质数相关 (最大独立集)

    质数相关 时间限制:2000ms 单点时限:1000ms 内存限制:256MB 描述 两个数a和 b (a<b)被称为质数相关,是指a × p = b,这里p是一个质数.一个集合S被称为质数相关 ...

  6. mysql锁之Next-Key Locks

    一个Next-key锁结合了行锁和gap锁. InnoDB执行一个行级别锁在这样的一个途径,那就是它搜索或者扫描一个表索引时,它设置共享或者独占锁在它遭遇的索引记录上.于是,行级锁是真实的行记录锁.一 ...

  7. Java基础总结大全

    一.基础知识: 1.JVM.JRE和JDK的区别: JVM(Java Virtual Machine):java虚拟机,用于保证java的跨平台的特性. java语言是跨平台,jvm不是跨平台的. J ...

  8. hibernate 一对一(One-to-One)

    一对一(one-to-one)实例(Person-IdCard) 一对一的关系在数据库中表示为主外关系.例如.人和身份证的关系.每个人都对应一个身份证号.我们应该两个表.一个是关于人信息的表(Pers ...

  9. Multisim的电路分析方法

    Multisim的电路分析方法:主要有直流工作点分析,交流分析,瞬态分析,傅里叶分析,噪声分析,失真分析,直流扫描分析, 灵敏度分析,参数扫描分析,温度扫描分析,零一极点分析,传递函数分析,最坏情况分 ...

  10. 【java反射】Class类型的相关操作演练

    [一]获取范型接口的实现类的范型类型 (1)范型接口 package org.springframework.context; import java.util.EventListener; publ ...