BOOL CChangeFmtDlg::OnInitDialog() { CDialog::OnInitDialog(); switch (m_fmt) { case D3DFMT_A8R8G8B8: m_iFmt = 0; break; case D3DFMT_A1R5G5B5: m_iFmt = 1; break; case D3DFMT_A4R4G4B4: m_iFmt = 2; break; case D3DFMT_R8G8B8: m_iFmt = 3; break; case D3DFMT_R5G6B5: m_iFmt = 4; break; case D3DFMT_X8R8G8B8: m_iFmt = 5; break; case D3DFMT_X1R5G5B5: m_iFmt = 6; break; case D3DFMT_R3G3B2: m_iFmt = 7; break; case D3DFMT_A8R3G3B2: m_iFmt = 8; break; case D3DFMT_X4R4G4B4: m_iFmt = 9; break; case D3DFMT_DXT1: m_iFmt = 10; break; case D3DFMT_DXT2: m_iFmt = 11; break; case D3DFMT_DXT3: m_iFmt = 12; break; case D3DFMT_DXT4: m_iFmt = 13; break; case D3DFMT_DXT5: m_iFmt = 14; break; } UpdateFmtDesc(); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CChangeFmtDlg::OnInitDialog() { CDialog::OnInitDialog(); CComboBox *pComboBox = (CComboBox*) GetDlgItem(IDC_D3DFMT_COMBO); TCHAR strFmtLabel[MAX_PATH] = {0}; for( int i = 0; i < fmtInfoArraySize; i++ ) { // Create the texture label StringCchPrintf( strFmtLabel, MAX_PATH, TEXT("%s %i-bit: %s"), fmtInfoArray[i].strType, fmtInfoArray[i].nBitsPerTexel, fmtInfoArray[i].strName ); // Add the label to the combo box pComboBox->AddString( strFmtLabel ); // If the newly-added texture matches the current image format, // store this index if( m_fmt == fmtInfoArray[i].fmt ) m_iFmt = i; } m_iFmtInitial = m_iFmt; UpdateFmtDesc(); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CChangeFmtDlg::OnChangeFmt() { UpdateData(TRUE); UpdateFmtDesc(); }