首页 VC_设置窗口大小及图像的显示(VC_ setting window size and image display)

VC_设置窗口大小及图像的显示(VC_ setting window size and image display)

举报
开通vip

VC_设置窗口大小及图像的显示(VC_ setting window size and image display)VC_设置窗口大小及图像的显示(VC_ setting window size and image display) VC_设置窗口大小及图像的显示(VC_ setting window size and image display) VC settings window size! / / SetWindowPos (NULL, 0,0200300, SWP_NOMOVE); / / dismissed (0,0), only the size changed to 200x300, the same ...

VC_设置窗口大小及图像的显示(VC_ setting window size and image display)
VC_设置窗口大小及图像的显示(VC_ setting window size and image display) VC_设置窗口大小及图像的显示(VC_ setting window size and image display) VC settings window size! / / SetWindowPos (NULL, 0,0200300, SWP_NOMOVE); / / dismissed (0,0), only the size changed to 200x300, the same position / / SetWindowPos (NULL, 0,0200300, SWP_NOMOVE); / / said they did not consider 200X300, just moved to the position of the same size (0,0). / / if you want to change at the same time the last available SWP_NOZORDER There are SWP_SHOWWINDOW / / parameters display window corresponding to the SWP_HIDEWINDOW / / create from file CImagine / / open image file Void, OnFileOpen () { CString strFilter; CSimpleArray aguidFileTypes; HRESULT hResult; Get / / filter string image file supported by Cimage HResult = m_image.GetExporterFilterString (strFilter, aguidFileTypes, _T (All, Image, Types)); If (FAILED (hResult)) { MessageBox (calling GetExporterFilter failed! "); Return; } CFileDialog, DLG (TRUE, NULL, NULL, OFN_FILEMUSTEXIST, strFilter); If (IDOK = = dlg.DoModal ()) { Return; } M_image.Destroy (); / / external image file loading Cimage object HResult = m_image.Load (dlg.GetFileName ()); If (FAILED (hResult)) { "MessageBox" failed to call the image file! "); Return; } / / set the main window title bar content CString str; Str.LoadString (AFX_IDS_APP_TITLE); (AfxGetMainWnd) ->SetWindowText (STR + dlg.GetFileName) + "_" (); Invalidate (OnDraw); / / mandatory call } / / save picture file Void, OnFileSaveAs () { If (m_image.IsNull ()) { MessageBox ("you have not opened the graphic file you want to save."! "); Return; } The following procedures for selecting / / save the picture path and other information CString strFilter=, bitmap file (*.bmp), |*.bmp|JPEG image file, |*.jpg|GIF image file, |*.gif|PNG image file, |*.png||"; CFileDialog, DLG (FALSE, BMP, untitled.bmp, NULL, strFilter); If (IDOK = = dlg.DoModal ()) Return; / / if the user does not specify a file name extension, is to add a CString strFileName; CString strExtension; StrFileName = dlg.m_ofn.lpstrFile; If (dlg.m_ofn.nFileExtension = 0) { Switch (dlg.m_ofn.nFilterIndex) { Case 1: StrExtension = "BMP"; break; Case 2: StrExtension = "JPG"; break; Case 3: StrExtension = "GIF"; break; Case 4: StrExtension = "PNG"; break; Default: Break; } StrFileName = strFileName + strExtension + '.'; } / / save the image HRESULT hResult = m_image.Save (strFileName); If (FAILED (hResult)) MessageBox (save image file failed)! "); Else MessageBox (save the image file successfully! "); } / / set to black and white pictures. Void MakeBlackAndWhite (CImage* image) { If (image->IsNull ()) { Return; } If (image->IsIndexed) (!) / / whether to use the color table to judge { / / directly modify the pixel color COLORREF pixel; Int maxY = image->GetHeight (); Int maxX = image->GetWidth (); Byte, R, G, B, avg; 为(int x = 0;x,Maxx;X + +) { 为(y = 0;Y,糯;Y + +) { 像素=图像-> GetPixel(x,y); R = getrvalue(像素); G = getgvalue(像素); B = getbvalue(像素); AVG =(int)((r + G + B)/ 3); 图像-> setpixelrgb(x,y,AVG AVG,AVG); } } } 其他的 { / /获取并修改颜色 关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf 国际maxcolors =图像-> getmaxcolortableentries(); 颜色表项*颜色; 颜色=新的颜色表项[ maxcolors ]; 图像-> getcolortable(0,maxcolors,颜色); 为(int i = 0;i < maxcolors;i++) { 国际平均值=(颜色[我]。rgbblue +颜色[我]。rgbgreen +颜色[我]。图像)/ 3; 颜色[我]。rgbblue = AVG; 颜色[我]。rgbgreen = AVG; 颜色[我]图像=平均; } 图像-> setcolortable(0,maxcolors,颜色); 删除(颜色); } } / / GDI+显示图像并旋转 无效imagerotate() , 图形图形(* PDC); 图像(/ * L C:\井位图1。JPG”* / L”。\物\构造图.jpg”); 矩形(700,0,形象。getwidth(),形象。getheight()); 图形。绘制图像(图像、矩形); 点[ ] = {点(0,0),点(图像。getwidth(),0),点(0,图像。getheight())}; 矩阵(1,0,0,1,10,10);/ /定义一个单位矩阵,坐标原点在(10,10) 矩阵。旋转(30);//顺时针旋转30度 矩阵表(0.5,0.5);/ /缩小比例 矩阵。transformpoints(分,3);//用矩阵转换点 图形。绘制图像(图像、点,3); ,
本文档为【VC_设置窗口大小及图像的显示(VC_ setting window size and image display)】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_589748
暂无简介~
格式:doc
大小:21KB
软件:Word
页数:7
分类:互联网
上传时间:2018-04-29
浏览量:28