UG/NX二次开发 使用ufun函数设置NX背景颜色 UF_DISP_set_color

文章作者:里海
来源网站:https://blog.csdn.net/WangPaiFeiXingYuan


简介:

 使用ufun函数设置NX背景颜色。需要先从首选项中设置背景为“纯色”

       

代码:

int setBackgroundColor(int iR, int iG, int iB)
{
    double clr_values[3];
    clr_values[0] = iR / 255.0;
    clr_values[1] = iG / 255.0;
    clr_values[2] = iB / 255.0;
    UF_DISP_set_color(UF_DISP_BACKGROUND_COLOR, UF_DISP_rgb_model, NULL, clr_values);
    UF_DISP_load_color_table();
    return 0;
}
extern DllExport void ufusr( char *parm, int *returnCode, int rlen )
{
    UF_initialize();
   
    //设置为黑色背景
    setBackgroundColor(0, 0, 0);

    //设置为白色背景
    setBackgroundColor(255, 255, 255);

    UF_terminate();
}

extern int ufusr_ask_unload( void )
{
    return( UF_UNLOAD_IMMEDIATELY );
}

猜你喜欢

转载自blog.csdn.net/WangPaiFeiXingYuan/article/details/130039310
今日推荐