123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671 |
- // Worker.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "Worker.h"
- #include "MyMdi.H"
- #include "ShowPhoto.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // Worker
- IMPLEMENT_DYNCREATE(Worker, MyFormView)
- Worker::Worker()
- : MyFormView(Worker::IDD)
- {
- //{{AFX_DATA_INIT(Worker)
- m_bz = _T("");
- m_sex = _T("");
- m_id = _T("");
- m_phone = _T("");
- m_address = _T("");
- m_name = _T("");
- m_address2 = _T("");
- m_idno = _T("");
- m_loginno1 = _T("");
- m_loginno2 = _T("");
- m_pImg=NULL;
- //}}AFX_DATA_INIT
- }
- Worker::~Worker()
- {
- if(m_pImg)delete m_pImg;
- }
- void Worker::DoDataExchange(CDataExchange* pDX)
- {
- MyFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(Worker)
- DDX_Control(pDX, IDC_COMBOlevel, m_combolevel);
- DDX_Control(pDX, IDC_COMBOdimission, m_combodimission);
- DDX_Control(pDX, IDC_COMBOmarry, m_combomarry);
- DDX_Control(pDX, IDC_COMBOsex, m_combosex);
- DDX_Control(pDX, IDC_COMBObm, m_combobm);
- DDX_Control(pDX, IDC_LIST2, m_List1);
- DDX_Control(pDX, IDC_STATIC1, m_static1);
- DDX_Text(pDX, IDC_EDITbz, m_bz);
- DDV_MaxChars(pDX, m_bz, 1000);
- DDX_Text(pDX, IDC_EDITid, m_id);
- DDX_Text(pDX, IDC_EDITphone, m_phone);
- DDX_Text(pDX, IDC_EDITaddress, m_address);
- DDX_Text(pDX, IDC_EDITname, m_name);
- DDX_Text(pDX, IDC_EDITaddress2, m_address2);
- DDX_Text(pDX, IDC_EDITidno, m_idno);
- DDX_Text(pDX, IDC_EDITloginno1, m_loginno1);
- DDX_Text(pDX, IDC_EDITloginno2, m_loginno2);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(Worker, MyFormView)
- //{{AFX_MSG_MAP(Worker)
- ON_BN_CLICKED(IDC_BUTsave, OnBUTsave)
- ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
- ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
- ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
- ON_BN_CLICKED(IDC_BUTadd, OnBUTadd)
- ON_BN_CLICKED(IDC_BUTAutoGet, OnBUTAutoGet)
- ON_BN_CLICKED(IDC_BUTload, OnBUTload)
- ON_BN_CLICKED(IDC_BUTdel2, OnBUTdel2)
- ON_WM_PAINT()
- ON_WM_LBUTTONDOWN()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // Worker diagnostics
- #ifdef _DEBUG
- void Worker::AssertValid() const
- {
- MyFormView::AssertValid();
- }
- void Worker::Dump(CDumpContext& dc) const
- {
- MyFormView::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // Worker message handlers
- void Worker::OnInitialUpdate()
- {
- MyFormView::OnInitialUpdate();
- // TODO: Add your specialized code here and/or call the base class
- CMyMdi Mdi;
- Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
-
- // Here we create the outbar control using the splitter as its parent
- // and setting its id to the first pane.
- CRect rc2;
- GetWindowRect(rc2);
- ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
- EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
- m_combobm.GetWindowRect (rc2);
- ScreenToClient(rc2);
- rc2.bottom +=200;
- m_combobm.MoveWindow (rc2);
- m_combosex.GetWindowRect (rc2);
- ScreenToClient(rc2);
- rc2.bottom +=200;
- m_combosex.MoveWindow (rc2);
- m_combomarry.GetWindowRect (rc2);
- ScreenToClient(rc2);
- rc2.bottom +=200;
- m_combomarry.MoveWindow (rc2);
- m_combodimission.GetWindowRect (rc2);
- ScreenToClient(rc2);
- rc2.bottom +=200;
- m_combodimission.MoveWindow (rc2);
- m_combolevel.GetWindowRect (rc2);
- ScreenToClient(rc2);
- rc2.bottom +=200;
- m_combolevel.MoveWindow (rc2);
- GetDlgItem(IDC_BUTsave)->EnableWindow(IsHasRights2new(27));
- GetDlgItem(IDC_BUTdel)->EnableWindow(IsHasRights2new(27));
- m_static1.SetFont (&g_titlefont);
- m_List1.SetHeadings( "编号, 60;姓名, 60;部门, 60;性别, 60;电话, 60;地址, 60;指纹1,60;指纹2,60;文件权限,60" );
- m_List1.LoadColumnInfo (101);
- g_sendhead.bsql=0;
- g_sendhead.code[0]=3;
- g_sendhead.tabcount=1;
- g_pMainWnd->ProcessChatMessageRequest2(3);if(g_bSendOK==0)return;
- DataToArray(&g_List1array);
- for(int i=0; i<g_List1array.GetSize (); i++)
- m_combobm.AddString (g_List1array.ElementAt (i).ElementAt (0));
- m_combosex.AddString ("女");
- m_combosex.AddString ("男");
- m_combomarry.AddString ("未婚");
- m_combomarry.AddString ("已婚");
- m_combodimission.AddString ("在职");
- m_combodimission.AddString ("离职");
- m_combolevel.AddString("1级");
- m_combolevel.AddString("2级");
- m_combolevel.AddString("3级");
- m_combolevel.AddString("4级");
- m_combolevel.AddString("5级");
- m_combolevel.SetCurSel(0);
- GetData();
- }
- void Worker::FillGrid()
- {
- m_List1.DeleteAllItems2 ();
- int ii=0;
- m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
- int count=0;
- for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
- {
- m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
- }
- m_List1.m_arLabels.SetSize(count, 1);
- ii=count;
- m_List1.m_LabelCount=ii;
- m_List1.SetItemCountEx (ii);
- OnBUTadd() ;
- }
- void Worker::OnBUTclose()
- {
- // TODO: Add your control notification handler code here
- GetParent()->SendMessage(WM_CLOSE);
- }
- void Worker::ClearCtrl()
- {
- m_bz = _T("");
- m_sex = _T("");
- m_id = _T("");
- m_phone = _T("");
- m_address = _T("");
- m_name = _T("");
- m_address2 = _T("");
- m_idno = _T("");
- m_loginno1 = _T("");
- m_loginno2 = _T("");
- m_combolevel.SetCurSel(0);
- UpdateData(false);
- if(m_pImg)delete m_pImg;m_pImg=NULL;
- CRect rc;
- GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
- ScreenToClient(rc);
- InvalidateRect(rc);
- }
- void Worker::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- // TODO: Add your control notification handler code here
- ListSelChange();
- *pResult = 0;
- }
- void Worker::ListSelChange()
- {
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- OnBUTadd();
- return;
- }
- int iItem=m_List1.GetNextSelectedItem(pos);
- m_oldid=m_List1.GetItemText (iItem, 0);
- m_oldname=m_List1.GetItemText (iItem, 1);
- CString level;
- for(int ii=0; ii<m_List1arrayBak.GetSize (); ii++)
- {
- if(m_List1arrayBak.ElementAt (ii).ElementAt (0)==m_oldid)
- {
- GetDlgItem(IDC_BUTload)->EnableWindow(1);
- GetDlgItem(IDC_BUTdel2)->EnableWindow(1);
- CString bm,marry,dimission;
- m_id = m_List1arrayBak.ElementAt (ii).ElementAt (0);
- m_name = m_List1arrayBak.ElementAt (ii).ElementAt (1);
- bm = m_List1arrayBak.ElementAt (ii).ElementAt (2);
- m_sex = m_List1arrayBak.ElementAt (ii).ElementAt (3);
- m_phone = m_List1arrayBak.ElementAt (ii).ElementAt (4);
- m_address = m_List1arrayBak.ElementAt (ii).ElementAt (5);
- m_bz = m_List1arrayBak.ElementAt (ii).ElementAt (6);
- m_address2 = m_List1arrayBak.ElementAt (ii).ElementAt (7);
- m_idno = m_List1arrayBak.ElementAt (ii).ElementAt (8);
- marry = m_List1arrayBak.ElementAt (ii).ElementAt (9);
- dimission = m_List1arrayBak.ElementAt (ii).ElementAt (10);
- m_loginno1 = m_List1arrayBak.ElementAt (ii).ElementAt (11);
- m_loginno2 = m_List1arrayBak.ElementAt (ii).ElementAt (12);
- level= m_List1arrayBak.ElementAt (ii).ElementAt (13);
- UpdateData(false);
- int pos=m_combobm.FindString (0, bm);
- m_combobm.SetCurSel (pos);
- pos=m_combosex.FindString (0, m_sex);
- m_combosex.SetCurSel (pos);
- pos=m_combomarry.FindString (0, marry);
- m_combomarry.SetCurSel (pos);
- pos=m_combodimission.FindString (0, dimission);
- m_combodimission.SetCurSel (pos);
- pos=m_combolevel.FindString (0, level);
- m_combolevel.SetCurSel (pos);
- char no[100];
- memset(no, 0, 100);
- strcpy(no, m_id);
- g_nSendCode=27;
- g_pMainWnd->ProcessChatMessageRequest2((BYTE*)no, 100);
- g_nSendCode=0;
- if(g_bSendOK==0)
- {
- return;
- }
- // g_pData, g_nLeng
- if(m_pImg)delete m_pImg;m_pImg=NULL;
- ::LoadImageFromBuf (&m_pImg, g_pData, g_nLeng);
- if(m_pImg==NULL)
- {
- AfxMessageBox("无效图片文件!");return;
- }
- CRect rc;
- GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
- ScreenToClient(rc);
- InvalidateRect(rc);
- return;
- }
- }
- }
- void Worker::OnBUTadd()
- {
- // TODO: Add your control notification handler code here
- m_oldid.Empty ();
- m_oldname.Empty ();
- ClearCtrl();OnBUTAutoGet();
- GetDlgItem(IDC_BUTload)->EnableWindow(0);
- GetDlgItem(IDC_BUTdel2)->EnableWindow(0);
- }
- void Worker::OnBUTsave() // Jeff:保存按钮;
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- if(m_id.IsEmpty () || m_name.IsEmpty () || m_phone.IsEmpty () || m_address.IsEmpty () ||m_address2.IsEmpty () || m_idno.IsEmpty ())
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);
- return;
- }
- m_loginno1.TrimLeft();
- m_loginno1.TrimRight();
- m_loginno1.TrimLeft("0");
- m_loginno2.TrimLeft();
- m_loginno2.TrimRight();
- m_loginno2.TrimLeft("0");
- CString sql;
- CString bm,dimission,marry,level;
- int pos = m_combobm.GetCurSel();
- if(pos==-1)
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);return;
- }
- m_combobm.GetLBText(pos, bm);
- pos=m_combosex.GetCurSel ();
- if(pos==-1)
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);return;
- }
- m_combosex.GetLBText(pos, m_sex);
- pos=m_combomarry.GetCurSel();
- if(pos==-1)
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);return;
- }
- m_combomarry.GetLBText(pos, marry);
- pos=m_combodimission.GetCurSel();
- if(pos==-1)
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);return;
- }
- m_combodimission.GetLBText(pos, dimission);
- #if 1 // Jeff Modify.开启文件夹权限设置;
- pos=m_combolevel.GetCurSel();
- if(pos==-1)
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);return;
- }
- m_combolevel.GetLBText(pos, level);
- #else
- level = "1";
- #endif
- if(m_oldid.IsEmpty())//新增
- {
- if(IsExist())
- {
- AfxMessageBox("已有此编号或姓名或指纹的员工,请重新输入!", MB_ICONINFORMATION);
- return;
- }
- sql.Format ("insert into renyuan(bm,id,name,sex,phone,address,bz,address2,idno,marry,dimission,loginno1,loginno2,level) values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", bm, m_id,m_name,m_sex,m_phone,m_address,m_bz,m_address2,m_idno,marry,dimission,m_loginno1,m_loginno2,level);
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- GetData();
- }
- else//修改
- {
- if(m_oldid!=m_id)
- {
- if(IsExistID())
- {
- AfxMessageBox("已有此编号的员工,请重新输入!", MB_ICONINFORMATION);
- return;
- }
- }
- if(m_oldname!=m_name)
- {
- if(IsExistName())
- {
- AfxMessageBox("已有此姓名的员工,请重新输入!", MB_ICONINFORMATION);
- return;
- }
- }
- sql.Format ("update renyuan set bm='%s',id='%s',name='%s',sex='%s',phone='%s',address='%s',bz='%s',address2='%s',idno='%s',marry='%s',dimission='%s',loginno1='%s',loginno2='%s',level='%s' where id='%s'", bm,m_id,m_name,m_sex,m_phone,m_address,m_bz,m_address2,m_idno,marry,dimission, m_loginno1,m_loginno2,level,m_oldid);
- if(m_oldname!=m_name)
- {
- sql+="***update [user] set [name]='"+m_name+"' where [name]='"+m_oldname+"'";
- }
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- GetData();
- }
- }
- void Worker::OnBUTdel()
- {
- // TODO: Add your control notification handler code here
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- return;
- }
- if(AfxMessageBox("确认删除吗?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return;
- int iItem=m_List1.GetNextSelectedItem(pos);
- CString id=m_List1.GetItemText (iItem, 0);
- CString sql;
- sql.Format ("delete from renyuan where id='%s' ", id);
- sql+=RENYUAN_REF;
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- GetData();
- }
- void Worker::GetData()
- {
- g_sendhead.bsql=0;
- g_sendhead.code[0]=5;
- g_sendhead.tabcount=1;
- int g_nYearposTemp=g_nYearpos;
- g_nYearpos=-1;
- g_pMainWnd->ProcessChatMessageRequest2(1);
- g_nYearpos=g_nYearposTemp;
- if(g_bSendOK==0)return;
- DataToArray(&m_List1array);
- m_List1arrayBak.SetSize(m_List1array.GetSize ());
- for(int i=0; i<m_List1array.GetSize (); i++)
- {
- m_List1arrayBak.ElementAt (i).Copy (m_List1array.ElementAt (i));
- m_List1array.ElementAt (i).RemoveAt(6,5);
- }
- FillGrid();
- g_userarray.SetSize( m_List1arrayBak.GetSize (), 1 );
- int count=0;
- for(int ii=0; ii<m_List1arrayBak.GetSize (); ii++)
- {
- if(m_List1arrayBak.ElementAt (ii).ElementAt (10)=="在职")
- g_userarray.ElementAt (count++).Copy (m_List1arrayBak.ElementAt (ii));
- }
- g_userarray.SetSize( count, 1 );
- }
- BOOL Worker::IsExist()
- {
- CString str1,str2;
- for(int i=0; i<m_List1arrayBak.GetSize (); i++)
- {
- if(m_id==m_List1arrayBak.ElementAt (i).ElementAt (0))return 1;
- if(m_name==m_List1arrayBak.ElementAt (i).ElementAt (1))return 1;
- str1=m_loginno1;
- str2=m_List1arrayBak.ElementAt (i).ElementAt (11);
- str1.TrimLeft("0");
- str2.TrimLeft("0");
- if(str1==str2 && str1!="")return 1;
- str1=m_loginno2;
- str2=m_List1arrayBak.ElementAt (i).ElementAt (12);
- str1.TrimLeft("0");
- str2.TrimLeft("0");
- if(str1==str2 && str1!="")return 1;
- }
- return 0;
- }
- BOOL Worker::IsExistID()
- {
- for(int i=0; i<m_List1arrayBak.GetSize (); i++)
- {
- if(m_id==m_List1arrayBak.ElementAt (i).ElementAt (0))return 1;
- }
- return 0;
- }
- BOOL Worker::IsExistName()
- {
- for(int i=0; i<m_List1arrayBak.GetSize (); i++)
- {
- if(m_name==m_List1arrayBak.ElementAt (i).ElementAt (1))return 1;
- }
- return 0;
- }
- BOOL Worker::PreTranslateMessage(MSG* pMsg)
- {
- // TODO: Add your specialized code here and/or call the base class
- try
- {
- if(pMsg->message==WM_KEYDOWN)
- {
- switch (pMsg->wParam)
- {
- case 0x43: // copy
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_COPY);
- return TRUE;
- }
- break;
- case 0x56: //Ctrl + V:
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_PASTE);
- return TRUE;
- }
- break;
- case 0x58: // cut
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_CUT);
- return TRUE;
- }
- break;
- case 0x5A: //undo
- case 0x59: //redo
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_UNDO);
- return TRUE;
- }
- break;
- }
- }
- return MyFormView::PreTranslateMessage(pMsg);
- }
- catch(...)
- {
- }
- }
- void Worker::OnBUTAutoGet()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- int begin=1;
- BOOL bFind=1;
- while(bFind)
- {
- int i = 0;
- m_id.Format ("%03d", begin++);
- for( i=0; i< m_List1arrayBak.GetSize (); i++)
- {
- if(m_id==m_List1arrayBak.ElementAt (i).ElementAt (0))
- {
- break;
- }
- }
- if(i==m_List1arrayBak.GetSize ())bFind=0;
- }
- UpdateData(false);
- }
- void Worker::OnBUTload()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- CFileDialog fdlg(true, NULL,"", OFN_HIDEREADONLY, "jpg files(*jpg)|*.jpg||");
- if(fdlg.DoModal ()!=IDOK)return;
- CString path=fdlg.GetPathName();
- CFile fp;
- if(!fp.Open(path, CFile::modeRead))
- {
- AfxMessageBox("文件打开失败!");
- return;
- }
- DWORD length=fp.GetLength();
- if(length>1024*200)
- {
- AfxMessageBox("文件太大,请上传小于200K的图片!");
- fp.Close();
- return;
- }
- BYTE *m_pData=new BYTE[length+100];
- fp.Read(m_pData, length);
- fp.Close();
- char no[100];
- memset(no, 0, 100);
- strcpy(no, m_id);
- memcpy(m_pData+length, no, 100);
- if(m_pImg)delete m_pImg;m_pImg=NULL;
- ::LoadImageFromBuf (&m_pImg, path);
- if(m_pImg==NULL)
- {
- AfxMessageBox("无效图片文件!");return;
- }
- g_nSendCode=26;
- g_pMainWnd->ProcessChatMessageRequest2(m_pData, length+100);
- g_nSendCode=0;
- delete []m_pData;
- if(g_bSendOK==0)
- {
- if(m_pImg)delete m_pImg;m_pImg=NULL;
- return;
- }
- AfxMessageBox("上传成功!");
- CRect rc;
- GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
- ScreenToClient(rc);
- InvalidateRect(rc);
- }
- void Worker::OnBUTdel2()
- {
- // TODO: Add your control notification handler code here
- if(AfxMessageBox("确认删除吗?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return;
- UpdateData();
- char no[100];
- memset(no, 0, 100);
- strcpy(no, m_id);
- g_nSendCode=26;
- g_pMainWnd->ProcessChatMessageRequest2((BYTE*)no, 100);
- g_nSendCode=0;
- if(g_bSendOK==0)
- {
- return;
- }
- if(m_pImg)delete m_pImg;m_pImg=NULL;
- CRect rc;
- GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
- ScreenToClient(rc);
- InvalidateRect(rc);
- }
- void Worker::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
- // TODO: Add your message handler code here
- if(m_pImg)
- {
- CRect rc;
- GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
- ScreenToClient(rc);
- RectFitDes(m_pImg->GetWidth(), m_pImg->GetHeight(), rc);
- Graphics dcgraph(dc.GetSafeHdc());
- Rect destinationRect(rc.left , rc.top , rc.Width (), rc.Height ());
- dcgraph.DrawImage(m_pImg, destinationRect, 0,0,m_pImg->GetWidth(), m_pImg->GetHeight(),UnitPixel);
- }
- // Do not call MyFormView::OnPaint() for painting messages
- }
- void Worker::OnLButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- CRect rc;
- GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
- ScreenToClient(rc);
- if(rc.PtInRect(point) && m_pImg)
- {
- ShowPhoto dlg;
- dlg.m_pImg=m_pImg;
- dlg.DoModal();
- }
- MyFormView::OnLButtonDown(nFlags, point);
- }
|