资源预览内容
第1页 / 共13页
第2页 / 共13页
第3页 / 共13页
第4页 / 共13页
第5页 / 共13页
第6页 / 共13页
第7页 / 共13页
第8页 / 共13页
第9页 / 共13页
第10页 / 共13页
亲,该文档总共13页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
实验七F 控件编程实验一、实验目的() 熟悉Visual C+ 60 开发环境;(2) 掌握M 环境下原则控件的使用措施;() 纯熟掌握在isul C+ 6. 开发环境调试程序的措施。二、实验内容创立如图所示的应用程序,在“形状”列表框中选择要绘制的图形,在“笔颜色”下拉列表框中选择画笔的颜色,在“刷子颜色”下拉列表框中选择画刷的颜色,在“线型”组框中选择画笔的线型,在“填充类型”中选择画刷填充类型,单击“绘图”按钮在“绘图设立”编辑框中显示选择的绘图设立选项,单击“退出”按钮退出程序。三、程序代码/ testDlg.cp :mpeentatiole/#include stafh#nclude s.h#ice estDl.h#ifdef_EBGdein new DEBG_N#de TIFILEtaticcr THISFIE = _FILE_;#endf/CAutDlg dlog sed for App AboucCboutg : blcCDaogpbli:butDg();/ Diag at/AX_TA(AbouDlg)eu IDD = IDDBOUTBOX;/AFX_DT/ lsWizar nrated vitual funn overrde/_VIRTUA(AbutDlg)roteted:virtulvoid DoDatExchag(Caacag* pDX); / DX/DVsuppot/AFIRUA/ Imlemetaonrotected:FX_MS(CbouDl)FX_MGDECLAREMESG_AP();CAbutDlg:Aoutlg():CDlog(CAbouDlg:IDD)/FX_DT_INT(CAboutDg)/AFXATA_ITvid CAbotDg:oaaExhn(DataEhange* pD)CDialo:DoaEchnge(pDX);/AX_A_MP(AbotDlg)/AFDAT_MAPEIN_MSSAE_MAP(CAbotDlg, ialg)/AF_MSG_MAP(CAoutDlg)/ No mesageandls/AFXMSG_MAPEND_MSSAGE_P()/ eDgdialgCetDlg:CTesDlg(Cd* pPan /=NULL*/):CDalog(CTestlg:ID, pParet)/AF_DAA_(CTestDlg)m_pen -;m_bus= -;Outpu _T();AFX_DATA_INIT/ Nttha LoadIcon oes ntrequr a sbeqn esryconin Win32m_hon AfxGetp()-LadIcon(ID_MAINFRA);oid CTsDlg:DoDtxche(CDataExne* pX)CDilog:DDataxchae(pDX);/A_DT_MP(Tg)XCnt(pDX, IDC_LIT1, _ist);DDX_Con(pD, DCOMBO2, m_cb2);DDX_Contro(DX,ID_MB1, m_c1);DDX_Rai(DX, C_ADIO1, m_pen);DX_adio(DX, IDC_RAO5,_rush);DD_Text(pX,IDC_OUTUT, m_Output);/AFDTA_MABEGIN_MESSA_MA(CTeDg, CDialo)/AX_MSG_MP(CTesg)ON_WM_YSMMAD()ON_WM_PAINT()ON_WM_UEYDAGICN()ON_EN_CHANGE(IDC_OUTPU, OnChaeOutput)N_BN_CICKED(DCBUTTON1, OBton)_BN_SCANE(DC_LIT1, OnSelcngeList1)NCB_SELCHNGE(IC_COMBO1, OSeageCombo1)ON_BN_SELCHAGE(IDC_COMBO,OnSelchaeCoo2)O_CBN_EDITHNG(ID_COMO,OelcngeCombo2)/AFX_MS_MAPND_ESSAE_MAP()/ CTestDl sag hndleBOLCstDlg:OnInitDialog()CDlog::IiDiaog();/ Add Abot. eu itosystem menu./ I_AUTOX mu beinthe systcommad rnge.ASERT(DM_ABOTBX & 0xFF0) = IDM_ABOUTBOX);ASSE(IDBUTBOX 0xF00);CMn* pysMenu =GetStMu(ASE);if (ysMenu! ULL)Ctring strbutnu;stAboutMenu.Lodtrig(IDABOX);if (!strAbMenu.sEmpty())pSyMenu-ppendMenu(MEPARAOR);Sysen-AppendMen(MSTRING, IDABOUBOX,strAotMe);/et th inforthis dilg. heframwk de this uoaticy/he t plicatis maiwindow is not a ilogeIon(m_hIcon, TRUE);/ St big conStcon(mhon, ALSE);/ St smll ion/TDO:Add exa initialzaton here_listAtring(Lne); m_lis.ddStrig(irce);m_list.AdStrig(Recange);m_listAddStrin(oudReangl);m_cb1.AddString(Re);mcb1AddString(lue);m_cb1Addtring(Blac);rtrn TRUE; /retrn TRU uness you se the focs t conrolvoid CTestDlg:OSysCmmand(UINT nID, LAAM Pam)i(nD& xFFF0) = DM_ABOUBOX)AbotDlglgAout;dgAbout.oModal();elseDialo:OSsomd(nID, Param);/ If yo addminimi bton o yu dialg,yowilled te cebe odaw th ic. For FC apliatis using the ocument/iew model,/ ts i automatcally d for yu y te fraewor.voi CTtDlg:OPaint() i (IsIonic()CPaintDCd(this); /evce contxt aintinSendMesage(WM_ICONERAEBKD, (WPA) dc.GaeHdc(), 0);/ ente ion iclietrectangleintxIon = etSystmMetric(SMCXION);intcn= GetSystemMic(M_CCON);CRectet;etClentRect(&r);n x = (ret.Wdh() - cIo +) /;int y =(recteight() -cyco+ 1) / 2;/ Dawthcnd.DraIcon(x,y, _hIcon);elsCDaog::OnPant();he sy calls ts to otaintcurso to diplay whle e uer dras/ th mnimizdndow.R CTsl::OnQueyDagIcn()retur (HCRSOR)hIcon;voi CTestlg:OnCgOuput() / TODO: th
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号