BOOL CConfigSound::OnInitDialog() { CPropertyPage::OnInitDialog(); CComboBox *pSampleRate = static_cast<CComboBox*>(GetDlgItem(IDC_SAMPLE_RATE)); CComboBox *pSampleSize = static_cast<CComboBox*>(GetDlgItem(IDC_SAMPLE_SIZE)); CComboBox *pDevices = static_cast<CComboBox*>(GetDlgItem(IDC_DEVICES)); CSliderCtrl *pBufSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_BUF_LENGTH)); CSliderCtrl *pBassSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_BASS_FREQ)); CSliderCtrl *pTrebleSliderFreq = static_cast<CSliderCtrl*>(GetDlgItem(IDC_TREBLE_FREQ)); CSliderCtrl *pTrebleSliderDamping = static_cast<CSliderCtrl*>(GetDlgItem(IDC_TREBLE_DAMP)); CSliderCtrl *pVolumeSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_VOLUME)); // Set ranges pBufSlider->SetRange(1, MAX_BUFFER_LEN); pBassSlider->SetRange(16, 4000); pTrebleSliderFreq->SetRange(20, 20000); pTrebleSliderDamping->SetRange(0, 90); pVolumeSlider->SetRange(0, 100); CSettings *pSettings = theApp.GetSettings(); // Read settings switch (pSettings->Sound.iSampleRate) { case 11025: pSampleRate->SelectString(0, _T("11 025 Hz")); break; case 22050: pSampleRate->SelectString(0, _T("22 050 Hz")); break; case 44100: pSampleRate->SelectString(0, _T("44 100 Hz")); break; case 48000: pSampleRate->SelectString(0, _T("48 000 Hz")); break; case 96000: pSampleRate->SelectString(0, _T("96 000 Hz")); break; } switch (pSettings->Sound.iSampleSize) { case 16: pSampleSize->SelectString(0, _T("16 bit")); break; case 8: pSampleSize->SelectString(0, _T("8 bit")); break; } pBufSlider->SetPos(pSettings->Sound.iBufferLength); pBassSlider->SetPos(pSettings->Sound.iBassFilter); pTrebleSliderFreq->SetPos(pSettings->Sound.iTrebleFilter); pTrebleSliderDamping->SetPos(pSettings->Sound.iTrebleDamping); pVolumeSlider->SetPos(pSettings->Sound.iMixVolume); UpdateTexts(); CDSound *pDSound = theApp.GetSoundGenerator()->GetSoundInterface(); const int iCount = pDSound->GetDeviceCount(); for (int i = 0; i < iCount; ++i) pDevices->AddString(pDSound->GetDeviceName(i)); pDevices->SetCurSel(pSettings->Sound.iDevice); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CPGRStereoControlDialog::updateDisparitySliders(bool bSaveAndValidate) { int maxDisparityAllowed = getMaxDisparityAllowed( bSaveAndValidate ); int sliderMaxDisparity = m_sliderDisparity.GetRangeMax(); // If the current min/max disparity slider ranges have become invalid: CSliderCtrl* pSlider; char valueText[256]; int sliderPos; if (sliderMaxDisparity != maxDisparityAllowed) { // Do it for the max slider sliderPos = m_sliderDisparity.GetPos(); pSlider = (CSliderCtrl*)GetDlgItem( PGRRES_SLIDER_DISPARITY ); pSlider->SetRange( 0, maxDisparityAllowed, TRUE ); if (sliderPos > maxDisparityAllowed) { m_sliderDisparity.SetPos( maxDisparityAllowed ); m_nMaxDisparity = m_sliderDisparity.GetPos(); sprintf( valueText, "%d", m_nMaxDisparity ); GetDlgItem( PGRRES_STATIC_DISPARITY )->SetWindowText( valueText ); } else { // Just reset the slider position -- the current value is within // the new range, so we don't need to reset the window text. m_sliderDisparity.SetPos( sliderPos ); } // Do it for the min slider sliderPos = m_sliderMinDisparity.GetPos(); pSlider = (CSliderCtrl*)GetDlgItem( PGRRES_SLIDER_MINDISPARITY ); pSlider->SetRange( 0, maxDisparityAllowed, TRUE ); if (sliderPos > maxDisparityAllowed) { m_sliderMinDisparity.SetPos( maxDisparityAllowed ); m_nMinDisparity = m_sliderMinDisparity.GetPos(); sprintf( valueText, "%d", m_nMinDisparity ); GetDlgItem( PGRRES_STATIC_MINDISPARITY )->SetWindowText( valueText ); } else { // Just reset the slider position -- the current value is within // the new range, so we don't need to reset the window text. m_sliderMinDisparity.SetPos( sliderPos ); } } }
BOOL CoptimizerDlg::OnInitDialog() { CSliderCtrl *Slider = (CSliderCtrl *)GetDlgItem(IDC_SLIDER_CUSTOM); CComboBox *CBox = (CComboBox *)GetDlgItem(IDC_COMBO_PRESET); CProgressCtrl *ProgressBar = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS); CString buf; CDialog::OnInitDialog(); SetIcon(m_hIcon, TRUE); SetIcon(m_hIcon, FALSE); CheckRadioButton(IDC_RADIO_PRESET, IDC_RADIO_CUSTOM, IDC_RADIO_PRESET); Slider->SetRange(1000, 10000); Slider->SetTicFreq(1000); CBox->ResetContent(); for(int i = 0; i < NUMSTRINGS; i++) { buf.LoadString(IDS_STRING1 + i); CBox->AddString(buf); } CBox->SetCurSel(2); SetSlider(Slider, 2); ProgressBar->SetRange(0, 100); return TRUE; }
BOOL CSampleEditorDlg::OnInitDialog() { CDialog::OnInitDialog(); m_pSampleView = new CSampleView(); m_pSampleView->SubclassDlgItem(IDC_SAMPLE, this); m_pSampleView->CalculateSample(m_pSample, IsDlgButtonChecked(IDC_DELTASTART) ? 64 : 0); m_pSampleView->UpdateInfo(); CSliderCtrl *pitch = (CSliderCtrl*)GetDlgItem(IDC_PITCH); pitch->SetRange(0, 15); pitch->SetPos(15); MoveControls(); // A timer for the flashing start cursor SetTimer(1, 500, NULL); CString title; GetWindowText(title); title.AppendFormat(_T(" [%s]"), m_pSample->Name); SetWindowText(title); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL COptionsSecurity::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); for (int i = 0; i < 2; i++) { m_chkbox[i].SetTextColour(CR_DATABASE_OPTIONS); m_chkbox[i].ResetBkgColour();//Use current window's background } OnLockOnIdleTimeout(); CSpinButtonCtrl *pspin; pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_IDLESPIN); pspin->SetBuddy(GetDlgItem(IDC_IDLE_TIMEOUT)); pspin->SetRange(1, 120); pspin->SetBase(10); pspin->SetPos(m_IdleTimeOut); CSliderCtrl *pslider = (CSliderCtrl *)GetDlgItem(IDC_HASHITERSLIDER); pslider->SetRange(MinHIslider, MaxHIslider); pslider->SetTicFreq(1); pslider->SetPos(m_HashIterSliderValue); return TRUE; }
BOOL CPPgGeneral::OnInitDialog() { CPropertyPage::OnInitDialog(); InitWindowStyles(this); ((CEdit*)GetDlgItem(IDC_NICK))->SetLimitText(thePrefs.GetMaxUserNickLength()); CWordArray aLanguageIDs; thePrefs.GetLanguages(aLanguageIDs); for (int i = 0; i < aLanguageIDs.GetSize(); i++){ TCHAR szLang[128]; int ret=GetLocaleInfo(aLanguageIDs[i], LOCALE_SLANGUAGE, szLang, ARRSIZE(szLang)); if (ret==0) switch(aLanguageIDs[i]) { case LANGID_UG_CN: _tcscpy(szLang,_T("Uyghur") ); break; case LANGID_GL_ES: _tcscpy(szLang,_T("Galician") ); break; case LANGID_FR_BR: _tcscpy(szLang,_T("Breton (Brezhoneg)") ); break; case LANGID_MT_MT: _tcscpy(szLang,_T("Maltese") ); break; case LANGID_ES_AS: _tcscpy(szLang,_T("Asturian") ); break; case LANGID_VA_ES: _tcscpy(szLang,_T("Valencian") ); break; case LANGID_VA_ES_RACV: _tcscpy(szLang, _T("Valencian (RACV)")); break; default: ASSERT(0); _tcscpy(szLang,_T("?(unknown language)?") ); } m_language.SetItemData(m_language.AddString(szLang), aLanguageIDs[i]); } UpdateEd2kLinkFixCtrl(); CSliderCtrl *sliderUpdate = (CSliderCtrl*)GetDlgItem(IDC_CHECKDAYS); sliderUpdate->SetRange(2, 7, true); sliderUpdate->SetPos(thePrefs.GetUpdateDays()); LoadSettings(); Localize(); GetDlgItem(IDC_CHECKDAYS)->ShowWindow( IsDlgButtonChecked(IDC_CHECK4UPDATE) ? SW_SHOW : SW_HIDE ); GetDlgItem(IDC_DAYS)->ShowWindow( IsDlgButtonChecked(IDC_CHECK4UPDATE) ? SW_SHOW : SW_HIDE ); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL COptionsDlg::OnInitDialog() { CPropertyPage::OnInitDialog(); CSliderCtrl *pSampleSlider = (CSliderCtrl*)GetDlgItem(IDC_SAMPLE_SLIDER); ASSERT(pSampleSlider != NULL); pSampleSlider->SetRange(0, ELEMENTS(SampleIntervals) - 1); // Milliseconds pSampleSlider->SetTicFreq(1); pSampleSlider->SetPageSize(1); pSampleSlider->SetLineSize(1); int nPos = 0; for (int i = 0; i < ELEMENTS(SampleIntervals); i++) { if ((UINT)g_nSampleRate >= SampleIntervals[i]) nPos = i; } pSampleSlider->SetPos(nPos); CSliderCtrl *pWindowSlider = (CSliderCtrl*)GetDlgItem(IDC_AVERAGE_SLIDER); ASSERT(pWindowSlider != NULL); pWindowSlider->SetRange(1, (MAX_SAMPLES - 1) / AVERAGING_MULTIPLIER); // Seconds pWindowSlider->SetTicFreq(1); pWindowSlider->SetPageSize(1); pWindowSlider->SetLineSize(1); pWindowSlider->SetPos(g_nAveragingWindow / AVERAGING_MULTIPLIER); int nID; switch (g_MonitorMode) { case MONITOR_DUN : nID = IDC_USE_DUN; break; case MONITOR_ADAPTER: nID = IDC_MONITOR_ADAPTER; break; case MONITOR_ALL : nID = IDC_USE_SNMP; break; default : ASSERT(false); break; } CheckRadioButton(IDC_USE_SNMP, IDC_MONITOR_ADAPTER, nID); m_Interfaces.EnableWindow(g_MonitorMode == MONITOR_ADAPTER); UpdateDlg(); // Return TRUE unless you set the focus to a control // Exception: OCX Property Pages should return FALSE return TRUE; }
void XDlgBarTimeline::UpdateSlider() { CSliderCtrl *pSlider = (CSliderCtrl *)GetDlgItem( IDC_SLIDER_SPEED ); if( pSlider ) { pSlider->SetRange( 10, 100 ); pSlider->SetPos( (int)(SPROBJ->GetSpeedCurrentAction() * 100) ); pSlider->SetTicFreq( 5 ); TCHAR szBuff[16]; _stprintf_s( szBuff, _T("%1.2f"), SPROBJ->GetSpeedCurrentAction() ); GetDlgItem( IDC_TEXT_SPEED )->SetWindowText( szBuff ); } }
BOOL CFillProp::OnInitDialog() { CButton * pBtn = (CButton *)GetDlgItem(IDC_CHECK1); ASSERT(pBtn != NULL); pBtn->SetCheck(m_bFill); m_ctrlColor.SubclassDlgItem(IDC_COLOR,this); CSliderCtrl *pCtrlRed = (CSliderCtrl *)GetDlgItem(IDC_SLIDER1); ASSERT(pCtrlRed != NULL); pCtrlRed->SetRange(0,255); pCtrlRed->SetTicFreq(64); pCtrlRed->SetLineSize(1); pCtrlRed->SetPageSize(64); CSliderCtrl *pCtrlGreen = (CSliderCtrl *)GetDlgItem(IDC_SLIDER2); ASSERT(pCtrlGreen != NULL); pCtrlGreen->SetRange(0,255); pCtrlGreen->SetTicFreq(64); pCtrlGreen->SetLineSize(1); pCtrlGreen->SetPageSize(64); CSliderCtrl *pCtrlBlue = (CSliderCtrl *)GetDlgItem(IDC_SLIDER3); ASSERT(pCtrlBlue != NULL); pCtrlBlue->SetRange(0,255); pCtrlBlue->SetTicFreq(64); pCtrlBlue->SetLineSize(1); pCtrlBlue->SetPageSize(64); UpdateColor(); return TRUE; }
BOOL CDlgLight::OnInitDialog() { CDialog::OnInitDialog(); VERIFY(cbcol.SubclassDlgItem(IDC_BTCOLOR, this)); cbcol.ChangeColor((BYTE)red, (BYTE)green, (BYTE)blue); CSliderCtrl *cs = (CSliderCtrl *)GetDlgItem(IDC_SLSPEED); cs->SetRange(1,255); cs->SetPos(lSpeed); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CModulePropertiesDlg::OnInitDialog() { CDialog::OnInitDialog(); // Get active document CFrameWnd *pFrameWnd = static_cast<CFrameWnd*>(GetParent()); m_pDocument = static_cast<CFamiTrackerDoc*>(pFrameWnd->GetActiveDocument()); CListCtrl *pSongList = static_cast<CListCtrl*>(GetDlgItem(IDC_SONGLIST)); pSongList->InsertColumn(0, _T("Songs"), 0, 150); pSongList->SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT); FillSongList(); // Expansion chips CComboBox *pChipBox = static_cast<CComboBox*>(GetDlgItem(IDC_EXPANSION)); int ExpChip = m_pDocument->GetExpansionChip(); CChannelMap *pChannelMap = theApp.GetChannelMap(); for (int i = 0; i < pChannelMap->GetChipCount(); ++i) pChipBox->AddString(pChannelMap->GetChipName(i)); pChipBox->SetCurSel(pChannelMap->GetChipIndex(ExpChip)); // Vibrato CComboBox *pVibratoBox = static_cast<CComboBox*>(GetDlgItem(IDC_VIBRATO)); pVibratoBox->SetCurSel((m_pDocument->GetVibratoStyle() == VIBRATO_NEW) ? 0 : 1); // Namco channel count CSliderCtrl *pChanSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_CHANNELS)); pChanSlider->SetRange(1, 8); CString channelsStr; channelsStr.LoadString(IDS_PROPERTIES_CHANNELS); if (ExpChip == SNDCHIP_N163) { int Channels = m_pDocument->GetNamcoChannels(); pChanSlider->SetPos(Channels); pChanSlider->EnableWindow(TRUE); channelsStr.AppendFormat(_T(" %i"), Channels); } else { pChanSlider->SetPos(0); pChanSlider->EnableWindow(FALSE); channelsStr.Append(_T(" N/A")); } SetDlgItemText(IDC_CHANNELS_NR, channelsStr); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void COptionsDlg::UpdateAveragingWindow() { CString s; CSliderCtrl *pWindowSlider = (CSliderCtrl*)GetDlgItem(IDC_AVERAGE_SLIDER); int max = (MAX_SAMPLES - 1) / AVERAGING_MULTIPLIER; pWindowSlider->SetRange(1, max, TRUE); // Blocks of samples int nPos = pWindowSlider->GetPos(); g_nAveragingWindow = max(nPos * AVERAGING_MULTIPLIER, 1); ASSERT(g_nAveragingWindow <= MAX_SAMPLES); s.Format("%.5g", g_nSampleRate * AVERAGING_MULTIPLIER / 1000.0); SetDlgItemText(IDC_AVERAGE_MIN, s); s.Format("%.5g", max * g_nSampleRate * AVERAGING_MULTIPLIER / 1000.0); SetDlgItemText(IDC_AVERAGE_MAX, s); }
BOOL CDlgMagicBar::InitDialogBar() { UpdateData(FALSE);//这个一定要啊,这样就会有和CDialog一样的数据交换效果了 CSliderCtrl *pSlideThreshold = (CSliderCtrl *)GetDlgItem(IDC_SLIDER_THRESHOLED); pSlideThreshold->SetRange(0,200); pSlideThreshold->SetPos(30); CString str; str.Format("%d",pSlideThreshold->GetPos()); SetDlgItemText(IDC_STATIC_THRESHOLD,str); m_threshold = pSlideThreshold->GetPos(); return TRUE; }
void CdynControlDlg::CreatePositionBundle(cJSON *json, int x, int y, int w, int h) { int idx = cJSON_GetObjectItem(json, "id")->valueint; ids.push_back(idx); CString str; char *name = cJSON_GetObjectItem(json, "name")->valuestring; int min = cJSON_GetObjectItem(json, "min")->valueint; int max = cJSON_GetObjectItem(json, "max")->valueint; str.Format(_T("0x%x: %s\n [%d, %d]"), idx, charTotchar(name), min, max); CButton *checkBox = new CButton(); checkBox->Create(str, WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE, CRect(x, y, x + CHECK_WIDTH, y + h), this, CHECK_ID_OFFSET + idx); checkBox->SetCheck(BST_CHECKED); CSliderCtrl *slider = new CSliderCtrl(); int width = w - (CHECK_WIDTH + VIEW_WIDTH); int ptx = x + CHECK_WIDTH; slider->Create(WS_CHILD | WS_VISIBLE | BS_TOP, CRect(ptx, y, ptx + width, y + h), this, SLIDER_ID_OFFSET + idx); slider->SetRange(min, max); slider->SetTicFreq(1); int initPos = cJSON_GetObjectItem(json, "init")->valueint; slider->SetPos(initPos); CEdit *edit = new CEdit(); ptx += width; width = VIEW_WIDTH; edit->Create(WS_CHILD | WS_VISIBLE | BS_TOP, CRect(ptx, y, ptx + width, y + 30), this, VIEW_ID_OFFSET + idx); str.Format(_T("%d"), initPos); edit->SetWindowText(str); }
//****************************************************************************************************** BOOL CStartStopParticleSystem::OnInitDialog() { CDialog::OnInitDialog(); HBITMAP bm[4]; bm[0] = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_START_SYSTEM)); bm[1] = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_STOP_SYSTEM)); bm[2] = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_PAUSE_SYSTEM)); bm[3] = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_START_MULTIPLE_SYSTEM)); m_StartPicture.SendMessage(BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) bm[0]); m_StopPicture.SendMessage(BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) bm[1]); m_PausePicture.SendMessage(BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) bm[2]); m_StartMultiplePicture.SendMessage(BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) bm[3]); CSliderCtrl *sl = (CSliderCtrl *) GetDlgItem(IDC_ANIM_SPEED); sl->SetRange(0, 100); setSpeedSliderValue(1.f); forceActiveNode(NULL); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
/* #FN# Sets up the state of the dialog controls */ void /* #AS# Nothing */ CTapeDlg:: SetDlgState() { CSliderCtrl *pSlider = (CSliderCtrl *)GetDlgItem( IDC_TAPE_SLIDER ); CFileStatus fsStatus; ASSERT(NULL != pSlider); /* Check if there is the pointed cassette file */ BOOL bTape = _IsPathAvailable( m_szTapeFile ) && CFile::GetStatus( m_szTapeFile, fsStatus ); pSlider->SetRange( 1, cassette_max_block + 1, FALSE ); pSlider->SetTicFreq( (cassette_max_block / 30) + 1 ); pSlider->SetPageSize( (cassette_max_block / 30) + 1 ); pSlider->SetPos( cassette_current_block ); pSlider->EnableWindow( bTape ); SetDlgItemText( IDC_TAPE_FILE, m_szTapeFile ); SetDlgItemText( IDC_TAPE_DESC, m_bCasImage ? cassette_description : (bTape ? m_szLabels[ LABEL_NOCASIMAGE ] : "") ); SetPosInfo( cassette_current_block ); #ifdef WIN_NETWORK_GAMES if( ST_KAILLERA_ACTIVE ) { _RdOnlyEdit( IDC_TAPE_FILE, TRUE ); _EnableCtrl( IDC_TAPE_BROWSE, FALSE ); _EnableCtrl( IDC_TAPE_EJECT, FALSE ); _EnableCtrl( IDC_TAPE_REWIND, FALSE ); _EnableCtrl( IDC_TAPE_SLIDER, FALSE ); } else #endif { _EnableCtrl( IDC_TAPE_EJECT, bTape ); _EnableCtrl( IDC_TAPE_REWIND, bTape ); } } /* #OF# CTapeDlg::SetDlgState */
void InitQuality (CSliderCtrl &slider) { slider.SetRange (0, QUALITY_STEP-1); }
void CSpotsMainDlg::ShowImgROI(int x, int y) { if (img_on_show.rows > 0)//有图才继续走 { if (zoom == 8) { DrawPicToHDC(img_on_show, IDC_IMG_BIG); CSliderCtrl *pSlidCtrl = (CSliderCtrl*)GetDlgItem(IDC_SLIDER_IMG_X); pSlidCtrl->EnableWindow(0); pSlidCtrl = (CSliderCtrl*)GetDlgItem(IDC_SLIDER_IMG_Y); pSlidCtrl->EnableWindow(0); pSlidCtrl = 0; } else { //计算ROI宽度 CRect rect; GetDlgItem(IDC_IMG_BIG)->GetClientRect(rect); GetDlgItem(IDC_IMG_BIG)->ClientToScreen(rect);//函数是将你打开的APP中客户区的坐标点信息转换为整个屏幕的坐标 int idc_width = rect.right - rect.left;//图像控件宽 int idc_height = rect.bottom - rect.top;//图像控件高 //根据放大系数转换ROI长宽 int zoom_width = zoom * idc_width;//实际ROI选取的宽度 int zoom_height = zoom * idc_height; if (zoom_width >= img_on_show.cols || zoom_height >= img_on_show.rows)//若放大系数过小,则显示全图 { zoom = 8; ShowImgROI(); return; } //设置滚动条 CSliderCtrl *pSlidCtrlX = (CSliderCtrl*)GetDlgItem(IDC_SLIDER_IMG_X); CSliderCtrl *pSlidCtrlY = (CSliderCtrl*)GetDlgItem(IDC_SLIDER_IMG_Y); pSlidCtrlX->EnableWindow(1); pSlidCtrlY->EnableWindow(1); pSlidCtrlX->SetRange(0, img_on_show.size().width - 1 - zoom_width); pSlidCtrlY->SetRange(0, img_on_show.size().height - 1 - zoom_height); if (x == 0 && y == 0)//如果调用时没有输入坐标,则从slider读取 { x = pSlidCtrlX->GetPos(); y = pSlidCtrlY->GetPos(); } else//如果调用时设置了坐标,则赋值给slider { pSlidCtrlX->SetPos(x); pSlidCtrlY->SetPos(y); } pSlidCtrlX = 0; pSlidCtrlY = 0; //生成ROI { //防止越界 if (x < 0)x = 0; if (y < 0)y = 0; if (x + zoom_width > img_on_show.cols) x = img_on_show.cols - zoom_width; if (y + zoom_height > img_on_show.rows) y = img_on_show.rows - zoom_height; //ROI cv::Mat roi = img_on_show(cv::Rect(x, y, zoom_width, zoom_height)); DrawPicToHDC(roi, IDC_IMG_BIG); //更新文字描述信息 refreshPosInfo(); } } } }
BOOL CBrushBaseParamTabDialog::OnInitDialog() { CDialog::OnInitDialog(); CEdit* pEdit; CComboBox* pCombo; CSliderCtrl* pSld; //base radius m_prev_org_rad = m_pEditBrush->GetOrgRadius(); pSld = (CSliderCtrl*) GetDlgItem(IDC_BASE_RAD_SLD); if (pSld) { pSld->SetRange( IEBrush::MIN_RADIUS, IEBrush::MAX_RADIUS); pSld->SetPos( m_prev_org_rad ); } else { ::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_BASE_RAD_SLD\n"); } pEdit = (CEdit*) GetDlgItem(IDC_BASE_RAD_EDIT); if (pEdit) { TCHAR txt[256]; wsprintf(txt, "%d", m_prev_org_rad); pEdit->SetWindowText(txt); } else { ::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_BASE_RAD_EDIT\n"); } m_prev_rad_ctrl_id = m_pEditBrush->GetRadiusCtrlID(); pCombo = (CComboBox*) GetDlgItem(IDC_RAD_CTRL_COMBO); if (pCombo) { pCombo->InsertString(IE_BRUSH_CTRL_ID::OFF, "オフ"); pCombo->InsertString(IE_BRUSH_CTRL_ID::PRESSURE, "筆圧"); pCombo->InsertString(IE_BRUSH_CTRL_ID::AZIMUTH, "回転"); pCombo->InsertString(IE_BRUSH_CTRL_ID::ALTITUDE, "傾き"); pCombo->InsertString(IE_BRUSH_CTRL_ID::RANDOM, "ランダム"); pCombo->SetCurSel(m_prev_rad_ctrl_id); } //alpha m_prev_alpha_ctrl_id = m_pEditBrush->GetAlphaCtrlID(); pCombo = (CComboBox*) GetDlgItem(IDC_ALPHA_CTRL_COMBO); if (pCombo) { pCombo->InsertString(IE_BRUSH_CTRL_ID::OFF, "オフ"); pCombo->InsertString(IE_BRUSH_CTRL_ID::PRESSURE, "筆圧"); pCombo->InsertString(IE_BRUSH_CTRL_ID::AZIMUTH, "回転"); pCombo->InsertString(IE_BRUSH_CTRL_ID::ALTITUDE, "傾き"); pCombo->InsertString(IE_BRUSH_CTRL_ID::RANDOM, "ランダム"); pCombo->SetCurSel(m_prev_alpha_ctrl_id); } //hardness m_prev_hardness = m_pEditBrush->GetHardness(); pSld = (CSliderCtrl*) GetDlgItem(IDC_HARDNESS_SLD); if (pSld) { pSld->SetRange(0, 100); pSld->SetPos( m_prev_hardness ); } else { ::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_HARDNESS_SLD\n"); } pEdit = (CEdit*) GetDlgItem(IDC_HARDNESS_EDIT); if (pEdit) { TCHAR txt[256]; wsprintf(txt, "%d", m_prev_hardness); pEdit->SetWindowText(txt); } else { ::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_HARDNESS_EDIT\n"); } //min radius m_prev_min_rad = m_pEditBrush->GetMinRadius(); pSld = (CSliderCtrl*) GetDlgItem(IDC_MIN_RAD_SLD); if (pSld) { pSld->SetRange(0, 100); pSld->SetPos( m_prev_min_rad ); } else { ::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_MIN_RAD_SLD\n"); } pEdit = (CEdit*) GetDlgItem(IDC_MIN_RAD_EDIT); if (pEdit) { TCHAR txt[256]; wsprintf(txt, "%d", m_prev_min_rad); pEdit->SetWindowText(txt); } else { ::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_MIN_RAD_EDIT\n"); } //min alpha m_prev_min_alpha = m_pEditBrush->GetMinAlpha(); pSld = (CSliderCtrl*) GetDlgItem(IDC_MIN_ALPHA_SLD); if (pSld) { pSld->SetRange(0, 100); pSld->SetPos( m_prev_min_alpha ); } else { ::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_MIN_ALPHA_SLD\n"); } pEdit = (CEdit*) GetDlgItem(IDC_MIN_ALPHA_EDIT); if (pEdit) { TCHAR txt[256]; wsprintf(txt, "%d", m_prev_min_alpha); pEdit->SetWindowText(txt); } else { ::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_MIN_ALPHA_EDIT\n"); } //interval m_prev_interval = m_pEditBrush->GetInterval(); pSld = (CSliderCtrl*) GetDlgItem(IDC_INTERVAL_SLD); if (pSld) { pSld->SetRange( IEBrush::MIN_INTERVAL, IEBrush::MAX_INTERVAL); pSld->SetPos( m_prev_interval ); } else { ::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_INTERVAL_SLD\n"); } pEdit = (CEdit*) GetDlgItem(IDC_INTERVAL_EDIT); if (pEdit) { TCHAR txt[256]; wsprintf(txt, "%d", m_prev_interval); pEdit->SetWindowText(txt); } else { ::OutputDebugString("CBrushBaseParamTabDialog::OnInitDialog(), not found IDC_INTERVAL_EDIT\n"); } return TRUE; }
BOOL CPGRStereoControlDialog::OnInitDialog() { char valueText[ 128 ]; CSliderCtrl* pSlider; // Set up stereo mask slider pSlider = (CSliderCtrl*)GetDlgItem( PGRRES_SLIDER_STEREO ); pSlider->SetRange( 0, 11 ); // 1-23 odd sprintf( valueText, "%d", m_nStereoMaskSize ); GetDlgItem( PGRRES_STATIC_STEREO )->SetWindowText( valueText ); pSlider->SetPos( (m_nStereoMaskSize - 1) / 2 ); // Set up edge mask slider pSlider = (CSliderCtrl*)GetDlgItem( PGRRES_SLIDER_EDGE ); pSlider->SetRange( 0, 5 ); // 1-11 odd sprintf( valueText, "%d", m_nEdgeMaskSize ); GetDlgItem( PGRRES_STATIC_EDGE )->SetWindowText( valueText ); pSlider->SetPos( (m_nEdgeMaskSize - 1) / 2 ); // Set up maximum disparity slider pSlider = (CSliderCtrl*)GetDlgItem( PGRRES_SLIDER_DISPARITY ); int maxDisp = getMaxDisparityAllowed( false ); pSlider->SetRange( 0, maxDisp ); // 0-maxDisp sprintf( valueText, "%d", m_nMaxDisparity ); GetDlgItem( PGRRES_STATIC_DISPARITY )->SetWindowText( valueText ); pSlider->SetPos( m_nMaxDisparity ); // Set up minimum disparity slider pSlider = (CSliderCtrl*)GetDlgItem( PGRRES_SLIDER_MINDISPARITY ); pSlider->SetRange( 0, maxDisp ); // 0-maxDisp sprintf( valueText, "%d", m_nMinDisparity ); GetDlgItem( PGRRES_STATIC_MINDISPARITY )->SetWindowText( valueText ); pSlider->SetPos( m_nMinDisparity ); // Set up texture validation slider pSlider = (CSliderCtrl*)GetDlgItem( PGRRES_SLIDER_TEXTURE ); pSlider->SetRange( 0, 400 ); // 0-4 (float 1/100) sprintf( valueText, "%5.2f", m_fTextureValidation ); GetDlgItem( PGRRES_STATIC_TEXTURE )->SetWindowText( valueText ); pSlider->SetPos( (int)(m_fTextureValidation * 100.0) ); // Set up uniqueness validation slider pSlider = (CSliderCtrl*)GetDlgItem( PGRRES_SLIDER_UNIQUENESS ); pSlider->SetRange( 0, 300 ); // 0-10 (float 1/100) sprintf( valueText, "%5.2f", m_fUniquenessValidation ); GetDlgItem( PGRRES_STATIC_UNIQUENESS )->SetWindowText( valueText ); pSlider->SetPos( (int)(m_fUniquenessValidation * 100.00) ); // Set up point size slider pSlider = (CSliderCtrl*)GetDlgItem( PGRRES_SLIDER_POINT_SIZE ); pSlider->SetRange( 0, 200 ); sprintf( valueText, "%d%%", m_fPointSize ); GetDlgItem( PGRRES_STATIC_POINT_SIZE )->SetWindowText( valueText ); pSlider->SetPos( (int)(m_fPointSize ) ); // Set up surface validation size slider pSlider = (CSliderCtrl*)GetDlgItem( PGRRES_SLIDER_SURFACEVALIDATIONSIZE ); pSlider->SetRange( 0, 400 ); sprintf( valueText, "%d", m_nSurfaceValidationSize ); GetDlgItem( PGRRES_STATIC_SURFACEVALIDATIONSIZE )->SetWindowText( valueText ); pSlider->SetPos( m_nSurfaceValidationSize ); // Set up surface validation difference slider pSlider = (CSliderCtrl*)GetDlgItem( PGRRES_SLIDER_SURFACEVALIDATIONDIFF ); pSlider->SetRange( 0, 300 ); sprintf( valueText, "%3.2f", m_fSurfaceValidationDiff ); GetDlgItem( PGRRES_STATIC_SURFACEVALIDATIONDIFF )->SetWindowText( valueText ); pSlider->SetPos( (int)(m_fSurfaceValidationDiff * 100.0) ); CDialog::OnInitDialog(); // disable the Invalid Colors check box if the heatmap check box // is on if ( m_checkHeatmap.GetCheck() == TRUE ) { m_checkInvalidColors.EnableWindow( FALSE ); } // m_comboBoxRectification.InsertString( 0, "Standard" ); m_comboBoxRectification.InsertString( 1, "Enhanced 1" ); m_comboBoxRectification.InsertString( 2, "Enhanced 2" ); UpdateData( FALSE ); // Create a tips for the various controls m_tipCtrl.Create( this ); m_tipCtrl.AddWindowTool( &m_checkInvalidColors, _T("Use different colors for each kind of invalid pixel" "(See color icons in validation box)") ); m_tipCtrl.AddWindowTool( &m_checkHeatmap, _T("Display disparity as a 'heatmap' or a grayscale") ); m_tipCtrl.AddWindowTool( &m_buttonAlg3Cam, _T("Use 3 camera stereo - Bumblebee XB3 only") ); m_tipCtrl.AddWindowTool( &m_buttonAlg2CamV, _T("Use 2 camera stereo - Wide Baseline") ); m_tipCtrl.AddWindowTool( &m_buttonAlg2CamH, _T("Use 2 camera stereo - Narrow Baseline") ); m_tipCtrl.AddWindowTool( &m_sliderSurfaceValidationSize, _T("Controls the minimum size that a valid surface must be (in pixels)") ); m_tipCtrl.AddWindowTool( &m_sliderSurfaceValidationDiff, _T("Controls the maximum disparity difference between adjacent pixels for" " them to be in the same surface") ); m_tipCtrl.AddWindowTool( &m_sliderUniqueness, _T("Uniqueness threshold - higher values mean less aggressive validation") ); m_tipCtrl.AddWindowTool( &m_sliderTexture, _T("Texture threshold - higher values mean more aggressive validation") ); m_tipCtrl.AddWindowTool( &m_sliderStereo, _T("Controls the size of the stereo correlation mask") ); m_tipCtrl.AddWindowTool( &m_sliderEdge, _T("Controls the size of the edge extraction mask - 7 or 9 is recommended") ); m_tipCtrl.AddWindowTool( &m_sliderDisparity, _T("Controls the maximum disparity searched") ); m_tipCtrl.AddWindowTool( &m_sliderMinDisparity, _T("Controls the minimum disparity searched") ); m_tipCtrl.AddWindowTool( &m_checkSmooth, _T("Should always be left on! - turns pre-smoothing in rectification on or off.") ); m_tipCtrl.AddWindowTool( &m_checkEdge, _T("Indicates whether stereo correlation should be done on edge or greyscale images -" "edge correlation is less sensitive to image brightness differences and is more robust") ); m_tipCtrl.AddWindowTool( &m_checkStereoButton, _T("Turns stereo process on and off") ); m_tipCtrl.AddWindowTool( &m_checkSubpixel, _T("Turns subpixel interpolation on and off - subpixel interpolation on gives more" " accurate 3D views") ); m_tipCtrl.AddWindowTool( &m_checkUniqueness, _T("Turns uniqueness validation on and off - recommended to be left OFF") ); m_tipCtrl.AddWindowTool( &m_checkTexture, _T("Turns texture validation on and off - recommended to be left ON") ); m_tipCtrl.AddWindowTool( &m_checkBackForth, _T("Turns back-and-forth validation on and off - only available for 2 camera stereo," " this validation method is very useful") ); m_tipCtrl.AddWindowTool( &m_checkSurfaceValidation, _T("Turns surface validation on or off - recommended to be left ON") ); m_tipCtrl.AddWindowTool( &m_buttonAlg3Cam, _T("") ); return TRUE; }
BOOL CSkin::OnInitDialog() { CDialogEx::OnInitDialog(); // TODO: 在此添加额外的初始化 CSliderCtrl *pSlidCtrl = (CSliderCtrl*)GetDlgItem(IDC_RUB_SKIN); pSlidCtrl->SetRange(0, 100); pSlidCtrl->SetPos(0); pSlidCtrl = (CSliderCtrl*)GetDlgItem(IDC_WHITE_SKIN); pSlidCtrl->SetRange(0, 100); pSlidCtrl->SetPos(0); CMainFrame* pMain = (CMainFrame*)AfxGetApp()->m_pMainWnd; COpenCVPlatDoc *pDoc = (COpenCVPlatDoc*)pMain->GetActiveDocument(); COpenCVPlatView *pView = (COpenCVPlatView*)pMain->GetActiveView(); face_detect(pDoc->image); if (faces.size() == 0) { face_info.SetString(_T("没有检测到人脸!")); } else { face_info.Format(_T("检测到了%d张人脸!"), faces.size()); } UpdateData(false); int window_size = 11; int height = pDoc->image.size().height; int width = pDoc->image.size().width; for (int i = 0; i < faces.size(); i++) { int sx = faces[i].x; int sy = faces[i].y; int ex = faces[i].x + faces[i].width; int ey = faces[i].y + faces[i].height; if (pDoc->image.channels() == 3) { for (int row = sy; row < ey; row++) { uchar *data = rub_img.ptr<uchar>(row); for (int col = sx; col < ex; col++) { double r = 0, g = 0, b = 0; double wr = 0, wg = 0, wb = 0; for (int i = row - window_size / 2; i <= row + window_size / 2; i++) for (int j = col - window_size / 2; j <= col + window_size / 2; j++) { if (i >= 0 && i < height && j >= 0 && j < width) { uchar *old_data = old_img.ptr<uchar>(i); int wind_i = i - row + window_size / 2; int wind_j = j - col + window_size / 2; double tb = wij(i, j, row, col, old_data[j * 3], data[col * 3]); double tg = wij(i, j, row, col, old_data[j * 3 + 1], data[col * 3 + 1]); double tr = wij(i, j, row, col, old_data[j * 3 + 2], data[col * 3 + 2]); b += old_data[j * 3] * tb; g += old_data[j * 3 + 1] * tg; r += old_data[j * 3 + 2] * tr; wb += tb; wg += tg; wr += tr; } } data[col * 3] = b / wb; data[col * 3 + 1] = g / wg; data[col * 3 + 2] = r / wr; } } } else { for (int row = sy; row < ey; row++) { uchar *data = rub_img.ptr<uchar>(row); for (int col = sx; col < ex; col++) { double r = 0, g = 0, b = 0; double w = 0; for (int i = row - window_size / 2; i <= row + window_size / 2; i++) for (int j = col - window_size / 2; j <= col + window_size / 2; j++) { if (i >= 0 && i < height && j >= 0 && j < width) { uchar *old_data = old_img.ptr<uchar>(i); int wind_i = i - row + window_size / 2; int wind_j = j - col + window_size / 2; double t = wij(i, j, row, col, old_data[j], data[col]); b += old_data[j] * t; w += t; } } data[col] = b / w; } } } } return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }
BOOL CPPgGeneral::OnInitDialog() { CPropertyPage::OnInitDialog(); InitWindowStyles(this); ((CEdit*)GetDlgItem(IDC_NICK))->SetLimitText(thePrefs.GetMaxUserNickLength()); CWordArray aLanguageIDs; thePrefs.GetLanguages(aLanguageIDs); for (int i = 0; i < aLanguageIDs.GetSize(); i++){ TCHAR szLang[128]; int ret=GetLocaleInfo(aLanguageIDs[i], LOCALE_SLANGUAGE, szLang, ARRSIZE(szLang)); if (ret==0 && aLanguageIDs[i]== LANGID_GL_ES ) _tcscpy(szLang,_T("Galician") ); else if (ret==0 && aLanguageIDs[i]==LANGID_FR_BR ) _tcscpy(szLang,_T("Breton (Brezhoneg)") ); else if (ret==0 && aLanguageIDs[i]==LANGID_MT_MT ) _tcscpy(szLang,_T("Maltese") ); else if (ret==0 && aLanguageIDs[i]==LANGID_ES_AS ) _tcscpy(szLang,_T("Asturian") ); if (!_tcscmp(szLang, _T("中文(台湾)"))) //Added by thilon on 2006.09.06 _tcscpy(szLang, _T("中文(繁体)")); if (!_tcscmp(szLang, _T("中文(中国)"))) //Added by thilon on 2006.09.06 _tcscpy(szLang, _T("中文(简体)")); if (!_tcscmp(szLang, _T("Chinese (Taiwan)"))) _tcscpy(szLang, _T("Chinese (Tradition)")); if (!_tcscmp(szLang, _T("Chinese (PRC)"))) _tcscpy(szLang, _T("Chinese (Simplified)")); m_language.SetItemData(m_language.AddString(szLang), aLanguageIDs[i]); } //Chocobo Start //eMule自动更新,modified by Chocobo on 2006.08.01 //屏蔽修改更新间隔 CSliderCtrl *sliderUpdate = (CSliderCtrl*)GetDlgItem(IDC_CHECKDAYS); sliderUpdate->SetRange(1, 7, true);//自动更新时间1-7,modified by Chocobo on 2006.08.17 sliderUpdate->SetPos(thePrefs.GetUpdateDays()); //Chocobo End //Changed by thilon on 2007.11.01 m_iFileBufferSize = thePrefs.m_iFileBufferSize; // added by vc-yavey on 20100429 : config rss <begin> m_uRssIntervalSecond = thePrefs.m_uRssUpdateInterval; m_bRssAutoDownload = thePrefs.m_bRssAutoDownload; // added by vc-yavey on 20100429 : config rss <end> LoadSettings(); //Localize(); GetDlgItem(IDC_CHECKDAYS)->ShowWindow( IsDlgButtonChecked(IDC_CHECK4UPDATE) ? SW_SHOW : SW_HIDE ); GetDlgItem(IDC_DAYS)->ShowWindow( IsDlgButtonChecked(IDC_CHECK4UPDATE) ? SW_SHOW : SW_HIDE ); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CPPgGeneral::OnInitDialog() { CPropertyPage::OnInitDialog(); InitWindowStyles(this); // eF-Mod :: InvisibleMode // Add keys to ComboBox for(int i='A'; i<='Z'; i++) ((CComboBox*)GetDlgItem(IDC_INVISIBLE_MODE_SELECT_COMBO))->AddString(CString((TCHAR)(i))); for(int i='0'; i<='9'; i++) ((CComboBox*)GetDlgItem(IDC_INVISIBLE_MODE_SELECT_COMBO))->AddString(CString((TCHAR)(i))); // eF-Mod end ((CEdit*)GetDlgItem(IDC_NICK))->SetLimitText(thePrefs.GetMaxUserNickLength()); CWordArray aLanguageIDs; thePrefs.GetLanguages(aLanguageIDs); for (int i = 0; i < aLanguageIDs.GetSize(); i++){ TCHAR szLang[128]; int ret=GetLocaleInfo(aLanguageIDs[i], LOCALE_SLANGUAGE, szLang, ARRSIZE(szLang)); if (ret==0 && aLanguageIDs[i]== LANGID_GL_ES ) _tcscpy(szLang,_T("Galician") ); else if (ret==0 && aLanguageIDs[i]==LANGID_FR_BR ) _tcscpy(szLang,_T("Breton (Brezhoneg)") ); m_language.SetItemData(m_language.AddString(szLang), aLanguageIDs[i]); } UpdateEd2kLinkFixCtrl(); GetDlgItem(IDC_ONLINESIG)->ShowWindow( thePrefs.IsExtControlsEnabled()?SW_SHOW:SW_HIDE ); CSliderCtrl *sliderUpdate = (CSliderCtrl*)GetDlgItem(IDC_CHECKDAYS); sliderUpdate->SetRange(2, 7, true); sliderUpdate->SetPos(thePrefs.GetUpdateDays()); LoadSettings(); Localize(); GetDlgItem(IDC_CHECKDAYS)->ShowWindow( IsDlgButtonChecked(IDC_CHECK4UPDATE) ? SW_SHOW : SW_HIDE ); GetDlgItem(IDC_DAYS)->ShowWindow( IsDlgButtonChecked(IDC_CHECK4UPDATE) ? SW_SHOW : SW_HIDE ); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }