首页 > 其他 > 详细

RTTI(一) 枚举

时间:2015-07-13 22:11:52      阅读:137      评论:0      收藏:0      [点我收藏+]
SetEnumProp
void __fastcall TForm2::Button1Click(TObject *Sender)
{
    //Getting the current color of the workspace
    String currentPropColor = GetEnumProp(this,"Color");
    int currentColorInt = StrToInt(currentPropColor);
 
    //Getting the first button align enum and, if different,
    //setting it to alLeft
    String currentAlignProp = GetEnumProp(Button1, "Align");
    if (currentAlignProp != "alLeft")
    {
         SetEnumProp(Button1, "Align", "alLeft");
     }
 
    //Checking if the form background color was set.
    if(currentColorInt < 0)
    {
        currentColorInt = GetSysColor(COLOR_APPWORKSPACE);
    }
 
    //Setting the form background color as the negative value
    //of the current background color
    SetEnumProp(this, "Color",
                IntToStr((int)(clWhite - currentColorInt)));
}
 
void __fastcall TForm2::Button2Click(TObject *Sender)
{
    int p[5] = {clYellow, clGreen, clRed, clBlue, clBlack};
    SetEnumProp(this, "Color", IntToStr(p[random(5)]));
 
    //Getting the second button align enum and, if different,
    //setting it to alRight
    String currentAlignProp = GetEnumProp(Button2, "Align");
    if (currentAlignProp != "alRight")
    {
         SetEnumProp(Button2, "Align", "alRight");
     }
}

 

RTTI(一) 枚举

原文:http://www.cnblogs.com/cb168/p/4643967.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!