同标题程序中动态获得字符串对应的组件名,以判断是否是TControl

解决方案 »

  1.   

    TControl的就是那么几个组件,所有的都自己判断就好了...
      

  2.   

    这两天看《Delphi高手突破》第二章的里面有一部分讲解“类引用”里面说到的类方法好像可以解决你的问题,你可以看看...
      

  3.   

    FindComponent适用于知道组件的名字(对象),但是通过类的名字的话,好像有点不合适吧。
    如果你保存的是edit1那么你可以这么判断
    if application.findComponent('edit1') is TControl then
    showmessage('是TControl');
    如果你保存的是一种TEdit恐怕就不能用这个函数了。
      

  4.   


    向下面一样TFormClass = class of TForm;
      

  5.   

    Call FindClass to locate a class type by name. FindClass searches the classes that the streaming system knows about. Form classes and component classes that are referenced in a form declaration (instance variables) are automatically registered with the streaming system. Other classes can be registered (with a call to RegisterClasses) so that the streaming system will recognize that class in a stream and know how to construct it. If the requested class name cannot be found, FindClass raises an exception.
    ---------------------------
    学习...