ImageVerifierCode 换一换
格式:DOC , 页数:11 ,大小:51KB ,
资源ID:6102898      下载积分:10 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-6102898.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(c语言画图.doc)为本站会员(buyk185)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

c语言画图.doc

1、1#include #include #include #include #include #include #include #include void FbtnActivateCallback();void FtextInputCheck();void FtextSumit();void FpostMenu();void FdeleteListItem();XtAppContext g_app;Widget g_wScrollList;Widget g_wTextField;Widget g_wPushButton;Widget g_wLabel;Widget g_wPopupMenuPa

2、nel;int g_iScreenW;int g_iScreenH;int g_iMainW;2int g_iMainH;int g_iMoveX;int g_iMoveY;int g_iSelectedItem;void main(argc, argv)int argc;char *argv;Arg args256;int n;g_iSelectedItem = 0;Widget toplevel;toplevel = XtVaAppInitialize(g_iMainW = 200;g_iMainH = 350;g_iScreenW=WidthOfScreen(XtScreen(tople

3、vel);g_iScreenH=HeightOfScreen(XtScreen(toplevel);printf(“w: %dnh: %dn“, g_iScreenW, g_iScreenH);g_iMoveX = (g_iScreenW - g_iMainW)/2;g_iMoveY = (g_iScreenH - g_iMainH)/2;3XtVaSetValues( toplevel,XmNx, g_iMoveX,XmNy, g_iMoveY,XmNtitle, “exam“,XmNwidth,g_iMainW,XmNheight, g_iMainH,XmNmaxWidth,g_iMain

4、W,XmNminWidth,g_iMainW,XmNmaxHeight,g_iMainH,XmNminHeight,g_iMainH,NULL);/formWidget form1 = XtVaCreateManagedWidget( “form1“, xmFormWidgetClass, toplevel, NULL);XtVaSetValues( form1,XmNwidth,g_iMainW,XmNheight, g_iMainH,XmNmaxWidth, g_iMainW,XmNminWidth, g_iMainW,XmNmaxHeight, g_iMainH,XmNminHeight

5、, g_iMainH,NULL);XtManageChild(form1);/4XmString cString;Widget menu_item;cString = XmStringCreateSimple(“Delete“);XtSetArg(args0, XmNmenuAccelerator, “Ctrlp“);g_wPopupMenuPanel = XmCreatePopupMenu(form1, “, args, 1);XtSetArg(args0, XmNlabelString, cString);XtSetArg(args1, XmNmnemonic, D);menu_item

6、= XmCreatePushButtonGadget(g_wPopupMenuPanel, “Delete“, args, 2);XtAddCallback(menu_item, XmNactivateCallback, FdeleteListItem, “delete“);XtManageChild(menu_item);XmStringFree(cString);/n = 0;XtSetArg(argsn, XmNwidth, 200); n+;XtSetArg(argsn, XmNheight, 270); n+;XtSetArg(argsn, XmNrightAttachment, X

7、mATTACH_FORM); n+;XtSetArg(argsn, XmNrightOffset, 5); n+;XtSetArg(argsn, XmNleftAttachment, XmATTACH_FORM); n+;XtSetArg(argsn, XmNleftOffset, 5); n+;XtSetArg(argsn, XmNtopAttachment, XmATTACH_FORM); n+;XtSetArg(argsn, XmNtopOffset, 0); n+;XtSetArg(argsn, XmNbottomAttachment, XmATTACH_FORM); n+;5XtSe

8、tArg(argsn, XmNbottomOffset, 80); n+;XtSetArg(argsn, XmNselectionPolicy, XmSINGLE_SELECT); n+;g_wScrollList = XmCreateScrolledList(form1, “, args, n);XtManageChild(g_wScrollList);XtAddCallback(g_wScrollList, XmNsingleSelectionCallback, FpostMenu, g_wPopupMenuPanel);/n = 0;XtSetArg(argsn, XmNtopAttac

9、hment, XmATTACH_FORM); n+;XtSetArg(argsn, XmNtopOffset, 280); n+;XtSetArg(argsn, XmNleftAttachment, XmATTACH_FORM); n+;XtSetArg(argsn, XmNleftOffset, 10); n+;XtSetArg(argsn, XmNwidth, 100); n+;XtSetArg(argsn, XmNheight, 30); n+;g_wTextField = XmCreateTextField(form1, “, args, n);XtAddCallback(g_wTex

10、tField, XmNmodifyVerifyCallback, FtextInputCheck, 9);XtAddCallback(g_wTextField, XmNactivateCallback, FtextSumit, 9);XtManageChild(g_wTextField);/n = 0;XtSetArg(argsn, XmNtopAttachment, XmATTACH_FORM); n+;XtSetArg(argsn, XmNtopOffset, 280); n+;XtSetArg(argsn, XmNleftAttachment, XmATTACH_FORM); n+;6X

11、tSetArg(argsn, XmNleftOffset, 130); n+;XtSetArg(argsn, XmNwidth, 60); n+;XtSetArg(argsn, XmNheight, 30); n+;g_wPushButton = XmCreatePushButton(form1, “Close“, args, n);XtAddCallback(g_wPushButton, XmNactivateCallback, FbtnActivateCallback, 1);XtManageChild(g_wPushButton);/n = 0;XtSetArg(argsn, XmNto

12、pAttachment, XmATTACH_FORM); n+;XtSetArg(argsn, XmNtopOffset, 315); n+;XtSetArg(argsn, XmNleftAttachment, XmATTACH_FORM); n+;XtSetArg(argsn, XmNleftOffset, 10); n+;XtSetArg(argsn, XmNwidth, 180); n+;XtSetArg(argsn, XmNheight, 30); n+;g_wLabel = XmCreateLabel(form1, “, args, n);/XtAddCallback(g_wPush

13、Button, XmNactivateCallback, FbtnActivateCallback, 1);XtManageChild(g_wLabel);XtRealizeWidget(toplevel);XtAppMainLoop(g_app);7void FbtnActivateCallback(widget, cl, cb)Widget widget;int cl;caddr_t cb;exit(0);void FtextInputCheck(textField, maxNum, cb)Widget textField;int maxNum;XmTextVerifyCallbackSt

14、ruct *cb;int len = 0;char c;if(cb-startPos currInsert)return;c = cb-text-ptr0;if(c z | (c 9 return;len = XmTextGetLastPosition(textField);8if(len = maxNum)cb-doit = False;return;void FtextSumit(textField, cl, cb)Widget textField;int cl;caddr_t cb;char *text;char *str;XmString newItem;XmStringTable x

15、mStrArray;int len;int listItemCount;len = XmTextGetLastPosition(textField);if(len = 0)return;text = XmTextGetString(textField);XmTextSetString(textField, “);XtVaGetValues(g_wScrollList, XmNitems, 9int i = 0;for(i = 0; i event != Button3 )/| cb-event-xbutton.button != 3)/ return;g_iSelectedItem = cb-

16、item_position;XmMenuPosition(popup, cb-event);XtManageChild(popup);void FdeleteListItem(menu_item, item_no, c_data)Widget menu_item;int item_no;XmAnyCallbackStruct *c_data;11int listItemCount;printf(“xyf_delete itemn“);if(g_iSelectedItem = 0)return;XmListDeletePos(g_wScrollList, g_iSelectedItem-);/if(g_iSelectedItem = 0)/ break;/XmListSelectPos(list)XtVaGetValues(g_wScrollList, XmNitemCount, if(listItemCount = 19)char str256;XmString xmStr;memset(str, 0, sizeof(str);sprintf(str, “);xmStr = XmStringCreateSimple(str);XtVaSetValues(g_wLabel, XmNlabelString, xmStr, NULL);XmStringFree(xmStr);

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报