【NX二次开发】Block UI 枚举

属性:

常规         类型 描述
    BlockID     String 控件ID
    Enable     Logical 是否可操作
    Group     Logical 是否分组
    Label     Utfstring 标题
    LabelVisibility Logical 标题是否可见
    Show     Logical 是否可见
其他            
    Localize     Logical 是否本地化
    RetainValue Logical 是否保存值
    附件        
        Bottom Attachment 底部
        Left Attachment
        Right Attachment
        Top Attachment 顶部
特定于块            
    AllowShortcuts Logical 是否允许快捷键
    BalloonTooltipImage String 标题气泡提示图片
    BalloonTooltipImages Strings 选项气泡提示图片
    BalloonTooltipLayout Enum 气泡提示类型
    BalloonTooltipText Utfstring 标题气泡提示文本
    BalloonTooltipTexts Utfstrings 选项气泡提示文本
    Bitmaps Strings 选项位图
    BorderVisibility Logical 文本标题是否可见
    EnumSensitivity Stlvector 某几个选项是否可选
    EnumVisibility Stlvector 某几个选项是否隐藏
    HighQualityBitmap Logical 是否使用高质量位图
    IconsOnly Logical 只显示位图
    InitialShortcuts Stlvector
    Layout Enum 选项布局横向、属相
    NumberOfColumns Integer 列数
    PackedColumns Logical 列之间是否靠近
    PresentationStyle Enum 控件类型
    Value Enum 枚举值
     

获取控件的值

int iType=0;
iType = this->enum0->GetProperties()->GetEnum("Value");

设置控件的值

int iNth=0;
this->enum01->GetProperties()->SetEnum("Value",iNth);

设置控件不可修改

 this->enum01->SetEnable(false);

读取枚举文本的方法

NXString nxStrEnum0=this->enum0->ValueAsString();
char crstring0[133] = "";
strcpy_s(crstring0, 133, nxStrEnum0.GetLocaleText());
string strEnum0 = crstring0;

根据枚举文本设置枚举值

this->enum_catalog->SetValueAsString("枚举的文本");

原文地址:https://www.cnblogs.com/KMould/p/13345533.html