HRESULT ConfigureSeekbar(IMediaSeeking *pMS, CSliderCtrl Seekbar, CStatic& strPosition, HWND hwndOwner) { HRESULT hr; // Disable seekbar for new file and reset tracker/position label Seekbar.SetPos(0); Seekbar.EnableWindow(FALSE); g_rtTotalTime=0; LANGID dwLanguageID = GetSystemLanguagePrimaryID(); switch (dwLanguageID) { case LANG_SPANISH : strPosition.SetWindowText(TEXT("Position: 00m:00s\0")); break; default: strPosition.SetWindowText(TEXT("Position: 00m:00s\0")); break; } DWORD dwSeekCaps = AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanGetDuration; // Can we seek this file? If so, enable trackbar. if (pMS && (S_OK == pMS->CheckCapabilities(&dwSeekCaps))) { hr = pMS->GetDuration(&g_rtTotalTime); Seekbar.EnableWindow(TRUE); } g_hwnd = hwndOwner; return hr; }
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 CoptimizerDlg::OnBnClickedRadioCustom() { CSliderCtrl *Slider = (CSliderCtrl *)GetDlgItem(IDC_SLIDER_CUSTOM); CComboBox *CBox = (CComboBox *)GetDlgItem(IDC_COMBO_PRESET); CBox->EnableWindow(FALSE); Slider->EnableWindow(TRUE); }
void CoptimizerDlg::OnBnClickedRadioPreset() { CComboBox *CBox = (CComboBox *)GetDlgItem(IDC_COMBO_PRESET); CSliderCtrl *Slider = (CSliderCtrl *)GetDlgItem(IDC_SLIDER_CUSTOM); int Sel; Sel = CBox->GetCurSel(); CBox->EnableWindow(TRUE); SetSlider(Slider, Sel); Slider->EnableWindow(FALSE); }
void CModulePropertiesDlg::OnCbnSelchangeExpansion() { CComboBox *pExpansionChipBox = (CComboBox*)GetDlgItem(IDC_EXPANSION); CMainFrame *pMainFrame = (CMainFrame*)GetParentFrame(); CSliderCtrl *pSlider = (CSliderCtrl*)GetDlgItem(IDC_CHANNELS); // Expansion chip unsigned int iExpansionChip = theApp.GetChannelMap()->GetChipIdent(pExpansionChipBox->GetCurSel()); if (iExpansionChip == SNDCHIP_N163) { pSlider->EnableWindow(TRUE); int Channels = m_pDocument->GetNamcoChannels(); pSlider->SetPos(Channels); CString text; text.Format(_T("Channels: %i"), Channels); SetDlgItemText(IDC_CHANNELS_NR, text); } else { pSlider->EnableWindow(FALSE); SetDlgItemText(IDC_CHANNELS_NR, _T("Channels: N/A")); } }
void CModulePropertiesDlg::OnCbnSelchangeExpansion() { CComboBox *pExpansionChipBox = static_cast<CComboBox*>(GetDlgItem(IDC_EXPANSION)); CSliderCtrl *pSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_CHANNELS)); // Expansion chip unsigned int iExpansionChip = theApp.GetChannelMap()->GetChipIdent(pExpansionChipBox->GetCurSel()); CString channelsStr; channelsStr.LoadString(IDS_PROPERTIES_CHANNELS); if (iExpansionChip == SNDCHIP_N163) { pSlider->EnableWindow(TRUE); int Channels = m_pDocument->GetNamcoChannels(); pSlider->SetPos(Channels); channelsStr.AppendFormat(_T(" %i"), Channels); } else { pSlider->EnableWindow(FALSE); channelsStr.Append(_T(" N/A")); } SetDlgItemText(IDC_CHANNELS_NR, channelsStr); }
BOOL CConfigDlg::OnInitDialog() { if( !CDialog::OnInitDialog() ) return FALSE; CString tip; tip.LoadString( IDS_INCREASE_TIP ); m_increase.SetToolTipText( &tip ); tip.LoadString( IDS_MINIMIZE_TIP ); m_minimize.SetToolTipText( &tip ); tip.LoadString( IDS_PAUSE_TIP ); m_muteCheck.SetToolTipText( &tip ); tip.LoadString( IDS_ADD_TIP ); m_addButton.SetToolTipText( &tip ); tip.LoadString( IDS_DELETE_TIP ); m_deleteButton.SetToolTipText( &tip ); m_daysBox.SetUseTabOrder(TRUE); GetPlaylists(); FillBoxes(); m_snoozeTime.SetWindowText( _T("1") ); m_snoozeSpin.SetRange( 1, 60 ); CSliderCtrl *secs = (CSliderCtrl*)GetDlgItem( IDC_SECONDS_SLIDER ); secs->SetPageSize( 10 ); secs->SetRangeMin( 10 ); secs->SetRangeMax( 120 ); secs->EnableWindow( false ); SetFocus(); SetForegroundWindow(); GetDlgItem(IDC_PLAYLISTS)->SetFocus(); ((CButton*)GetDlgItem( IDC_SUNDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[0].c_str() ); ((CButton*)GetDlgItem( IDC_MONDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[1].c_str() ); ((CButton*)GetDlgItem( IDC_TUESDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[2].c_str() ); ((CButton*)GetDlgItem( IDC_WEDNESDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[3].c_str() ); ((CButton*)GetDlgItem( IDC_THURSDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[4].c_str() ); ((CButton*)GetDlgItem( IDC_FRIDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[5].c_str() ); ((CButton*)GetDlgItem( IDC_SATURDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[6].c_str() ); return TRUE; }
/* #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 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 CSpotsMainDlg::OnInitDialog() { CDialogEx::OnInitDialog(); // 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动 // 执行此操作 SetIcon(m_hIcon, TRUE); // 设置大图标 SetIcon(m_hIcon, FALSE); // 设置小图标 // TODO: 在此添加额外的初始化代码 // 打开控制台 if (__argc > 1) { for (size_t i = 0; i < __argc; i++) { CString targv = __targv[i]; if (targv == L"debug")//输出命令台 { MFCConsole::Init(); MFCConsole::Output("Debug start.\r\n"); } if (targv == L"virtual") { p_contrller->IsRealModel = 0; } } } //p_contrller->IsRealModel = 0; // 添加菜单栏 ModifyStyle(WS_THICKFRAME, DS_MODALFRAME); menu.LoadMenuW(IDR_MenuMain); SetMenu(&menu); int Standard_Width_mm = 0; if (SettingHelper::GetKeyInt("SYS_IMG_CAPTURE", "Standard_Width_mm", Standard_Width_mm)) GetDlgItem(IDC_TB_Real_WidthMM)->SetWindowText(StringHelper::int2CString(Standard_Width_mm)); else GetDlgItem(IDC_TB_Real_WidthMM)->SetWindowText(L"600"); int Standard_Length_mm = 0; if (SettingHelper::GetKeyInt("SYS_IMG_CAPTURE", "Standard_Length_mm", Standard_Length_mm)) GetDlgItem(IDC_TB_Real_LengthMM)->SetWindowText(StringHelper::int2CString(Standard_Length_mm)); else GetDlgItem(IDC_TB_Real_LengthMM)->SetWindowText(L"300"); //系统初始化 p_contrller->Init(); CSliderCtrl *pSlidCtrl = (CSliderCtrl*)GetDlgItem(IDC_SLIDER_IMG_X); pSlidCtrl->EnableWindow(0); pSlidCtrl = (CSliderCtrl*)GetDlgItem(IDC_SLIDER_IMG_Y); pSlidCtrl->EnableWindow(0); pSlidCtrl = 0; /***************保存控件初始位置,用于自适应窗口缩放******************/ save1control(0);//保存主窗口 save1control(IDC_BTN_SelectVirtualImg); save1control(IDC_BTN_virtualTigger); save1control(IDC_BTN_TriggerContinue); save1control(IDC_BTN_PlaneArray); save1control(IDC_BTN_PlaneArraySolo); save1control(IDC_BTN_RUN); save1control(IDCANCEL); save1control(IDC_GB_IMG_BIG); save1control(IDC_IMG_BIG); save1control(IDC_LABLE_IMG_INFO); save1control(IDC_SLIDER_IMG_X); save1control(IDC_SLIDER_IMG_Y); save1control(IDC_GB_LogImg); save1control(IDC_IMG_HISTORY); save1control(IDC_GB_STATISTIC); save1control(IDC_LB11); save1control(IDC_LB7); save1control(IDC_LB8); save1control(IDC_LB9); save1control(IDC_LB10); save1control(IDC_LB12); save1control(IDC_LB4); save1control(IDC_LB5); save1control(IDC_LB6); save1control(IDC_LB_todayTotal); save1control(IDC_LB_todayA); save1control(IDC_LB_todayB); save1control(IDC_LB_todayC); save1control(IDC_LB_todayGood); save1control(IDC_LB_dayFineRate); save1control(IDC_LB_monthTotal); save1control(IDC_LB_monthA); save1control(IDC_LB_monthB); save1control(IDC_LB_monthC); save1control(IDC_LB_monthGood); save1control(IDC_LB_monthFineRate); save1control(IDC_LB_yearTotal); save1control(IDC_LB_yearA); save1control(IDC_LB_yearB); save1control(IDC_LB_yearC); save1control(IDC_LB_yearGood); save1control(IDC_LB_yearFineRate); save1control(IDC_LB_SIZESHOW); save1control(IDC_GB_SIZE); save1control(IDC_LB_SZIE_X); save1control(IDC_TB_Real_WidthMM); save1control(IDC_LB_SIZE_Y); save1control(IDC_TB_Real_LengthMM); save1control(IDC_BTN_SizeDingBiao); save1control(IDC_MAIN_DINGBIAO); string MainHSVs; if (SettingHelper::GetKeyString("AreaCam", "MainHSVs", MainHSVs)) GetDlgItem(IDC_MAIN_HSV)->SetWindowText(StringHelper::string2CString(MainHSVs)); else GetDlgItem(IDC_MAIN_HSV)->SetWindowText(L"300"); FileStorage fs("data//histdata.yaml", FileStorage::READ);//历史样本图片导入 fs["hissample"] >> SampleImg_cache; fs.release(); if (SampleImg_cache.empty()) SampleImg_cache = Mat(70, 10, CV_8UC1, Scalar(255)); initEndFlag = true; return TRUE; // 除非将焦点设置到控件,否则返回 TRUE }