12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723 |
- // ChooseDesignSkin.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ChooseDesignSkin.h"
- #include "YLGL.h"
- #include "./helper/ffsco.h"
- #include ".\MenuBarXP\MenuXP.h"
- #include "ChoosePhotoSkin3.h"
- #include "ShowPic22.h"
- #include "ClientRequirement.h"
- #include "MyLock.h"
- #include "ComparePhoto.h"
- #include "ReplaceDesignNo.h"
- #include "Login2.h"
- #include "TimeOutDlg.h"
- #include "ShowEffect.h"
- #include "SelBrunDevice.h"
- #include "ProductChooseFilter.h"
- #include "NewFolderDlg.h"
- #include "NetShareInfo.h"
- #include "ShowMsg3.h"
- using namespace helper_coffs;
- #ifdef _DEBUG
- //#define new DEBUG_NEW (如果出现new时传多个参数会出错)
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- using namespace helper_coffs;
- extern int GetOrientation(Image *image);
- extern HCURSOR g_cursorhand;
- /////////////////////////////////////////////////////////////////////////////
- // ChooseDesignSkin message handlers
- extern void SizeToContent(HWND hwnd, Image *img);
- //mode
- //0 全部
- //1 选中
- //2 未选
- //3 删除
- //4 入册
- //5 入底
- /////////////////////////////////////////////////////////////////////////////
- // ChooseDesignSkin dialog IDC_EDITzs
- ChooseDesignSkin::ChooseDesignSkin(CWnd* pParent /*=NULL*/) : ChoosePhotoBase(ChooseDesignSkin::IDD, pParent)
- {
- m_time4 = g_date;
- g_pMainWnd->GetSkin();
- m_bChooseBig = 0;
- m_Runingmode = 1;
- }
- ChooseDesignSkin::ChooseDesignSkin(DWORD id, CWnd* pParent) : ChoosePhotoBase(id, pParent)
- {
- m_time4 = g_date;
- g_pMainWnd->GetSkin();
- m_bChooseBig = 0;
- m_Runingmode = 1;
- }
- void ChooseDesignSkin::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(ChooseDesignSkin)
- DDX_Control(pDX, IDC_COMBO1, m_combo1);
- DDX_Control(pDX, IDC_LIST3, m_List3);
- DDX_Control(pDX, IDC_LIST2, m_List2);
- DDX_Control(pDX, IDC_LIST1, m_List1);
- DDX_Text(pDX, IDC_EDITname1, m_name1);
- DDX_Text(pDX, IDC_EDITname2, m_name2);
- DDX_Text(pDX, IDC_EDITtime4, m_time4);
- DDX_Text(pDX, IDC_EDITwaiter3, m_waiter3);
- DDX_Text(pDX, IDC_EDITzs, m_takezs);
- DDX_Text(pDX, IDC_EDITzs2, m_taoxizs);
- DDX_Text(pDX, IDC_EDITzs3, m_choosezs);
- DDX_Text(pDX, IDC_EDITmoney3, m_money3);
- DDX_Text(pDX, IDC_EDITid, m_strOrderNumber);
- DDX_Text(pDX, IDC_EDITbz3, m_bz3);
- //}}AFX_DATA_MAP}
- }
- BEGIN_MESSAGE_MAP(ChooseDesignSkin, CDialog)
- //{{AFX_MSG_MAP(ChooseDesignSkin)
- ON_WM_PAINT()
- ON_WM_DESTROY()
- ON_WM_ERASEBKGND()
- ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
- ON_WM_CLOSE()
- ON_NOTIFY(NM_RCLICK, IDC_LIST1, OnRclickList1)
- ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
- ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
- ON_WM_TIMER()
- //}}AFX_MSG_MAP
- ON_MESSAGE(WM_USER + 1101, OnBtnClick)
- ON_COMMAND_RANGE(IDM_MENUsp1 - 1, IDM_MENUsp1 + 200, OnCommandMenu)
- ON_MESSAGE(WM_USER + 200, UpdateTakeZS)
-
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // ChooseDesignSkin message handlers
- BOOL ChooseDesignSkin::OnInitDialog() //初始化选片*看设计
- {
- ChoosePhotoBase::OnInitDialog();
- //加载相片和文件夹icon
- LoadImageFromRes(&m_pHideImg, MAKEINTRESOURCE(IDR_JPG5), _T("JPG"));
- if(m_pHideImg == NULL)
- {
- MessageBox(_T("加载图标失败"));
- return FALSE;
- }
- // 1.加载lia皮肤信息;
- g_bInSkin = 1;
- m_ticks = ::GetTickCount();
- if (g_cursorhand == NULL)
- g_cursorhand = AfxGetApp()->LoadCursor(IDC_CURSORHAND);
- BYTE *pData = NULL;
- BYTE *pDataBegin;
- //printf("Jeff:loadLia路径:%s\n\n",g_mainpath+"\\skin\\"+m_liapath);//Jeff Printf;
- if (!LoadLia(g_mainpath + _T("\\skin\\") + m_liapath, &pData, &pDataBegin, &m_pBk, m_hWnd))
- {
- EndDialog(0);
- return false;
- }
- //初始化按钮和位置
- //printf("Jeff:g_resdata2.nPicCount=%d\n\n",g_resdata2.nPicCount); // Jeff Printf,这个nPicCount好像一直是15;
- for (int i = 0; i < g_resdata2.nPicCount; i++)
- {
- g_resdata2.rect[i].left *= g_fscalex;
- g_resdata2.rect[i].right *= g_fscalex;
- g_resdata2.rect[i].top *= g_fscaley;
- g_resdata2.rect[i].bottom *= g_fscaley;
- if (i == 8)
- g_resdata2.rect[i] = g_resdata2.rect[2];
- else if (i == 9)
- g_resdata2.rect[i] = g_resdata2.rect[3];
- else if (i == 10)
- g_resdata2.rect[i] = g_resdata2.rect[1];
- if (g_resdata2.nPicBmpCount[i])
- {
- MyBmpButton2 *pic = new MyBmpButton2;
- m_picarray.Add((DWORD)pic);
- CRect rc = g_resdata2.rect[i];
- CString str;
- str.Format(_T("%d"), i + 1);
- pic->Create(str, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, rc, this, i + 100);
- pic->m_bmpcount = g_resdata2.nPicBmpCount[i];
- pic->ReadBmp(&pData, NULL, this);
- #ifdef SZWNS_VERSION//深圳维纳斯
- if(i==3 && m_mode2==0)
- {
- Image *img=NULL;
- LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG6), _T("JPG"));
- delete pic->m_bmp;
- pic->m_bmp=img->Clone();
- delete img;
- img=NULL;
- LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG7), _T("JPG"));
- delete pic->m_bmpfocus;
- pic->m_bmpfocus=img->Clone();
- delete img;
- img=NULL;
- LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG8), _T("JPG"));
- delete pic->m_bmpfocused;
- pic->m_bmpfocused=img->Clone();
- delete img;
- }
- #endif//SZWNS_VERSION
- }
- else
- m_picarray.Add(NULL);
- m_rcarray.Add(g_resdata2.rect[i]);
- }
- delete[]pDataBegin;
- //初始化按钮位置
- {
- //看设计
- m_bHide = 0;
- // printf("Jeff:g_cominfoarray.ElementAt(0).ElementAt(86)=%s\n\n",g_cominfoarray.ElementAt(0).ElementAt(86)); // Jeff Printf;
- if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
- {
- ((MyBmpButton2*)m_picarray.ElementAt(3))->ShowWindow(SW_HIDE);
- CRect rc, rc2;
- ((MyBmpButton2*)m_picarray.ElementAt(3))->GetWindowRect(rc);
- ((MyBmpButton2*)m_picarray.ElementAt(1))->GetWindowRect(rc2);
- int dtx = rc.right - rc2.right;
- ScreenToClient(rc2);
- rc2.left += dtx;
- rc2.right += dtx;
- ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt(0))->GetWindowRect(rc2);
- ScreenToClient(rc2);
- rc2.left += dtx;
- rc2.right += dtx;
- ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
- }
- CRect rc, rc2;
- ((MyBmpButton2*)m_picarray.ElementAt(5))->GetWindowRect(rc);
- ((MyBmpButton2*)m_picarray.ElementAt(4))->GetWindowRect(rc2);
- int dtx = rc.right - rc2.right;
- rc2 = rc;
- // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
- {
- float scale = 0.9;
- dtx *= scale;
- int wid = rc2.Width()*scale;
- int hei = rc2.Height()*scale;
- int dty = rc2.Height() - hei;
- dty /= 2;
- rc2.left = rc2.right - wid;
- rc2.top += dty;
- rc2.bottom = rc2.top + hei;
- }
- ScreenToClient(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt(5))->MoveWindow(rc2);
- rc2.left -= dtx;
- rc2.right -= dtx;
- ((MyBmpButton2*)m_picarray.ElementAt(4))->MoveWindow(rc2);
- rc2.left -= dtx;
- rc2.right -= dtx;
- ((MyBmpButton2*)m_picarray.ElementAt(14))->MoveWindow(rc2);
- rc2.left -= dtx;
- rc2.right -= dtx;
- ((MyBmpButton2*)m_picarray.ElementAt(2))->MoveWindow(rc2);
- if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)) == 0)
- {
- rc2.left -= dtx;
- rc2.right -= dtx;
- ((MyBmpButton2*)m_picarray.ElementAt(3))->MoveWindow(rc2);
- }
- rc2.left -= dtx;
- rc2.right -= dtx;
- ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
- rc2.left -= dtx;
- rc2.right -= dtx;
- ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
- rc2.left -= dtx;
- rc2.right -= dtx;
- ((MyBmpButton2*)m_picarray.ElementAt(8))->MoveWindow(rc2);
- ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
- }
- if (1)//m_mode2==0)
- {
- ((MyBmpButton2*)m_picarray.ElementAt(7))->ShowWindow(SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt(9))->ShowWindow(SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt(10))->ShowWindow(SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
- }
- else
- {
- ((MyBmpButton2*)m_picarray.ElementAt(7))->EnableWindow(0);
- ((MyBmpButton2*)m_picarray.ElementAt(0))->ShowWindow(SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt(1))->ShowWindow(SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt(2))->ShowWindow(SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt(3))->ShowWindow(SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
- if (IsHasRights2new(37) == 0)
- {
- ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt(9))->ShowWindow(SW_HIDE);
- }
- }
- ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_SHOW);
- // ((MyBmpButton2*)m_picarray.ElementAt (8))->SetPushDown (1);
- ((MyBmpButton2*)m_picarray.ElementAt(12))->ShowWindow(SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt(13))->ShowWindow(SW_HIDE);
- #ifndef MNLS_VERSION//mnls
- ((MyBmpButton2*)m_picarray.ElementAt(7))->ShowWindow(SW_HIDE);
- ((MyBmpButton2*)m_picarray.ElementAt(7))->EnableWindow(0);
- Graphics graph(m_pBk);
- Image *img = NULL;
- ::LoadImageFromBuf(&img, g_mainpath + _T("\\图片\\标题-看设计.jpg"));
- if (img)
- {
- if (img->GetWidth() == 2000)
- {
- graph.SetSmoothingMode(SmoothingModeHighQuality);
- graph.DrawImage(img, 0, 0);
- }
- delete img;
- }
- #endif//MNLS_VERSION
- //初始化列表位置
- CRect listrc = m_rcarray.ElementAt(6);
- CRect rc;
- GetClientRect(rc);
- rc.top = listrc.top;
- m_List1.MoveWindow(rc);
- //创建图标列表控件
- m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1);
- m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL);
- m_List2.InitStyle();
- m_List2.InsertColumn(0, _T("编号"), LVCFMT_LEFT, 45);
- m_List2.InsertColumn(1, _T("商品名称"), LVCFMT_LEFT, 150);
- m_List2.InsertColumn(2, _T("数量"), LVCFMT_LEFT, 45);
- m_List3.InitStyle();
- m_List3.InsertColumn(0, _T("autoid"), LVCFMT_LEFT, 0);
- m_List3.InsertColumn(1, _T("编号"), LVCFMT_LEFT, 45);
- m_List3.InsertColumn(2, _T("商品名称"), LVCFMT_LEFT, 150);
- m_List3.InsertColumn(3, _T("价格"), LVCFMT_LEFT, 45);
- m_List3.InsertColumn(4, _T("数量"), LVCFMT_LEFT, 45);
- #ifdef LKAY_VERSION
- m_List3.InsertColumn(5,_T("P数"),LVCFMT_LEFT,55);
- m_List3.InsertColumn(6,_T("张数"),LVCFMT_LEFT,55);
- m_List3.InsertColumn(7,_T("照片编号"),LVCFMT_LEFT,365);
- #else
- m_List3.InsertColumn(5, _T("照片编号"), LVCFMT_LEFT, 365);
- // 2015.11.13 保存列表添加多一列商品备注选项;
- m_List3.InsertColumn(6, _T("备注"), LVCFMT_LEFT, 300);
- #endif//LKAY_VERSION
- CString path, str;
- m_path = g_path3 + _T("\\");
- m_path += m_strOrderNumber;
- m_path += _T("\\");
- GetPhotos();
- {
- //选设计模式
- GetData();
- if (m_checkstatus != _T("未看"))
- {
- if (atoi(g_cominfoarray.ElementAt(0).ElementAt(85)) && IsHasRights2new(20) == 0)
- {
- Login2 dlg;
- if (dlg.DoModal() != IDOK)
- {
- MyBmpButton2 *btn = ((MyBmpButton2*)m_picarray.ElementAt(4));
- btn->m_bmpdisable = btn->m_bmp->Clone();
- Graphics graph(btn->m_bmpdisable);
- CPoint pt1, pt2, pt3;
- pt1.x = 0;
- pt1.y = 0;
- pt2.x = btn->m_bmp->GetWidth();
- pt2.y = 0;
- pt3.x = 0;
- pt3.y = btn->m_bmp->GetHeight();
- Point destinationPoints[] = {
- Point(pt1.x, pt1.y), // destination for upper-left point of original
- Point(pt2.x, pt2.y), // destination for upper-right point of original
- Point(pt3.x, pt3.y) }; // destination for lower-left point of original
- ColorMatrix colorMatrix = \
- {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
- ImageAttributes imageAtt;
- imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
- graph.DrawImage(btn->m_bmp,
- destinationPoints,
- 3,
- 0,
- 0,
- btn->m_bmp->GetWidth(),
- btn->m_bmp->GetHeight(),
- UnitPixel,
- &imageAtt);
- btn->EnableWindow(0);
- m_bCanSave = 0;
- // CDialog::OnCancel ();
- // return 1;
- }
- else if (IsHasRightsnew2(20, dlg.m_rights) == 0)
- {
- MyBmpButton2 *btn = ((MyBmpButton2*)m_picarray.ElementAt(4));
- btn->m_bmpdisable = btn->m_bmp->Clone();
- Graphics graph(btn->m_bmpdisable);
- CPoint pt1, pt2, pt3;
- pt1.x = 0;
- pt1.y = 0;
- pt2.x = btn->m_bmp->GetWidth();
- pt2.y = 0;
- pt3.x = 0;
- pt3.y = btn->m_bmp->GetHeight();
- Point destinationPoints[] = {
- Point(pt1.x, pt1.y), // destination for upper-left point of original
- Point(pt2.x, pt2.y), // destination for upper-right point of original
- Point(pt3.x, pt3.y) }; // destination for lower-left point of original
- ColorMatrix colorMatrix = \
- {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
- ImageAttributes imageAtt;
- imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
- graph.DrawImage(btn->m_bmp,
- destinationPoints,
- 3,
- 0,
- 0,
- btn->m_bmp->GetWidth(),
- btn->m_bmp->GetHeight(),
- UnitPixel,
- &imageAtt);
- btn->EnableWindow(0); m_bCanSave = 0;
- // CDialog::OnCancel ();
- // return 1;
- }
- }
- }
- //记录已删除的相片
- RecordDeletedPhotos(&m_delphotos, m_DelPhotoPath);
- }
- //在界面上显示图片;
- LoadPhotos();
- if (atoi(g_cominfoarray.ElementAt(0).ElementAt(95)) || g_cominfoarray.ElementAt(0).ElementAt(95) == _T(""))
- {
- int timer1 = atoi(g_cominfoarray.ElementAt(0).ElementAt(96));
- m_timer = atoi(g_cominfoarray.ElementAt(0).ElementAt(97));
- if (timer1 == 0)
- timer1 = 60;
- if (m_timer == 0)
- m_timer = 20;
- SetTimer(1, timer1 * 60000, NULL);
- }
- return false;
- }
- void ChooseDesignSkin::OnPaint()
- {
- try
- {
- CPaintDC dc(this); // device context for painting
- // TODO: Add your message handler code here
- if (m_pBk == NULL)
- {
- return;
- }
- CRect rc;
- GetClientRect(rc);
- Graphics graph(dc.GetSafeHdc());
- Rect destinationRect(0, 0, rc.Width(), rc.Height());
- int width = m_pBk->GetWidth();
- int height = m_pBk->GetHeight();
- graph.SetSmoothingMode(SmoothingModeHighQuality);
- graph.DrawImage(m_pBk, destinationRect, 0, 0, width, height, UnitPixel);
- // Do not call CDialog::OnPaint() for painting messages
- }
- catch (...)
- {
- }
- }
- void ChooseDesignSkin::OnDestroy()
- {
- try
- {
- TerminateThread();
- if (m_pBk)delete m_pBk;
- MyBmpButton2 *pic = NULL;
- for (int i = 0; i < m_picarray.GetSize(); i++)
- {
- pic = (MyBmpButton2*)m_picarray.ElementAt(i);
- if (pic)
- {
- pic->DestroyWindow();
- delete pic;
- }
- }
- m_picarray.RemoveAll();
- if (m_selphotownd.GetSafeHwnd())
- {
- m_selphotownd.DestroyWindow();
- }
- if (m_selphotownd2.GetSafeHwnd())
- {
- m_selphotownd2.DestroyWindow();
- }
- //清除资源的路径
- ClearResData();
-
- if(m_pHideImg)
- delete m_pHideImg;
-
- CDialog::OnDestroy();
- }
- catch (...)
- {
- }
- }
- #ifdef VC60
- void ChooseDesignSkin::OnBtnClick(WPARAM wParam, LPARAM lParam)
- {
- // WM_USER + 1101
- // F5按键,显示删除相片
- int id = lParam;
- id -= 99;
- switch (id)
- {
- case 1: // 查看全部相片按钮事件;
- case 2: // 查看选中的相片按钮事件;
- case 4: // F5查看删除的相片;
- {
- if (m_SelectCategory == id - 1 && m_SelectCategory != 1)
- return;
- m_SelectCategory = id - 1;
- if(INDX_SEL == m_SelectCategory)
- OnSelPhoto();
- LoadPhotos();
- }
- break;
- case 3://查看未选按钮事件;
- {
- m_SelectCategory = INDX_NOSEL;
- m_sChooseFilter = _T("");
- UpdateChooseZS();
- GetNoSelPhoto();
- LoadPhotos();
- }
- break;
- case 13: // 查看入册相片按钮事件;
- GetAlbumPhoto();
- LoadPhotos();
- break;
- case 14: // 查看入底相片按钮事件;
- GetDiskPhoto();
- LoadPhotos();
- break;
- case 15: // 效果图按钮事件;
- {
- ShowEffectDlg dlg;
- dlg.m_pPhotopatharray = this->GetCurArray(m_SelectCategory);
- dlg.DoModal();
- }
- break;
- case 5: // 保存按钮事件;
- OnButton4();
- break;
- case 9: //看设计->放大按钮
- {
- if (((MyBmpButton2*)m_picarray.ElementAt(8))->GetPushDown())
- ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(0);
- else
- ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(1);
- ReLoadPhoto();
- }
- break;
- case 6: // 关闭按钮事件 ;
- if (m_bModify && m_bCanSave)
- {
- ShowMsg3 dlg;
- dlg.m_strMsg = _T("提醒, 选片修改未保存, 是否保存后再退出?");
- // if (AfxMessageBox(_T("提醒, 选片修改未保存, 是否保存后再退出?"), MB_YESNO | MB_ICONINFORMATION) == IDYES)
- if(dlg.DoModal() == IDOK)
- {
- OnButton4();
- if (m_bSaveFail)
- {
- AfxMessageBox(_T("连接服务器失败, 保存失败, 您可以在本机上重新进入选片恢复到选中状态!"));
- CDialog::OnCancel();
- return;
- }
- return;
- }
- else
- {
- CString savepath = _T("");
- savepath.Format(_T("%s\\%s-2.dat"), g_mainpath, m_strOrderNumber);
- ::DeleteFile(savepath); // 删除*.dat文件;
- }
- }
- CDialog::OnCancel();
- break;
- case 11:
- if (m_selphotownd.GetSafeHwnd() == NULL)
- {
- m_selphotownd.m_id = m_strOrderNumber;
- m_selphotownd.m_rc = m_rcarray.ElementAt(6);
- m_selphotownd.Create(IDD_DLGShowSelPhoto, this);
- }
- m_selphotownd.ShowWindow(1);
- break;
- case 12:
- ReplaceDesignNo dlg;
- dlg.m_id = this->m_strOrderNumber;
- dlg.DoModal();
- break;
- }
- }
- #else
- LRESULT ChooseDesignSkin::OnBtnClick(WPARAM wParam, LPARAM lParam)
- {
- // WM_USER + 1101
- // F5按键,显示删除相片
- int id = lParam;
- id -= 99;
- switch (id)
- {
- case 1: // 查看全部相片按钮事件;
- case 2: // 查看选中的相片按钮事件;
- case 4: // F5查看删除的相片;
- {
- if (m_SelectCategory == id - 1 && m_SelectCategory != 1)
- return 0;
- m_SelectCategory = id - 1;
- if(INDX_SEL == m_SelectCategory)
- OnSelPhoto();
- LoadPhotos();
- }
- break;
- case 3://查看未选按钮事件;
- {
- m_SelectCategory = INDX_NOSEL;
- m_sChooseFilter = _T("");
- UpdateChooseZS();
- GetNoSelPhoto();
- LoadPhotos();
- }
- break;
- case 13: // 查看入册相片按钮事件;
- GetAlbumPhoto();
- LoadPhotos();
- break;
- case 14: // 查看入底相片按钮事件;
- GetDiskPhoto();
- LoadPhotos();
- break;
- case 15: // 效果图按钮事件;
- {
- ShowEffectDlg dlg;
- dlg.m_pPhotopatharray = this->GetCurArray(m_SelectCategory);
- dlg.DoModal();
- }
- break;
- case 5: // 保存按钮事件;
- OnButton4();
- break;
- case 9: //看设计->放大按钮
- {
- if (((MyBmpButton2*)m_picarray.ElementAt(8))->GetPushDown())
- ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(0);
- else
- ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(1);
- ReLoadPhoto();
- }
- break;
- case 6: // 关闭按钮事件 ;
- if (m_bModify && m_bCanSave)
- {
- ShowMsg3 dlg;
- dlg.m_strMsg = _T("提醒, 选片修改未保存, 是否保存后再退出?");
- // if (AfxMessageBox(_T("提醒, 选片修改未保存, 是否保存后再退出?"), MB_YESNO | MB_ICONINFORMATION) == IDYES)
- if(dlg.DoModal() == IDOK)
- {
- OnButton4();
- if (m_bSaveFail)
- {
- AfxMessageBox(_T("连接服务器失败, 保存失败, 您可以在本机上重新进入选片恢复到选中状态!"));
- CDialog::OnCancel();
- return 0;
- }
- return 0;
- }
- else
- {
- CString savepath = _T("");
- savepath.Format(_T("%s\\%s-2.dat"), g_mainpath, m_strOrderNumber);
- ::DeleteFile(savepath); // 删除*.dat文件;
- }
- }
- CDialog::OnCancel();
- break;
- case 11:
- if (m_selphotownd.GetSafeHwnd() == NULL)
- {
- m_selphotownd.m_id = m_strOrderNumber;
- m_selphotownd.m_rc = m_rcarray.ElementAt(6);
- m_selphotownd.Create(IDD_DLGShowSelPhoto, this);
- }
- m_selphotownd.ShowWindow(1);
- break;
- case 12:
- ReplaceDesignNo dlg;
- dlg.m_id = this->m_strOrderNumber;
- dlg.DoModal();
- break;
- }
- return 0;
- }
- #endif
- BOOL ChooseDesignSkin::OnEraseBkgnd(CDC* pDC)
- {
- return 1;
- }
- BEGIN_EVENTSINK_MAP(ChooseDesignSkin, CDialog)
- ON_EVENT(ChooseDesignSkin, 100, 150 /* FSCommand */, OnFSCommandShockwaveflash1, VTS_BSTR VTS_BSTR)
- END_EVENTSINK_MAP()
- void ChooseDesignSkin::OnFSCommandShockwaveflash1(LPCTSTR command, LPCTSTR args)
- {
- }
- //------------------------------------------------------------------
- // 函数:OnDblclkList1
- // 描述:处理双击和回车时的图片显示效果;与函数名本身的表达意义不一致,导致歧义!
- // 参数:
- // 返回:
- //------------------------------------------------------------------
- void ChooseDesignSkin::OnDblclkList1()
- {
- // 1.从双击中的列表项中获取相片名;
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- return;
- int iItem = m_List1.GetNextSelectedItem(pos);
- #if JEFF_TEST_OFF
- // 双击列表根本就不做不到多选多击,双击只会选中一个,故GetNextSelectedItem(pos)后,pos=NULL
- // 但是这个函数的作用并不是跟函数名一致,有其他地方用到。
- #else // 这一块代码是用于处理回车键;
- CArray<int, int>posarray;
- posarray.Add(iItem);
- // 获取剩下的图片位置;
- while (pos)
- {
- int iItem = m_List1.GetNextSelectedItem(pos);
- posarray.Add(iItem);
- if (posarray.GetSize() > 3)
- break;
- }
- if (posarray.GetSize() >= 2)
- {
- CStringArray* pPtahArray = NULL;
- pPtahArray = GetCurArray(m_SelectCategory);
-
- CComparePhoto dlg;
- dlg.m_path1 = pPtahArray->ElementAt(posarray.ElementAt(0));
- dlg.m_path2 = pPtahArray->ElementAt(posarray.ElementAt(1));
- if (posarray.GetSize() > 2)
- dlg.m_path3 = pPtahArray->ElementAt(posarray.ElementAt(2));
- if (posarray.GetSize() > 3)
- dlg.m_path4 = pPtahArray->ElementAt(posarray.ElementAt(3));
- dlg.DoModal();
- return;
- }
- #endif //JEFF_TEST_OFF
- CString title = m_List1.GetItemText(iItem, 0);
- if (title.Find("Flash") != -1)
- {
- title.Replace("Flash", "delgabook");
- CString str = m_path + title + "\\delgaBook.exe";
- ShellExecute(NULL, _T("open"), str, NULL, NULL, SW_SHOWNORMAL);
- return;
- }
- m_showpichwd = NULL;
- // 双击小图查看大图;
- ShowPic22 dlg;
- dlg.m_bShowImgInfo = 1;
- dlg.m_pParent = this;
- dlg.m_nCurImgPos = iItem;
- CStringArray* pArray = GetCurArray(m_SelectCategory);
- if(pArray == NULL)
- return;
- dlg.m_AryOfImgPath = pArray;
- dlg.DoModal();
- m_showpichwd = NULL;
- }
- void ChooseDesignSkin::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) // 双击图片列表!
- {
- OnDblclkList1();
- *pResult = 0;
- }
- /************************************************************************/
- /*
- 函数: GetData
- 描述: 选片模式
- 参数:
- 返回:
- 注意:
- */
- /************************************************************************/
- BOOL ChooseDesignSkin::GetData()//选片模式;
- {
- m_List2.DeleteAllItems();
- m_List3.DeleteAllItems();
- m_noarray.RemoveAll();
- m_no2array.RemoveAll();
- m_oldsparray.RemoveAll();
- //选设计
- CString filter = _T("");
- #ifdef CHILD_VERSION
- filter = "id='" + m_strOrderNumber + "';id='" + m_strOrderNumber + "';;;id='" + m_strOrderNumber + "'";
- #else
- filter = "id='" + m_strOrderNumber + "' and kind<>'2';id='" + m_strOrderNumber + "';;;id='" + m_strOrderNumber + "'";
- #endif //CHILD_VERSION
- //订单号、商品编号、商品价格、订单商品数量、商品类型、商品名称、选片选中相片名、自增id、选设计选中相片名;
- g_sendhead.code[0] = 50; // dindansp;
- g_sendhead.code[1] = 11; // dindan
- g_sendhead.code[2] = 4; // shangpin
- g_sendhead.code[3] = 8; // shangpin
- g_sendhead.code[4] = 182; // dindansp3
- g_sendhead.tabcount = 5;
- g_sendhead.bsql = 0;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)
- return 0;
- CArray<CStringArray, CStringArray> sparray; //dindansp表;//订单号、商品编号、商品价格、订单商品数量、商品类型、商品名称、选片选中相片名、自增id、选设计选中相片名;
- DataToArray(&sparray, &g_List1array, &m_sparray, &m_List2array, &m_oldsparray);
- m_SelPhotoPath.RemoveAll();
- CString str(_T("")), kind(_T(""));
- int nchoosezs = 0;
- int list2pos = 0;
- int list3pos = 0;
- CString savepath = _T("");
- savepath.Format(_T("%s\\%s-2.dat"), g_mainpath, m_strOrderNumber);
- CString stm1 = GetModifyTime2(savepath);
- CTime tm1 = CTime::GetCurrentTime();
- tm1 -= CTimeSpan(60, 0, 0, 0);
-
- CString stm2 = tm1.Format(_T("%Y%m%d"));
- BOOL bLoadHistory = 0;
- if (PathFileExists(savepath) && stm1 > stm2)
- {
- if (AfxMessageBox(_T("提醒:请谨慎操作\r\n上次选片未正常退出, 是否还原到上次选片状态?"), MB_YESNO | MB_ICONINFORMATION) == IDYES)
- bLoadHistory = 1;
- }
- int i = 0;
- if (bLoadHistory)
- {
- //还原到上次选片状态
- CArray<CStringArray, CStringArray> List1array;
- //读取数据
- CFile fp;
- fp.Open(savepath, CFile::modeRead);
- DWORD nMessageLen = fp.GetLength();
- BYTE *szChatMessage = new BYTE[nMessageLen];
- fp.Read(szChatMessage, nMessageLen);
- fp.Close();
- int count = 0;
- memcpy(&count, szChatMessage + (nMessageLen - sizeof(int)), sizeof(int));
- CMemFile memfile;
- memfile.Attach(szChatMessage, nMessageLen);
- CArchive ar(&memfile, CArchive::load);
- List1array.SetSize(count);
- for ( i = 0; i < List1array.GetSize(); i++)
- List1array.ElementAt(i).Serialize(ar);
- ar.Close();
- memfile.Detach();
- delete[]szChatMessage;
- list2pos = 0;
- list3pos = 0;
- for (i = 0; i < List1array.GetSize(); i++)
- {
- if (0)//List1array.ElementAt (i).GetSize ()==6)
- {
- kind = "0";
- m_List2.InsertItem(list2pos, List1array.ElementAt(i).ElementAt(1));
- m_List2.SetItemText(list2pos, 1, List1array.ElementAt(i).ElementAt(2));
- m_List2.SetItemText(list2pos, 2, List1array.ElementAt(i).ElementAt(3));
- m_List2.SetItemText(list2pos, 3, List1array.ElementAt(i).ElementAt(4));
- m_List2.SetItemText(list2pos, 4, List1array.ElementAt(i).ElementAt(5));
- str = List1array.ElementAt(i).ElementAt(5);
- list2pos++;
- }
- else
- {
- kind = "4";
- m_List3.InsertItem(list3pos, List1array.ElementAt(i).ElementAt(1));
- m_List3.SetItemText(list3pos, 1, List1array.ElementAt(i).ElementAt(2));
- m_List3.SetItemText(list3pos, 2, List1array.ElementAt(i).ElementAt(3));
- m_List3.SetItemText(list3pos, 3, List1array.ElementAt(i).ElementAt(4));
- m_List3.SetItemText(list3pos, 4, List1array.ElementAt(i).ElementAt(5));
- m_List3.SetItemText(list3pos, 5, List1array.ElementAt(i).ElementAt(6));
- m_List3.SetItemText(list3pos, 6, List1array.ElementAt(i).ElementAt(9));
- #ifdef LKAY_VERSION
- m_List3.SetItemText(list3pos, 6, List1array.ElementAt (i).ElementAt (7));
- m_List3.SetItemText(list3pos, 7, List1array.ElementAt (i).ElementAt (8));
- str=List1array.ElementAt (i).ElementAt (8);
- #else
- str = List1array.ElementAt(i).ElementAt(6);
- #endif //#ifdef LKAY_VERSION
- list3pos++;
- }
- nchoosezs += GetZS(str);
- GetPathAddToSel(str);
- if (!str.IsEmpty())
- {
- #ifdef USE_SEP_VEB
- str = SEPS_VEB + str + SEPS_VEB;
- #else
- str = SEPS_CMA + str + SEPS_CMA;
- #endif //#ifdef USE_SEP_VEB
- }
- str.MakeLower();
- if (kind == _T("4"))
- m_no2array.Add(str);
- else
- m_noarray.Add(str);
- }
- }
- else
- {
- for ( i = 0; i < sparray.GetSize(); i++)
- {
- kind = _T("4");//sparray.ElementAt (i).ElementAt (4);
- if (kind == _T("4"))
- {
- m_List3.InsertItem(list3pos, sparray.ElementAt(i).ElementAt(7)); // dindansp表autoid;
- m_List3.SetItemText(list3pos, 1, sparray.ElementAt(i).ElementAt(1)); // 商品编号;
- m_List3.SetItemText(list3pos, 2, sparray.ElementAt(i).ElementAt(5)); // 商品名称;
- m_List3.SetItemText(list3pos, 3, sparray.ElementAt(i).ElementAt(2)); // 商品价格;
- m_List3.SetItemText(list3pos, 4, sparray.ElementAt(i).ElementAt(3)); // 商品数量;
- #ifdef LKAY_VERSION
- m_List3.SetItemText(list3pos, 5, sparray.ElementAt (i).ElementAt (9)); //
- m_List3.SetItemText(list3pos, 6, sparray.ElementAt (i).ElementAt (10));
- m_List3.SetItemText(list3pos, 7, sparray.ElementAt (i).ElementAt (8));
- #else
- m_List3.SetItemText(list3pos, 5, sparray.ElementAt(i).ElementAt(8)); // 选设计时选中的相片名;
- m_List3.SetItemText(list3pos, 6, sparray.ElementAt(i).ElementAt(9)); // 商品备注;
- #endif
- list3pos++;
- }
- else
- {
- m_List2.InsertItem(list2pos, sparray.ElementAt(i).ElementAt(7)); // dindansp表autoid;
- m_List2.SetItemText(list2pos, 1, sparray.ElementAt(i).ElementAt(1)); // 商品编号;
- m_List2.SetItemText(list2pos, 2, sparray.ElementAt(i).ElementAt(5)); // 商品名称;
- m_List2.SetItemText(list2pos, 3, sparray.ElementAt(i).ElementAt(3)); // 商品数量;
- m_List2.SetItemText(list2pos, 4, sparray.ElementAt(i).ElementAt(8)); // 选设计时选中的相片名;
- list2pos++;
- }
- str = sparray.ElementAt(i).ElementAt(8);
- str.MakeLower();
- nchoosezs += GetZS(str); // 获取no或no2字段中包含的相片名数量;
- GetPathAddToSel(str);
- if (!str.IsEmpty())
- {
- #ifdef USE_SEP_VEB
- str = SEPS_VEB + str + SEPS_VEB;
- #else
- str = SEPS_CMA + str + SEPS_CMA;
- #endif //#ifdef USE_SEP_VEB
- }
- if (kind == _T("4"))
- m_no2array.Add(str);
- else
- m_noarray.Add(str);
- }
- }
- if (g_List1array.GetSize())
- {
- m_name1 = g_List1array.ElementAt(0).ElementAt(4);
- m_name2 = g_List1array.ElementAt(0).ElementAt(5);
- m_phone1 = g_List1array.ElementAt(0).ElementAt(61);
- m_phone2 = g_List1array.ElementAt(0).ElementAt(62);
-
- #ifdef USE_SEP_VEB
- if (!m_name1.IsEmpty())
- m_name = m_name1 + SEPS_VEB;
- m_name += m_name2;
- m_name.TrimRight(SEPS_VEB);
- #else
- if (!m_name1.IsEmpty())
- m_name = m_name1 + SEPS_CMA;
- m_name += m_name2;
- m_name.TrimRight(SEPS_CMA);
- #endif //#ifdef USE_SEP_VEB
- m_waiter3 = g_user.name;
- m_taoxizs = g_List1array.ElementAt(0).ElementAt(9);
- m_time5 = g_List1array.ElementAt(0).ElementAt(22);
- m_takezs = g_List1array.ElementAt(0).ElementAt(23);
- m_choosezs = g_List1array.ElementAt(0).ElementAt(24);
- m_money3 = g_List1array.ElementAt(0).ElementAt(3);
- m_oldmoney3 = m_money3;
- m_bz3 = g_List1array.ElementAt(0).ElementAt(57);
- m_urgent = g_List1array.ElementAt(0).ElementAt(40);
-
- m_delphotos = g_List1array.ElementAt(0).ElementAt(56);// Jeff获取选设计时,被删除的相片,选取的字段delphotos2;.读取正常,保存时未能正确保存到delphotos2字段;
- if ( m_delphotos.GetAt(0) != SEPC_VEB || m_delphotos.GetAt(m_delphotos.GetLength() -1) != SEPC_VEB )
- {
- m_delphotos.TrimLeft(SEPC_VEB);
- m_delphotos.TrimRight(SEPC_VEB);
- m_delphotos = SEPS_VEB + m_delphotos + SEPS_VEB;
- }
- m_status8 = g_List1array.ElementAt(0).ElementAt(55);
- m_time6 = g_List1array.ElementAt(0).ElementAt(48);
- m_time5old = m_time5;
- m_time6old = m_time6;
- m_checkstatus = g_List1array.ElementAt(0).ElementAt(55);
- UpdateData(false);
- }
- else
- {
- m_name1 = _T("");
- m_name2 = _T("");
- m_waiter3 = _T("");
- m_taoxizs = _T("");
- m_time5 = _T("");
- m_takezs = _T("");
- m_choosezs = _T("");
- m_money3 = "";
- m_bz3 = _T("");
- m_urgent = _T("");
- UpdateData(false);
- }
- return 1;
- }
- void ChooseDesignSkin::OnClose()
- {
- /*
- if (m_bModify)
- {
- ShowMsg3 dlg;
- dlg.m_strMsg = _T("提醒, 选片修改未保存, 是否保存后再退出?");
- if(dlg.DoModal() == IDOK)
- OnButton4();
- }
- */
- CDialog::OnClose();
- }
- BOOL ChooseDesignSkin::PreTranslateMessage(MSG* pMsg)
- {
- if (pMsg->message == WM_LBUTTONDOWN)
- {
- g_bNeedDrawParent = 2;
- if (0)
- {//list3
- CPoint pt;
- CRect rc, rc2;
- ::GetCursorPos(&pt);
- m_List3.GetWindowRect(rc2);
- if (rc2.PtInRect(pt) == 0) return CDialog::PreTranslateMessage(pMsg);
- SetTimer(3, 300, NULL);
- }
- }
- else if (0)//pMsg->message==WM_LBUTTONDBLCLK)
- {
- {//list1
- CPoint pt;
- CRect rc, rc2;
- ::GetCursorPos(&pt);
- m_List2.GetWindowRect(rc2);
- if (rc2.PtInRect(pt))
- return 1;
- }
- {//list3
- CPoint pt;
- CRect rc, rc2;
- ::GetCursorPos(&pt);
- m_List3.GetWindowRect(rc2);
- if (rc2.PtInRect(pt) == 0)return CDialog::PreTranslateMessage(pMsg);
- pt.x -= rc2.left;
- pt.y -= rc2.top;
- int iItem = m_List3.GetItemCount() - 1;
- if (iItem < 0)
- {
- m_List3.GetHeaderCtrl()->GetItemRect(0, rc);
- int hei = rc.Height();
- rc.top += hei;
- rc.bottom += hei;
- if (rc.PtInRect(pt))
- {
- m_List3.InsertItem(m_List3.GetItemCount(), "");
- }
- }
- else
- {
- m_List3.GetSubItemRect(iItem, 0, LVIR_BOUNDS, rc);
- int hei = rc.Height();
- rc.top += hei;
- rc.bottom += hei;
- if (rc.PtInRect(pt))
- {
- if (m_List3.GetItemText(iItem, 1).IsEmpty() && m_List3.GetItemText(iItem, 2).IsEmpty())
- return CDialog::PreTranslateMessage(pMsg);
- m_List3.InsertItem(m_List3.GetItemCount(), "");
- }
- POSITION pos;
- pos = m_List3.GetFirstSelectedItemPosition();
- if (pos)
- {
- iItem = m_List3.GetNextSelectedItem(pos);
- m_List3.GetSubItemRect(iItem, 4, LVIR_BOUNDS, rc);
- if (rc.PtInRect(pt))return 1;
- }
- }
- }
- }
- else if (pMsg->message == WM_KEYDOWN)
- {
- if (m_showpichwd)return 1;
- switch (pMsg->wParam)
- {
- case VK_DELETE:
- {
- OnDel();
- //更新绘制
- DrawInterface();
- // LoadPhotos();
- }
- return 1;
- case VK_RETURN:
- OnDblclkList1();
- return 1;
- case VK_F4:
- if (m_bChooseBig == 0)
- return 1;
- if (atoi(g_cominfoarray.ElementAt(0).ElementAt(62)))
- {
- if (m_SelectCategory == INDX_SEL)
- UpdateChooseZS();
- SortArray();
- }
- return 1;
- case VK_F5:
- if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
- {
- OnBtnClick(0, 99 + 4);
- }
- return 1;
- case VK_F1:
- {
- if (m_selphotownd2.GetSafeHwnd() == NULL)
- {
- m_selphotownd2.m_id = m_strOrderNumber;
- m_selphotownd2.m_bGrowthTX = m_bGrowthTX;
- m_selphotownd2.m_seltxname = m_seltxname;
- m_selphotownd2.m_rc = m_rcarray.ElementAt(6);
- m_selphotownd2.Create(IDD_DLGShowSelPhoto2, this);
- }
- m_selphotownd2.ShowWindow(1);
- }
- return 1;
- case VK_F2: //缩略图
- if (m_bChooseBig == 0)
- return 1;
- if (atoi(g_cominfoarray.ElementAt(0).ElementAt(60)))
- {
- m_bHide = !m_bHide;
- LoadPhotos();
- }
- return 1;
- case VK_F6:
- {
- ReplaceDesignNo dlg;
- dlg.m_id = this->m_strOrderNumber;
- dlg.DoModal();
- }
- return 1;
- case VK_ESCAPE:
- {
- return TRUE;
- }
- break;
- }
- }
- else if(pMsg->message == WM_LBUTTONUP)
- {
- CDialog::PreTranslateMessage(pMsg);
- return TRUE;
- }
- return CDialog::PreTranslateMessage(pMsg);
- }
- // 右键选片模式;
- void ChooseDesignSkin::OnRclickList1()
- {
- if (m_bRunning)
- return;
- CMenuXP *pPopup = NULL;
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- return;
- CString path = _T("");
- CStringArray* pArray = NULL;
- int iItem = m_List1.GetNextSelectedItem(pos);
- pArray = GetCurArray(m_SelectCategory);
- path = pArray->ElementAt(iItem); //path//打印出相片完整路径名;
- // 右键看设计模式;
- if (!m_bChooseBig)
- path = path.Right(path.GetLength() - m_path.GetLength());
- else
- path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
- path = path.Left(path.ReverseFind('.'));
- #ifdef USE_SEP_VEB
- path = SEPS_VEB + path + SEPS_VEB; //
- #else
- path = SEPS_CMA + path + SEPS_CMA; //
- #endif //#ifdef USE_SEP_VEB
- // TODO: Add your control notification handler code here
- // 1.创建菜单对象;
- // 1.创建菜单对象;
- pPopup = new CMenuXP;
- pPopup->CYBUTTONMARGIN = 3; // 1.0.按钮范围0~3; 4个菜单;
- pPopup->CreatePopupMenu(); // 1.1.弹出式菜单;
- pPopup->SetMenuStyle(CMenuXP::STYLE_XP);// 1.2.弹出菜单样式;
- // Jeff:m_List2有三列头:编号、商品名称、商品数量;
- //计算菜单最大字符长度
- int i = 0;
- int maxleng = 1;
- {
- CString name, no;
- int count = 0;
- for ( i = 0; i < m_List2.GetItemCount(); i++)
- {
- // name商品名称
- name = m_List2.GetItemText(i, 2);
- no = m_noarray.ElementAt(i);
- maxleng = max(maxleng, name.GetLength());
- }
- count = i;
- for (; i < count + m_no2array.GetSize(); i++)
- {
- name = m_List3.GetItemText(i - count, 2);
- maxleng = max(maxleng, name.GetLength());
- }
- }
- maxleng += 3;
-
- // Jeff:m_List2有三列头:编号、商品名称、商品数量;
- CString scount = _T("");
- CString name, no;
- int count = 0;
- for ( i = 0; i < m_List2.GetItemCount(); i++)
- {
- name = m_List2.GetItemText(i, 2);
- //填充长度
- FillLength(name, maxleng);
- // Jeff,no里为商品名称选中的相片
- no = m_noarray.ElementAt(i);
- GetSelCountFromName(no, scount);
- //添加菜单项
- pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1 + i, name + scount, NULL));// 2.使用AppendODMenu2添加子菜单项;
- //绑定事件ID
- if (no.Find(path) != -1)
- pPopup->CheckMenuItem(IDM_MENUsp1 + i, MF_BYCOMMAND | MF_CHECKED);
- }
- count = i;
- for (; i < count + m_no2array.GetSize(); i++)
- {
- name = m_List3.GetItemText(i - count, 2);
- FillLength(name, maxleng);
- no = m_no2array.ElementAt(i - count);
- GetSelCountFromName(no, scount);
- pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1 + i, name + scount, NULL));
- if (no.Find(path) != -1)
- pPopup->CheckMenuItem(IDM_MENUsp1 + i, MF_BYCOMMAND | MF_CHECKED);
- }
- pPopup->AppendODMenu2(0, new CMenuXPText(32794, "修改要求", NULL));
- //获取当前鼠标位置
- CPoint pt;
- ::GetCursorPos(&pt);
- // 3.使用TrackPopupMenu,正常弹出菜单;
- pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, 0);
- delete pPopup;
- }
- void ChooseDesignSkin::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult)
- {
- if (m_showpichwd)
- return;
- OnRclickList1();
- *pResult = 0;
- }
- //
- /************************************************************************/
- /*
- 函数: OnCommandMenu
- 描述: 弹出菜单处理;
- 参数:
- UINT nID 事件ID
- 返回:
- 注意:
- */
- /************************************************************************/
- void ChooseDesignSkin::OnCommandMenu(UINT nID)
- {
- //看设计事件
- OnCommandMenu2(nID);
- return;
- }
- /************************************************************************/
- /*
- 函数: OnCommandMenu2
- 描述: 看设计,弹出菜单处理;
- 参数:
- UINT nID 事件ID
- 返回:
- 注意:
- */
- /************************************************************************/
- void ChooseDesignSkin::OnCommandMenu2(UINT nID)
- {
- if (32794 == nID)// 处理菜单荐:修改要求;
- {
- //修改要求
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- return;
- }
- int iItem = m_List1.GetNextSelectedItem(pos);
- CStringArray *pArray = GetCurArray(m_SelectCategory);
- CString path = pArray->ElementAt(iItem);
- path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
- path = path.Left(path.Find('.'));
- UpdateData();
- CClientRequirement dlg;
- dlg.m_no = "当前照片:" + path;
- dlg.m_bz2 = m_bz3;
- dlg.m_bSave = 0;
- dlg.m_nMode = 2;
- if (dlg.DoModal() == IDOK)
- {
- m_bz3 = dlg.m_bz2;
- UpdateData(false);
- }
- return;
- }
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- return;
- }
- CString temp;
- m_combo1.ResetContent();
- int aa = 0;
- while (pos) // 开始获取相片;
- {
- // if(aa && m_mode==1)break;
- // if(aa && m_mode==2)break;
- aa++;
- int iItem = m_List1.GetNextSelectedItem(pos);
- CStringArray *pArray = GetCurArray(m_SelectCategory);
- // path:
- CString path = pArray->ElementAt(iItem);
- //AfxMessageBox(path);//Jeff box
- if (m_bChooseBig)//选放大
- path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
- else//选设计
- path = path.Right(path.GetLength() - m_path.GetLength());
- path = path.Left(path.ReverseFind('.'));
- #ifdef USE_SEP_VEB
- path = SEPS_VEB + path + SEPS_VEB; //
- #else
- path = SEPS_CMA + path + SEPS_CMA; //
- #endif //#ifdef USE_SEP_VEB
- int idpos = nID - IDM_MENUsp1;
- BOOL bSel = 0;//选中还是取消
- if (idpos < m_noarray.GetSize())
- {
- //MessageBox("1");
- CString no = m_noarray.ElementAt(idpos); // no:为dindansp字段no;
- //AfxMessageBox(no);//Jeff box
- if (no.Find(path) != -1)
- {
- int pos = no.Find(path);
- no.Delete(pos, path.GetLength() - 1);
- }
- else if (no.GetLength() > 4000)
- {
- AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP); return;
- }
- else
- {
- bSel = 1;
- #ifdef USE_SEP_VEB
- no.TrimRight(SEPS_VEB);
- #else
- no.TrimRight(SEPS_CMA);
- #endif //#ifdef USE_SEP_VEB
- no += path;
- }
- #ifdef USE_SEP_VEB
- no.TrimLeft(SEPS_VEB);
- no.TrimRight(SEPS_VEB);
- #else
- no.TrimLeft(SEPS_CMA);
- no.TrimRight(SEPS_CMA);
- #endif //#ifdef USE_SEP_VEB
- m_List2.SetItemText(idpos, 4, no);
- if (no.IsEmpty())
- m_noarray.SetAt(idpos, no);
- else
- {
- #ifdef USE_SEP_VEB
- m_noarray.SetAt(idpos, SEPS_VEB + no + SEPS_VEB);
- #else
- m_noarray.SetAt(idpos, SEPS_CMA + no + SEPS_CMA);
- #endif //#ifdef USE_SEP_VEB
- }
- }
- else
- {
- idpos -= m_noarray.GetSize();
- CString no = m_no2array.ElementAt(idpos);
- if (no.Find(path) != -1)
- {
- int pos = no.Find(path);
- no.Delete(pos, path.GetLength() - 1);
- }
- else if (no.GetLength() > 4000)
- {
- AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP); return;
- }
- else
- {
- bSel = 1;
- #ifdef USE_SEP_VEB
- no.TrimRight(SEPS_VEB);
- #else
- no.TrimRight(SEPS_CMA);
- #endif //#ifdef USE_SEP_VEB
- no += path;
- }
- #ifdef USE_SEP_VEB
- no.TrimLeft(SEPS_VEB);
- no.TrimRight(SEPS_VEB);
- #else
- no.TrimLeft(SEPS_CMA);
- no.TrimRight(SEPS_CMA);
- #endif //#ifdef USE_SEP_VEB
- #ifdef LKAY_VERSION
- m_List3.SetItemText (idpos, 7, no);
- #else
- m_List3.SetItemText(idpos, 5, no);
- #endif //#ifdef LKAY_VERSION
- if (no.IsEmpty())
- m_no2array.SetAt(idpos, no);
- else
- {
- #ifdef USE_SEP_VEB
- m_no2array.SetAt(idpos, SEPS_VEB + no + SEPS_VEB);
- #else
- m_no2array.SetAt(idpos, SEPS_CMA + no + SEPS_CMA);
- #endif //#ifdef USE_SEP_VEB
- }
- }
- m_bModify = 1;
- if (bSel == 0 && m_SelectCategory == INDX_SEL && IsSelPhoto(path) == 0)
- {
- temp.Format("%d", iItem);
- m_combo1.AddString(temp);
- continue;
- }
- else if (bSel == 1 && m_SelectCategory == INDX_NOSEL)
- {
- temp.Format("%d", iItem);
- m_combo1.AddString(temp);
- continue;
- }
- else if (bSel == 1 && m_SelectCategory == INDX_DEL)
- {
- temp.Format("%d", iItem);
- m_combo1.AddString(temp);
- continue;
- }
- /////////////////////////
- CString no, dir;
- no = pArray->ElementAt(iItem);
- if (m_bChooseBig)//选放大
- no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
- else//选设计
- no = no.Right(no.GetLength() - m_path.GetLength());
- no = no.Left(no.ReverseFind('.'));
- no += GetSelName(no);
- m_List1.SetItemText(iItem, 0, no);
- }
- CArray<int, int>posarray;
- for (int i = m_combo1.GetCount() - 1; i >= 0; i--)
- {
- m_combo1.GetLBText(i, temp);
- posarray.Add(atoi(temp));
- }
- SortArray2(posarray);
- if (posarray.GetSize())
- {
- if (m_SelectCategory == INDX_SEL)
- {
- for (int i = 0; i < posarray.GetSize(); i++)
- {
- m_List1.DeleteItem(posarray.ElementAt(i));
- m_NoSelPhotoPath.Add(m_SelPhotoPath.ElementAt(posarray.ElementAt(i)));
- m_SelPhotoPath.RemoveAt(posarray.ElementAt(i));
- }
- if (m_showpichwd)
- ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
- }
- else if (m_SelectCategory == INDX_NOSEL)
- {
- for (int i = 0; i < posarray.GetSize(); i++)
- {
- m_List1.DeleteItem(posarray.ElementAt(i));
- m_NoSelPhotoPath.RemoveAt(posarray.ElementAt(i));
- }
- if (m_showpichwd)
- ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
- }
- else if (m_SelectCategory == INDX_DEL)
- {
- for (int i = 0; i < posarray.GetSize(); i++)
- {
- m_List1.DeleteItem(posarray.ElementAt(i));
- m_AllPhotoPath.Add(m_DelPhotoPath.ElementAt(posarray.ElementAt(i)));
- m_DelPhotoPath.RemoveAt(posarray.ElementAt(i));
- }
- if (m_showpichwd)
- ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
- }
- }
- CString strFile = m_strOrderNumber + _T("-2.dat");
- Save(g_mainpath, strFile);
- DrawInterface();
- if (m_showpichwd)
- ::SendMessage(m_showpichwd, WM_USER + 200, 0, 0);
- }
- long ChooseDesignSkin::UpdateTakeZS(WPARAM inWParam, LPARAM inLParam)
- {
- if (m_SelectCategory == INDX_ALL && m_List1.GetItemCount() > atoi(m_takezs))
- {
- UpdateData();
- m_takezs.Format("%d", m_List1.GetItemCount());
- UpdateData(false);
- }
- //绘制
- DrawInterface();
- return 1;
- }
- /************************************************************************/
- /*
- 函数: UpdateChooseZS
- 描述: 更新选中相片
- 参数:
- 返回:
- 注意:
- */
- /************************************************************************/
- void ChooseDesignSkin::UpdateChooseZS()
- {
- int i = 0;
- CString str = _T("");
- CStringArray* pSelArr = NULL;
- CStringArray* pAllArr = NULL;
- pSelArr = GetCurArray(INDX_SEL);
- pAllArr = GetCurArray(INDX_ALL);
- pSelArr->RemoveAll();
- if (m_sChooseFilter != _T("") && m_sChooseFilter != _T("全部"))
- {
- for ( i = 0; i < m_List3.GetItemCount(); i++)
- {
- if (m_List3.GetItemText(i, 2) != m_sChooseFilter)
- continue;
- str = m_no2array.ElementAt(i);
- GetPathAddToSel(pSelArr, str, pAllArr);
- }
- return;
- }
- for ( i = 0; i < m_noarray.GetSize(); i++)
- {
- str = m_noarray.ElementAt(i);
- GetPathAddToSel(pSelArr, str, pAllArr);
- }
- for (i = 0; i < m_no2array.GetSize(); i++)
- {
- str = m_no2array.ElementAt(i);
- GetPathAddToSel(pSelArr, str, pAllArr);
- }
- }
- // 保存按钮;
- void ChooseDesignSkin::OnButton4()// 保存按钮;
- {
- UpdateData();
- if (m_SelectCategory != INDX_SEL)
- CalChooseZS(&m_SelPhotoPath, &m_AllPhotoPath);
- CString zs = m_taoxizs;
- int pos = zs.Find("\\");
- if (pos != -1)
- {
- zs = zs.Left(pos);
- }
- m_choosezs.Format("%d", max(0, m_SelPhotoPath.GetSize() - atoi(zs)));
- m_bSaveFail = 0;
- ChoosePhotoSkin3 dlg;
- dlg.m_pParent = this;
- dlg.DoModal();
- if (dlg.m_bSave)
- m_bModify = 0;
- if (dlg.m_bPushedSave == 0 && dlg.m_bSaveFail == 0)
- {
- CString savepath = _T("");
- savepath.Format("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
- ::DeleteFile(savepath); // 删除*.dat文件;
- }
- m_bSaveFail = dlg.m_bSaveFail;
- if (dlg.m_bExit)
- {
- m_bModify = 0;
- CDialog::OnCancel();
- }
- }
- // 删除相片;
- BOOL ChooseDesignSkin::OnDel() // 删除相片;
- {
- // printf("Jeff:m_mode=%d,m_mode2=%d.\n\n",m_mode,m_mode2);//Jeff Printf
- if (m_SelectCategory == INDX_SEL)
- {
- AfxMessageBox("选中照片不能删除, 请先取消选中状态!", MB_ICONINFORMATION);
- return 0;
- }
- else if (m_SelectCategory == INDX_DEL)
- {
- return 0;
- }
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- return 0;
- if (m_bRunning)
- return 0;
- CStringArray* pArray = NULL;
- CString strDelPhotoName = _T("");
- CString strSelPhotoPath = _T("");
- int iItem = m_List1.GetNextSelectedItem(pos);
- int nItemIdx = iItem;
- pArray = GetCurArray(m_SelectCategory);
- strSelPhotoPath = pArray->ElementAt(nItemIdx);
- strDelPhotoName = strSelPhotoPath;
- if(strDelPhotoName == _T("") || pArray == NULL)
- return 0;
- strDelPhotoName = strDelPhotoName.Right(strDelPhotoName.GetLength() - strDelPhotoName.ReverseFind('\\') - 1);
- strDelPhotoName = strDelPhotoName.Left(strDelPhotoName.Find('.'));
- if (IsSelPhoto(strDelPhotoName)) // Jeff 这里有问题,有些订单删除未选中的相片时,会提示box内容。状态:未处理;
- {
- AfxMessageBox(_T("选中的照片不能删除, 请先取消选中状态!"), MB_ICONINFORMATION);
- return 0;
- }
- if (AfxMessageBox(_T("是否删除此照片?"), MB_YESNO | MB_ICONINFORMATION) != IDYES)
- return 0;
- //将要删除的相片添加到删除数组里
- #if JEFF_TEST_ON
- if(PathFileExists(strSelPhotoPath))
- m_DelPhotoPath.Add(strSelPhotoPath);
- #else
- m_DelPhotoPath.Add(strSelPhotoPath);
- #endif //#if JEFF_TEST_ON
- // printf("Jeff:将要删除的相片=%s\n\n",name);// Jeff Printf;
- for(int i = 0; i < pArray->GetSize(); i++)
- {
- //字符串比较相同=0
- if(strSelPhotoPath.CollateNoCase(pArray->ElementAt(i)) == 0)
- {
- pArray->RemoveAt(i);
- m_List1.DeleteItem(iItem);
- break;
- }
- }
- if(m_SelectCategory == INDX_NOSEL)
- DelPhotoFromName(m_AllPhotoPath, strDelPhotoName);
- m_bModify = 1;
- //设置默认选项
- if(iItem >= pArray->GetSize())
- iItem = 0;
- m_List1.SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED);
- return 1;
- }
- void ChooseDesignSkin::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
- {
- *pResult = 0;
- }
- void ChooseDesignSkin::OnTimer(UINT nIDEvent)
- {
- if (nIDEvent == 1)
- {
- KillTimer(nIDEvent);
- if (m_showpichwd)
- ::SendMessage(m_showpichwd, WM_USER + 200, 1, 0);
- TimeOutDlg dlg;
- dlg.m_ticks = m_ticks;
- dlg.DoModal();
- SetTimer(2, m_timer * 60000, NULL);
- }
- else if (nIDEvent == 2) // 定时器触发超时密码对话框;
- {
- KillTimer(nIDEvent);
- if (m_showpichwd)
- ::SendMessage(m_showpichwd, WM_USER + 200, 1, 0);
- TimeOutDlg dlg;
- dlg.m_ticks = m_ticks;
- dlg.DoModal();
- SetTimer(2, m_timer * 60000, NULL);
- }
- else if (nIDEvent == 3)
- {
- KillTimer(nIDEvent);
- //SetSPName3();
- }
- }
- /************************************************************************/
- /*
- 函数: LoadPhotos
- 描述: 加载图片
- 参数:
- 返回:
- */
- /************************************************************************/
- void ChooseDesignSkin::LoadPhotos()
- {
- TerminateThread();
- //清除资源的路径
- ClearResData();
- DWORD tm1(0), tm2(0);
- tm1 = GetTickCount();
- //获取当前查看的相片
- CStringArray *pArray = GetCurArray(m_SelectCategory);
- for (int i = 0; i < pArray->GetSize(); i++)
- {
- CString filePath = pArray->ElementAt(i);
- if(filePath == _T(""))
- continue;
- SResData* pRes = new SResData();
- pRes->nType = (int)TYPE_ICON;
-
- //转为小写
- filePath.MakeLower();
- pRes->strFilePath = filePath;
- m_vResData.push_back(pRes);
- }
- tm2 = GetTickCount();
- printf("绘制图片的准备时间:%dms\n", (tm2-tm1));
- //创建绘画线程LoadThumbNail3
- LoadThumbImages();
- }
- /************************************************************************/
- /*
- 函数: GetNoSelPhoto
- 描述: 未选中的相片
- 参数:
- 返回:
- 注意:
- */
- /************************************************************************/
- void ChooseDesignSkin::GetNoSelPhoto()
- {
- CStringArray* pNoSelArr = NULL;
- CStringArray* pAllArr = NULL;
- CStringArray* pSelArr = NULL;
- pNoSelArr = GetCurArray(INDX_NOSEL);
- pAllArr = GetCurArray(INDX_ALL);
- pSelArr = GetCurArray(INDX_SEL);
- if(pNoSelArr == NULL || pAllArr == NULL || pSelArr == NULL)
- return;
- pNoSelArr->RemoveAll();
- CString str1(_T("")), str2(_T(""));
- for (int i = 0; i < pAllArr->GetSize(); i++)
- {
- BOOL bFind = 0;
- for (int j = 0; j < pSelArr->GetSize(); j++)
- {
- str1 = pAllArr->ElementAt(i);
- str2 = pSelArr->ElementAt(j);
- if (str1.CollateNoCase(str2) == 0)
- {
- bFind = 1;
- break;
- }
- }
- if (bFind == 0)
- pNoSelArr->Add(pAllArr->ElementAt(i));
- }
- }
- /************************************************************************/
- /*
- 函数: OnSelPhoto
- 描述: 查看选中相片
- 参数:
- 返回:
- 注意:
- */
- /************************************************************************/
- void ChooseDesignSkin::OnSelPhoto()
- {
- ProductChooseFilter dlg;
- CString name = _T("");
- int i = 0;
- for ( i = 0; i < m_List2.GetItemCount(); i++)
- {
- name = m_List2.GetItemText(i, 2);
- dlg.m_array.Add(name);
- }
- for (i = 0; i < m_List3.GetItemCount(); i++)
- {
- name = m_List3.GetItemText(i, 2);
- dlg.m_array.Add(name);
- }
- if(dlg.DoModal() == IDCANCEL)
- {
- m_SelectCategory = INDX_ALL;
- return;
- }
- m_sChooseFilter = dlg.m_sChooseFilter;
- UpdateChooseZS();
- }
- /************************************************************************/
- /*
- 函数: GetCurArray
- 描述: 获取要查看的数据
- 参数:
- const int nIndx 选中数据索引
- SFolderInfo* m_pForder 文件夹
- 返回:
- 注意:
- */
- /************************************************************************/
- CStringArray* ChooseDesignSkin::GetCurArray(const int nIndx)
- {
- CStringArray* pArray = NULL;
- switch (nIndx)
- {
- case INDX_ALL: //全部
- pArray = &m_AllPhotoPath;
- break;
- case INDX_SEL: //选中
- pArray = &m_SelPhotoPath;
- break;
- case INDX_NOSEL: //未选
- pArray = &m_NoSelPhotoPath;
- break;
- case INDX_DEL: //删除
- pArray = &m_DelPhotoPath;
- break;
- case INDX_INTOALBUM: //入册
- pArray = &m_IntoAlbumPath;
- break;
- case INDX_ENTRYPHASSE: //入底
- pArray = &m_EntryPhasepath;
- break;
- }
- return pArray;
- }
- /************************************************************************/
- /*
- 函数: SortArray
- 描述: 按F4乱序或排序
- 参数:
- 返回:
- */
- /************************************************************************/
- void ChooseDesignSkin::SortArray()
- {
- int i = 0;
- int j = 0;
- m_bSort = !m_bSort;
- CStringArray *pArray[6] = { &m_AllPhotoPath, &m_SelPhotoPath, &m_NoSelPhotoPath, &m_DelPhotoPath, &m_IntoAlbumPath, &m_EntryPhasepath };
- if (m_bSort == 0)
- {
- for ( i = 0; i < 6; i++)
- {
- if (pArray[i]->GetSize())
- {
- int size = pArray[i]->GetSize() - 1;
- CString sTemp;
- int nPos;
- for (int ii = 0; ii < size; ii++)
- {
- nPos = rand() % (size - ii);
- sTemp = pArray[i]->ElementAt(size - ii);
- pArray[i]->SetAt(size - ii, pArray[i]->ElementAt(nPos));
- pArray[i]->SetAt(nPos, sTemp);
- }
- }
- }
- }
- else
- { // 使用CCombobox的Sort来排序;
- for ( i = 0; i < 6; i++)
- {
- m_combo1.ResetContent();
- CString Temp;
- for ( j = 0; j < pArray[i]->GetSize(); j++)
- {
- m_combo1.AddString(pArray[i]->ElementAt(j));
- }
- for (j = 0; j < pArray[i]->GetSize(); j++)
- {
- m_combo1.GetLBText(j, Temp);
- pArray[i]->SetAt(j, Temp);
- }
- }
- }
- //终止线程
- TerminateThread();
- //清除资源的路径
- ClearResData();
- //获取当前查看的相片
- CStringArray *pArr = GetCurArray(m_SelectCategory);
- if(pArr == NULL)
- return;
- for ( i = 0; i < pArr->GetSize(); i++)
- {
- SResData* pRes = new SResData();
- pRes->nType = (int)TYPE_ICON;
- CString filePath = pArr->ElementAt(i);
- //转为小写
- filePath.MakeLower();
- pRes->strFilePath = filePath;
- m_vResData.push_back(pRes);
- }
- //创建绘画线程LoadThumbNail3
- LoadThumbImages();
- }
- /*-------------------------------------------------------
- 函数名: DrawInterface
- 描述: 绘制界面
- 参数:
- 返回值:
- -------------------------------------------------------*/
- void ChooseDesignSkin::DrawInterface()
- {
- CRect rc(0, 0, 0, 0), rt(0, 0, 0, 0);
- ((MyBmpButton2*)m_picarray.ElementAt(3))->GetWindowRect(rc);
- ScreenToClient(rc);
- int nH = rc.bottom - rc.top;
- rc.right -= (rc.left + 100);
- rc.left = 5;
- rc.top += 10;
- rc.right += 220;
- rc.bottom = rc.top + nH - 10;
- rt.CopyRect(&rc);
- CDC *pDC = GetDC();
- Graphics graph(pDC->GetSafeHdc());
- Rect destinationRect(rc.left, rc.top, rc.Width(), rc.Height());
- RectF layoutRect(rc.left, rc.top, rc.Width(), rc.Height());
- rc.left /= g_fscalex;
- rc.right /= g_fscalex;
- rc.top /= g_fscaley;
- rc.bottom /= g_fscaley;
- // graph.SetSmoothingMode(SmoothingModeHighQuality);
- graph.DrawImage(m_pBk, destinationRect, rc.left, rc.top, rc.Width(), rc.Height(), UnitPixel);
- StringFormat format;
- format.SetAlignment(StringAlignmentNear);
- SolidBrush *Brush = new SolidBrush(Color(255, 255, 255, 255));
- //显示张数
- CString str = _T("");
- str.Format(_T("张数:%d"), m_List1.GetItemCount());
- int leng = GetLengthEx(str);
- BSTR bstr = str.AllocSysString();
- Gdiplus::Font* pFont = new Gdiplus::Font(L"黑体", 11);
- graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
- graph.DrawString(
- bstr,
- leng,
- pFont,
- layoutRect,
- &format,
- Brush);
- SysFreeString(bstr);
-
- delete Brush;
- delete pFont;
- ReleaseDC(pDC);
- }
- CString ChooseDesignSkin::GetZSInfo(int iItem)
- {
- if (m_SelectCategory != INDX_SEL)
- CalChooseZS(GetCurArray(INDX_SEL), GetCurArray(INDX_ALL));
- CString str = _T("");
- CString scount = m_List1.GetItemText(iItem, 0);
- int ncount = 0;
- int npos = scount.Find(_T("\r\n"));
- while (npos != -1)
- {
- ncount++;
- scount = scount.Right(scount.GetLength() - npos - 2);
- npos = scount.Find(_T("\r\n"));
- }
- CString zs = m_taoxizs;
- int pos = zs.Find("\\");
- if (pos != -1)
- zs = zs.Left(pos);
- str.Format(_T("X:%d"), ncount);
- return str;
- }
- /************************************************************************/
- /*
- 函数: GetPathAddToSel
- 描述: 获取路径添加到选中相片
- 参数:
- strName:dindansp表中no或no2字段值;相片名间使用逗号分隔;
- 返回: 1成功,0失败
- */
- /************************************************************************/
- int ChooseDesignSkin::GetPathAddToSel(const CString& strName)
- {
- if(strName == _T(""))
- return 0;
- CStringArray* pSelArr = NULL;
- CStringArray* pAllArr = NULL;
- pSelArr = GetCurArray(INDX_SEL);
- pAllArr = GetCurArray(INDX_ALL);
- GetPathAddToSel(pSelArr, strName, pAllArr);
- return 1;
- }
- /************************************************************************/
- /*
- 函数: GetPathAddToSel
- 描述: 获取路径添加到选中相片
- 参数:
- CStringArray* pSelArr
- const CString& str
- 返回: 1成功,0失败
- */
- /************************************************************************/
- int ChooseDesignSkin::GetPathAddToSel(CStringArray* pSelArr, const CString& strName, CStringArray* pAllArr)
- {
- return ChoosePhotoBase::GetPathAddToSel(pSelArr, strName, pAllArr);
- }
- /************************************************************************/
- /*
- 函数: GetAlbumPhoto
- 描述: 查看入册相片
- 参数:
- 返回:
- */
- /************************************************************************/
- void ChooseDesignSkin::GetAlbumPhoto()
- {
- if (m_SelectCategory == INDX_INTOALBUM)
- return;
- m_SelectCategory = INDX_INTOALBUM;
- CStringArray* pArr = NULL;
- pArr = GetCurArray(m_SelectCategory);
- pArr->RemoveAll();
- CString photosName = _T("");
- int i = 0;
- for (i= 0; i < m_List3.GetItemCount(); i++)
- {
- if (m_List3.GetItemText(i, 2) != _T("入册"))
- continue;
- photosName = m_no2array.ElementAt(i);
- break;
- }
- CStringArray* pAllArry = NULL;
- pAllArry = GetCurArray(INDX_ALL);
- //将入册的相片名
- #ifdef USE_SEP_VEB
- photosName = SEPS_VEB + photosName + SEPS_VEB;
- #else
- photosName = SEPS_CMA + photosName + SEPS_CMA;
- #endif //#ifdef USE_SEP_VEB
- for (i = pAllArry->GetSize() - 1; i >= 0; i--)
- {
- CString strName = _T("");
- strName = pAllArry->ElementAt(i);
- strName = strName.Right(strName.GetLength() - strName.ReverseFind('\\') - 1);
- strName = strName.Left(strName.Find('.'));
- #ifdef USE_SEP_VEB
- strName = SEPS_VEB + strName + SEPS_VEB;
- #else
- strName = SEPS_CMA + strName + SEPS_CMA;
- #endif //#ifdef USE_SEP_VEB
- if (photosName.Find(strName) != -1)
- {
- strName = pAllArry->ElementAt(i);
- pArr->Add(strName);
- }
- }
- }
- /************************************************************************/
- /*
- 函数: GetDiskPhoto
- 描述: 查看入底相片
- 参数:
- 返回:
- */
- /************************************************************************/
- void ChooseDesignSkin::GetDiskPhoto()
- {
- if (m_SelectCategory == INDX_ENTRYPHASSE)
- return;
- m_SelectCategory = INDX_ENTRYPHASSE;
- CStringArray* pArr = NULL;
- pArr = GetCurArray(m_SelectCategory);
- int i = 0;
- pArr->RemoveAll();
- CString photosName = _T("");
- for ( i = 0; i < m_List3.GetItemCount(); i++)
- {
- if (m_List3.GetItemText(i, 2) != _T("入底"))
- continue;
- photosName = m_no2array.ElementAt(i);
- break;
- }
- CStringArray* pAllArry = NULL;
- pAllArry = GetCurArray(INDX_ALL);
- #ifdef USE_SEP_VEB
- photosName = SEPS_VEB + photosName + SEPS_VEB;
- #else
- photosName = SEPS_CMA + photosName + SEPS_CMA;
- #endif //#ifdef USE_SEP_VEB
- for (i = pAllArry->GetSize() - 1; i >= 0; i--)
- {
- CString strName = _T("");
- strName = pAllArry->ElementAt(i);
- strName = strName.Right(strName.GetLength() - strName.ReverseFind('\\') - 1);
- strName = strName.Left(strName.Find('.'));
- #ifdef USE_SEP_VEB
- strName = SEPS_VEB + strName + SEPS_VEB;
- #else
- strName = SEPS_CMA + strName + SEPS_CMA;
- #endif //#ifdef USE_SEP_VEB
- if (photosName.Find(strName) != -1)
- {
- strName = pAllArry->ElementAt(i);
- pArr->Add(strName);
- }
- }
- }
- /************************************************************************/
- /*
- 函数名: ReLoad
- 描述: 重新加载数据
- 参数:
- 返回值:
- */
- /************************************************************************/
- BOOL ChooseDesignSkin::ReLoad()
- {
- return GetData();
- }
- /************************************************************************/
- /*
- 函数: ReLoadPhoto
- 描述: 重新加载相片
- 参数:
- 返回:
- */
- /************************************************************************/
- void ChooseDesignSkin::ReLoadPhoto()
- {
- if (!((MyBmpButton2*)m_picarray.ElementAt(8))->GetPushDown())
- {
- m_path = g_path3 + _T("\\");
- m_path += m_strOrderNumber;
- m_path += _T("\\");
- GetPhotos();
- m_bChooseBig = 0;
- }
- else
- {
- m_bChooseBig = 1;
- //选择此次拍摄名称DLG(如:拍摄景点)
- GetTXName(&m_strOrderNumber, 1, m_bGrowthTX, m_seltxname);
- m_AllPhotoPath.RemoveAll();
- if (IsThereACacheImg()) //
- m_bFromLocal = 1;
- if (m_AllPhotoPath.GetSize() == 0)
- {
- if (IsPhoto2Exist())
- {
- SelBrunDevice dlg;
- dlg.m_mode = 0;
- if (dlg.DoModal() == IDOK)
- m_nChoosePhotoType = dlg.m_sel;
- else
- m_nChoosePhotoType = 0;
- //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片
- }
- else
- AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
- {
- CString path, path2;
- m_path = g_path1 + _T("\\");
- m_path += m_strOrderNumber;
- m_path += _T("\\");
- if (m_seltxname != "" && m_seltxname != _T("全部"))
- {
- m_path += m_seltxname;
- m_path += _T("\\");
- }
- if (m_nChoosePhotoType == 1) // 选片:修片
- {
- m_path = g_path2 + _T("\\");
- m_path += m_strOrderNumber;
- m_path += _T("\\");
- }
- CString filename = _T("");
-
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(m_path), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- path = (*it).c_str();
- if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
- {
- path.MakeLower();
- filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
- if (filename.Find(".") != -1)
- filename = filename.Left(filename.Find("."));
- if (!myisdigit(filename))continue;
- if (m_nChoosePhotoType == 1)
- {
- #if JEFF_TEST_ON
- if (PathFileExists(path))
- m_AllPhotoPath.Add(path);
- #else
- m_AllPhotoPath.Add(path);
- #endif //#if JEFF_TEST_ON
- }
- else
- {
- path2 = path;
- if (m_nChoosePhotoType == 0)
- path2.Replace("客户原片", "修好的片");
- if (m_bGrowthTX == 0)
- {
- int pos = path2.Find(m_strOrderNumber);
- pos += m_strOrderNumber.GetLength();
- int pos2 = path2.ReverseFind('\\');
- path2 = path2.Left(pos) + path2.Right(path2.GetLength() - pos2);
- }
- if (m_nChoosePhotoType == 0 && ::PathFileExists(path2))
- {
- m_AllPhotoPath.Add(path2);
- }
- else
- {
- path2.Replace(".raw", _T(".jpg"));
- if (PathFileExists(path2))
- {
- m_AllPhotoPath.Add(path2);
- continue;
- }
- path2.Replace(".nef", _T(".jpg"));
- if (PathFileExists(path2))
- {
- m_AllPhotoPath.Add(path2);
- continue;
- }
- path2.Replace(".cr2", _T(".jpg"));
- if (PathFileExists(path2))
- {
- m_AllPhotoPath.Add(path2);
- continue;
- }
- else
- {
- if (path.Right(3) != "jpg")
- continue;
- #if JEFF_TEST_ON
- if (PathFileExists(path))
- m_AllPhotoPath.Add(path);
- #else
- m_AllPhotoPath.Add(path);
- #endif //#if JEFF_TEST_ON
- }
- }
- }
- }
- }
- }
- // if(0)
- {//多种修好的效果
- CString path, path2;
- path2 = g_path2 + _T("\\");
- path2 += m_strOrderNumber;
- path2 += _T("\\");
-
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(path2), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- path = (*it).c_str();
- if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
- {
- path.MakeLower();
- path2 = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
- if (path2.Find(_T("-")) != -1)
- {
- #if JEFF_TEST_ON
- if (PathFileExists(path))
- m_AllPhotoPath.Add(path);
- #else
- m_AllPhotoPath.Add(path);
- #endif //#if JEFF_TEST_ON
- }
- }
- }
- }
- }
- if (m_AllPhotoPath.GetSize() && atoi(g_cominfoarray.ElementAt(0).ElementAt(61)))
- {
- int size = m_AllPhotoPath.GetSize() - 1;
- CString sTemp;
- int nPos;
- for (int i = 0; i < size; i++)
- {
- nPos = rand() % (size - i);
- sTemp = m_AllPhotoPath.ElementAt(size - i);
- m_AllPhotoPath.SetAt(size - i, m_AllPhotoPath.ElementAt(nPos));
- m_AllPhotoPath.SetAt(nPos, sTemp);
- }
- }
- }
- m_SelectCategory = INDX_ALL;
- LoadPhotos();
- }
- /************************************************************************/
- /*
- 函数: DrawImageWork
- 描述: 绘制工作
- 参数:
- 返回:
- */
- /************************************************************************/
- void ChooseDesignSkin::DrawImageWork()
- {
- CListCtrl* ListCtrl = &m_List1;
- CImageList* pImgList = &m_ImageListThumb;
- try
- {
- // reset our image list
- for (int i = 0; i < pImgList->GetImageCount(); i++)
- pImgList->Remove(i);
- // remove all items from list view
- ListCtrl->DeleteAllItems();
- pImgList->SetImageCount(m_vResData.size());
- // Set redraw to FALSE to avoid flickering during adding new items
- ListCtrl->SetRedraw(FALSE);
- //添加列表项名
- AddListItemName(ListCtrl);
- //设置重绘并刷新
- ListCtrl->SetRedraw(TRUE);
- ListCtrl->Invalidate();
- //绘制图标
- DrawImage(ListCtrl, pImgList);
- m_bRunning = false;
- m_bTerminate = false;
- PostMessage(WM_USER + 200, 0, 0);
- return;
- }
- catch (...)
- {
- ListCtrl->Invalidate();
- m_bRunning = false;
- m_bTerminate = false;
- PostMessage(WM_USER + 200, 0, 0);
- }
- }
- /************************************************************************/
- /*
- 函数: AddListItemName
- 描述: 添加列表项名
- 参数:
- 返回: 1成功,0失败
- */
- /************************************************************************/
- int ChooseDesignSkin::AddListItemName(CListCtrl* pListCtrl)
- {
- if(pListCtrl == NULL)
- return 0;
- int nIndex = 0;
- CString str(_T("")), spath(_T(""));
- //添加文件名
- vector<SResData*>::iterator iter;
- for(iter = m_vResData.begin(); iter != m_vResData.end() && m_bTerminate != true; iter++, nIndex++)
- {
- SResData* pRes = (*iter);
- if(pRes == NULL)
- continue;
- str = pRes->strFilePath;
- if (str.Left(str.ReverseFind('\\') + 1) != m_path)
- {
- spath = str.Left(str.ReverseFind('\\') + 1);
- spath = spath.Right(spath.GetLength() - m_path.GetLength());
- }
- str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- //添加名字
- if (str.Find("delgabook") != -1)
- {
- str.TrimRight(_T("\\"));
- str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- str.Replace("delgabook", "Flash");
- pListCtrl->InsertItem(nIndex, str, nIndex);
- }
- else
- {
- str = spath + str.Left(str.GetLength() - 4);
- CString temp = GetSelName(str);
- pListCtrl->InsertItem(nIndex, str + temp, nIndex);
- }
- }
- return 1;
- }
- /************************************************************************/
- /*
- 函数: DrawImage
- 描述: 绘制
- 参数:
- 返回:
- */
- /************************************************************************/
- void ChooseDesignSkin::DrawImage(CListCtrl* pListCtrl, CImageList* pImgList)
- {
- if(pListCtrl == NULL)
- return;
- int nIndex = 0;
- Image* pHideImg = NULL; //相片图标
- CString str(_T("")), spath(_T(""));
- vector<SResData*>::iterator iter;
- for (iter = m_vResData.begin(); iter != m_vResData.end() && m_bTerminate != true; iter++, nIndex++)
- {
- // Load Image File
- Image *image = NULL;
- Bitmap *pBmp = NULL;
- SResData* pRes = (*iter);
- if(pRes == NULL)
- continue;
- BOOL bNullimg = FALSE;
- //加载相片图标res\未标题-1.jpg
- switch(pRes->nType)
- {
- case TYPE_ICON: //相片图标
- {
- if(m_bHide && pHideImg == NULL)
- pHideImg = m_pHideImg;
- //是否要重新加载资源
- if(pHideImg == NULL)
- {
- ReLoadImageFromRes(&image, pRes->strFilePath, bNullimg);
- if(image == NULL)
- continue;
- }
- else
- image = pHideImg;
- }
- break;
- }
- //创建bitmap使用颜色填充区域
- SolidBrush whitebrush(Color(255, 255, 255, 255));
- pBmp = new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB);
- Graphics graph2(pBmp);
- graph2.Clear(Color(255, 192, 192, 192));
- graph2.FillRectangle(&whitebrush, 1, 1, THUMBNAIL_WIDTH - 2, THUMBNAIL_HEIGHT - 2);
- // 缩放图片符合画布大小
- Rect desRect(0, 0, 0, 0);
- ZoomImage(image, desRect);
-
- // 绘制图标res\未标题-1.jpg
- Graphics graph(pBmp);
- graph.DrawImage(image, desRect, 0, 0, image->GetWidth(), image->GetHeight(), UnitPixel);
- // 将图片替换bitmap添加到图标列表
- CBitmap bitmap;
- HBITMAP hbmp;
- pBmp->GetHBITMAP(Color(255, 255, 255, 255), &hbmp);
- bitmap.Attach(hbmp);
- pImgList->Replace(nIndex, &bitmap, NULL);
- if(pBmp)
- delete pBmp;
- // Redraw only a current item for removing flickering and fast speed.
- pListCtrl->RedrawItems(nIndex, nIndex);
- // Release used DC and Object
- if(image && pRes->nType == TYPE_ICON && pHideImg == NULL)
- delete image;
- }
- pListCtrl->Invalidate();
- }
|