www.pudn.com > speech1.rar > WorkSet.cpp
// WorkSet.cpp : implementation file
//
#include "stdafx.h"
#include "Specch.h"
#include "WorkSet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWorkSet dialog
CWorkSet::CWorkSet(CWnd* pParent /*=NULL*/)
: CDialog(CWorkSet::IDD, pParent)
{
//{{AFX_DATA_INIT(CWorkSet)
m_speakType = _T("");
m_speakContent = _T("");
m_warnType = -1;
//}}AFX_DATA_INIT
m_bChangeMusic = false ;
m_strVoiceType[0] = "Mary" ;
m_strVoiceType[1] = "Mike" ;
m_strVoiceType[2] = "Sam" ;
m_strVoiceType[3] = "Chinese" ;
}
void CWorkSet::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CWorkSet)
DDX_CBString(pDX, IDC_COMBO1, m_speakType);
DDX_Text(pDX, IDC_EDIT1, m_speakContent);
DDX_Radio(pDX, IDB_BLEBCUE, m_warnType);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CWorkSet, CDialog)
//{{AFX_MSG_MAP(CWorkSet)
ON_BN_CLICKED(IDB_BROWSE, OnBrowse)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWorkSet message handlers
BOOL CWorkSet::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
// 在CComboBox框中加入可选择的声音类型
// CString StrVoiceType[4] = {"Mary" , "Mike" , "Sam" , "Chinese"} ;
for (int j = 0 ; j < 4 ; j++)
{
((CComboBox*)GetDlgItem(IDC_COMBO1))->AddString(m_strVoiceType[j]) ;
}
((CComboBox*)GetDlgItem(IDC_COMBO1))->SetCurSel(m_type) ;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CWorkSet::OnOK()
{
// TODO: Add extra validation here
m_type = ((CComboBox*)GetDlgItem(IDC_COMBO1))->GetCurSel() ;
CDialog::OnOK();
}
void CWorkSet::OnBrowse()
{
// TODO: Add your control notification handler code here
CFileDialog fileDlg(true ,NULL , NULL , OFN_HIDEREADONLY ,
"波形声音文件(*.wav)|*.wav|所有文件(*.*)|*.*||");
if(fileDlg.DoModal() == IDOK)
{
m_bChangeMusic = true ;
m_musicPath = fileDlg.GetPathName() ;
UpdateData(FALSE) ;
}
}
void CWorkSet::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
HBITMAP hbitmap = ::LoadBitmap(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP7));
//create a memory DC
HDC hMemDC = ::CreateCompatibleDC(NULL);
//select the bitmap in the memory dc
SelectObject(hMemDC, hbitmap);
//copy the memory dc into the screen dc
::StretchBlt(dc.m_hDC, 0,0,400,500,hMemDC,215,75,250,300,SRCCOPY);
//Delete the memory dc and the bitmap
::DeleteDC(hMemDC);
::DeleteObject(hbitmap);
// Do not call CDialog::OnPaint() for painting messages
}