码迷,mamicode.com
首页 > 其他好文 > 详细

RTTI(一) 枚举

时间:2015-07-13 22:14:01      阅读:92      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!