/* OnInitDialog() */ BOOL CWallBrowserOneParamDlg::OnInitDialog(void) { CDialog::OnInitDialog(); HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); SetIcon(hIcon,TRUE); SetIcon(hIcon,FALSE); SetDlgItemText(IDC_STATIC_PROPERTY,m_strProperty); SetDlgItemText(IDC_STATIC_OPERATION,m_strOperation); CSpinButtonCtrl *pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_VALUE); pSpin->SetRange((int)m_nMin,(int)m_nMax); pSpin->SetPos((int)m_nDefaultValue); pSpin->SetBuddy(GetDlgItem(IDC_EDIT_VALUE)); m_ctrlSlider.SetRangeMin((int)m_nMin,TRUE); m_ctrlSlider.SetRangeMax((int)m_nMax,TRUE); m_ctrlSlider.SetPos((int)m_nDefaultValue); CString strValue; strValue.Format("%d",(int)m_nMin); SetDlgItemText(IDC_STATIC_RANGE_MIN,strValue); strValue.Format("%d",(int)m_nMax); SetDlgItemText(IDC_STATIC_RANGE_MAX,strValue); UpdateData(FALSE); return(TRUE); }
//***************************************************************************** CSpinButtonCtrl* CCxNDArrayDimItem::CreateSpinControl (CRect rectSpin) { ASSERT_VALID (this); ASSERT_VALID (m_pGridRow); CCxNDArrayDimGrid* pWndList = (CCxNDArrayDimGrid*)((CCxNDArrayDimRow*)m_pGridRow)->m_pWndList; ASSERT_VALID (pWndList); CSpinButtonCtrl* pWndSpin = new CCxBCGPSpinButtonCtrl; if (!pWndSpin->Create ( WS_CHILD | WS_VISIBLE | UDS_ARROWKEYS | UDS_SETBUDDYINT | UDS_NOTHOUSANDS, rectSpin, pWndList, BCGPGRIDCTRL_ID_INPLACE)) { return NULL; } pWndSpin->SetBuddy (m_pWndInPlace); //if (m_nMinValue != 0 || m_nMaxValue != 0) { pWndSpin->SetRange32 (m_nMinValue, m_nMaxValue); } return pWndSpin; }
BOOL COptionsDisplay::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); for (int i = 0; i < 4; i++) { m_chkbox[i].SetTextColour(CR_DATABASE_OPTIONS); m_chkbox[i].ResetBkgColour();//Use current window's background } for (int i = 0; i < 3; i++) { m_radiobtn[i].SetTextColour(CR_DATABASE_OPTIONS); m_radiobtn[i].SetType(BS_AUTORADIOBUTTON); m_radiobtn[i].ResetBkgColour();//Use current window's background } if (m_ShowUsernameInTree == FALSE) { m_ShowPasswordInTree = FALSE; GetDlgItem(IDC_DEFPWSHOWINTREE)->EnableWindow(FALSE); } OnPreWarn(); CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_PREWARNEXPIRYSPIN); pspin->SetBuddy(GetDlgItem(IDC_PREEXPIRYWARNDAYS)); pspin->SetRange(1, 30); pspin->SetBase(10); pspin->SetPos(m_PreExpiryWarnDays); 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; }
// Following copied from AddEdit_PasswordPolicy.cpp. Move to common mixin? static void setupBuddy(CWnd *p, int spinid, int id, int &length, short min = 0) { CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)p->GetDlgItem(spinid); pspin->SetBuddy(p->GetDlgItem(id)); pspin->SetRange(min, 1024); pspin->SetBase(10); pspin->SetPos((int)length); }
BOOL COptionsBackup::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); m_chkbox.SetTextColour(CR_DATABASE_OPTIONS); m_chkbox.ResetBkgColour(); //Use current window's background if (!GetMainDlg()->IsDBReadOnly()) GetDlgItem(IDC_STATIC_DB_PREFS_RO_WARNING)->ShowWindow(SW_HIDE); if (m_backupsuffix_cbox.GetCount() == 0) { // add the strings in alphabetical order CString cs_text(MAKEINTRESOURCE(IDS_NONE)); int nIndex; nIndex = m_backupsuffix_cbox.AddString(cs_text); m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_None); m_BKSFX_to_Index[PWSprefs::BKSFX_None] = nIndex; cs_text.LoadString(IDS_DATETIMESTRING); nIndex = m_backupsuffix_cbox.AddString(cs_text); m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_DateTime); m_BKSFX_to_Index[PWSprefs::BKSFX_DateTime] = nIndex; cs_text.LoadString(IDS_INCREMENTNUM); nIndex = m_backupsuffix_cbox.AddString(cs_text); m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_IncNumber); m_BKSFX_to_Index[PWSprefs::BKSFX_IncNumber] = nIndex; } m_backupsuffix_cbox.SetCurSel(m_BKSFX_to_Index[m_BackupSuffix]); GetDlgItem(IDC_BACKUPEXAMPLE)->SetWindowText(L""); CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_BKPMAXINCSPIN); pspin->SetBuddy(GetDlgItem(IDC_BACKUPMAXINC)); pspin->SetRange(1, 999); pspin->SetBase(10); pspin->SetPos(m_MaxNumIncBackups); OnComboChanged(); OnBackupBeforeSave(); InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 4); // Note naming convention: string IDS_xxx corresponds to control IDC_xxx AddTool(IDC_BACKUPBEFORESAVE, IDS_BACKUPBEFORESAVE); AddTool(IDC_USERBACKUPOTHERLOCATION, IDS_USERBACKUPOTHERLOCATION); ActivateToolTip(); return TRUE; }
BOOL COptionsMisc::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 } OnUseDefUser(); // For some reason, MFC calls us twice when initializing. // Populate the combo box only once. if (m_dblclk_cbox.GetCount() == 0) { SetupCombo(&m_dblclk_cbox); } if (m_shiftdblclk_cbox.GetCount() == 0) { SetupCombo(&m_shiftdblclk_cbox); } m_dblclk_cbox.SetCurSel(m_DCA_to_Index[m_DoubleClickAction]); m_shiftdblclk_cbox.SetCurSel(m_DCA_to_Index[m_ShiftDoubleClickAction]); GetDlgItem(IDC_OTHERBROWSERLOCATION)->SetWindowText(m_OtherBrowserLocation); GetDlgItem(IDC_OTHEREDITORLOCATION)->SetWindowText(m_OtherEditorLocation); CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_DADSPIN); pspin->SetBuddy(GetDlgItem(IDC_DB_DEF_AUTOTYPE_DELAY)); pspin->SetRange32(1, 60000); pspin->SetBase(10); pspin->SetPos(m_AutotypeDelay); InitToolTip(); // Note naming convention: string IDS_xxx corresponds to control IDC_xxx AddTool(IDC_MAINTAINDATETIMESTAMPS, IDS_MAINTAINDATETIMESTAMPS); AddTool(IDC_OTHERBROWSERLOCATION, IDS_OTHERBROWSERLOCATION); AddTool(IDC_OTHEREDITORLOCATION, IDS_OTHEREDITORLOCATION); ActivateToolTip(); return TRUE; }
///////////////////////////////////////////////////////////////////////////// // CElementPropPage message handlers BOOL CElementPropPage::OnInitDialog() { COlePropertyPage::OnInitDialog(); // TODO: Add extra initialization here CSpinButtonCtrl* pSpin; pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_WIDTH); // Set the buddy control pSpin->SetBuddy (GetDlgItem(IDC_EDIT_WIDTH)); // Set Spin Control Range pSpin->SetRange(0,5); int count; GetPropText(L"ElementCount",&count); CString str("0"); if(count) { SetPropText(L"Element", str); str = "Element-0"; m_lbElementList.AddString(str); m_lbElementList.SetCurSel(0); UpdateControls(); } m_lbElementList.ResetContent(); for (int i=0; i<count; i++) { str.Format(L"Element-%d",i); m_lbElementList.AddString(str); str.Format(L"%d",count-1); SetPropText(L"Element", str); m_lbElementList.SetCurSel(count-1); UpdateControls(); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
/* OnInitDialog() */ BOOL CWallPaperDrawSettingsAlphaDlg::OnInitDialog(void) { // classe base CPropertyPage::OnInitDialog(); // imposta lo spin button per la trasparenza CSpinButtonCtrl* pSpin; pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_LAYERED); pSpin->SetRange(LWA_ALPHA_INVISIBLE,LWA_ALPHA_OPAQUE); pSpin->SetPos(m_nLayered); pSpin->SetBuddy(GetDlgItem(IDC_EDIT_LAYERED)); // abilita i controlli GetDlgItem(IDC_CHECK_LAYERED)->EnableWindow(m_enumOsVer==WINDOWS_2000 || m_enumOsVer==WINDOWS_XP || m_enumOsVer==WINDOWS_VISTA || m_enumOsVer==WINDOWS_SEVEN); GetDlgItem(IDC_STATIC_LAYERED)->EnableWindow(m_enumOsVer==WINDOWS_2000 || m_enumOsVer==WINDOWS_XP || m_enumOsVer==WINDOWS_VISTA || m_enumOsVer==WINDOWS_SEVEN); GetDlgItem(IDC_EDIT_LAYERED)->EnableWindow(m_bLayered); GetDlgItem(IDC_SPIN_LAYERED)->EnableWindow(m_bLayered); char szBuffer[2048] = {"The transparency effect requires Windows 2000 or higher, currently you are running on:\r\n\r\n"}; int n = strlen(szBuffer)-1; m_winVer.GetPlatformInfo(szBuffer+n,sizeof(szBuffer)-n); GetDlgItem(IDC_STATIC_OS)->SetWindowText(szBuffer); CString strLayered; strLayered.Format("(%d = invisible, %d = opaque)",LWA_ALPHA_INVISIBLE,LWA_ALPHA_OPAQUE); SetDlgItemText(IDC_STATIC_LAYERED,strLayered); // aggiunge i tooltips if(m_Tooltip.Create(this,TTS_ALWAYSTIP)) { m_Tooltip.SetWidth(TOOLTIP_REASONABLE_WIDTH); m_Tooltip.SetDelay(TOOLTIP_REASONABLE_DELAYTIME); m_Tooltip.AddTooltip(GetDlgItem(IDC_CHECK_LAYERED),IDC_CHECK_LAYERED,IDS_TOOLTIP_OPTIONS_DRAW_TRANSPARENCY); m_Tooltip.AddTooltip(GetDlgItem(IDC_EDIT_LAYERED),IDC_EDIT_LAYERED,IDS_TOOLTIP_OPTIONS_DRAW_TRANSPARENCYVALUE); m_Tooltip.AddTooltip(GetDlgItem(IDC_SPIN_LAYERED),IDC_SPIN_LAYERED,IDS_TOOLTIP_OPTIONS_DRAW_TRANSPARENCYVALUE); } UpdateData(FALSE); return(FALSE); }
BOOL CPage_Status::OnInitDialog() { CMyPropertyPage::OnInitDialog(); for (WORD nID = IDC_STATUS_HP_UP; nID != IDC_STATUS_HP_DEF + 1; ++nID) { ((CEdit *)GetDlgItem(nID))->SetLimitText(11); } for (WORD nID = IDC_STATUS_EP_UP; nID != IDC_STATUS_RNG + 1; ++nID) { ((CEdit *)GetDlgItem(nID))->SetLimitText(6); } CSpinButtonCtrl *pSpin; for (WORD nID = 0; nID != 7; ++nID) { pSpin = ((CSpinButtonCtrl *)GetDlgItem(IDC_STATUS_CHI_SPIN + nID)); pSpin->SetBuddy(GetDlgItem(IDC_STATUS_CHI + nID)); pSpin->SetRange(0, MAX_CONDITION); } return TRUE; }
BOOL CAddEdit_Additional::OnInitDialog() { CAddEdit_PropertyPage::OnInitDialog(); ModifyStyleEx(0, WS_EX_CONTROLPARENT); m_stc_warning.SetColour(RGB(255, 0, 0)); m_stc_warning.ShowWindow(SW_HIDE); CString cs_dats; StringX sx_dats = PWSprefs::GetInstance()-> GetPref(PWSprefs::DefaultAutotypeString); if (sx_dats.empty()) cs_dats = DEFAULT_AUTOTYPE; else cs_dats.Format(IDS_DEFAULTAUTOTYPE, sx_dats.c_str()); GetDlgItem(IDC_DEFAULTAUTOTYPE)->SetWindowText(cs_dats); if (M_uicaller() != IDS_ADDENTRY) { InitToolTip(); AddTool(IDC_STATIC_AUTO, IDS_CLICKTOCOPYEXPAND); AddTool(IDC_STATIC_RUNCMD, IDS_CLICKTOCOPYEXPAND); AddTool(IDC_ENTKBSHCTHOTKEY, IDS_KBS_TOOLTIP0); ActivateToolTip(); m_stc_autotype.SetHighlight(true, CAddEdit_PropertyPage::crefWhite); m_stc_runcommand.SetHighlight(true, CAddEdit_PropertyPage::crefWhite); } m_KBShortcutCtrl.SetMyParent(this); // These wil be zero for Add entry WORD wVirtualKeyCode = M_KBShortcut() & 0xff; WORD wPWSModifiers = M_KBShortcut() >> 16; // Translate from PWS to CHotKeyCtrl modifiers WORD wHKModifiers = ConvertModifersPWS2MFC(wPWSModifiers); m_KBShortcutCtrl.SetHotKey(wVirtualKeyCode, wHKModifiers); // We could do this to ensure user has at least Alt or Ctrl key // But it gets changed without the user knowing - so we do it elsewhere // instead and tell them. //m_KBShortcutCtrl.SetRules(HKCOMB_NONE | HKCOMB_S, HOTKEYF_ALT); if (M_uicaller() == IDS_VIEWENTRY || M_protected() != 0) { // Disable normal Edit controls GetDlgItem(IDC_AUTOTYPE)->SendMessage(EM_SETREADONLY, TRUE, 0); GetDlgItem(IDC_RUNCMD)->SendMessage(EM_SETREADONLY, TRUE, 0); // Disable HotKey m_KBShortcutCtrl.EnableWindow(FALSE); // Disable Combobox GetDlgItem(IDC_DOUBLE_CLICK_ACTION)->EnableWindow(FALSE); GetDlgItem(IDC_SHIFT_DOUBLE_CLICK_ACTION)->EnableWindow(FALSE); } // For some reason, MFC calls us twice when initializing. // SetupDCAComboBoxes is idempotent SetupDCAComboBoxes(&m_dblclk_cbox, false); SetupDCAComboBoxes(&m_shiftdblclk_cbox, true); short iDCA; if (M_DCA() < PWSprefs::minDCA || M_DCA() > PWSprefs::maxDCA) iDCA = (short)PWSprefs::GetInstance()->GetPref(PWSprefs::DoubleClickAction); else iDCA = M_DCA(); m_dblclk_cbox.SetCurSel(m_DCA_to_Index[iDCA]); if (M_ShiftDCA() < PWSprefs::minDCA || M_ShiftDCA() > PWSprefs::maxDCA) iDCA = (short)PWSprefs::GetInstance()->GetPref(PWSprefs::ShiftDoubleClickAction); else iDCA = M_ShiftDCA(); m_shiftdblclk_cbox.SetCurSel(m_DCA_to_Index[iDCA]); // Password History M_oldMaxPWHistory() = M_MaxPWHistory(); GetDlgItem(IDC_MAXPWHISTORY)->EnableWindow(M_SavePWHistory()); CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_PWHSPIN); pspin->SetBuddy(GetDlgItem(IDC_MAXPWHISTORY)); pspin->SetRange(1, 255); pspin->SetBase(10); pspin->SetPos((int)M_MaxPWHistory()); if (M_uicaller() == IDS_ADDENTRY) { GetDlgItem(IDC_CLEAR_PWHIST)->ShowWindow(SW_HIDE); GetDlgItem(IDC_PWHISTORY_LIST)->ShowWindow(SW_HIDE); GetDlgItem(IDC_PWH_COPY_ALL)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STATIC_PWH_EDIT)->ShowWindow(SW_HIDE); UpdateData(FALSE); m_bInitdone = true; return TRUE; } GetDlgItem(IDC_STATIC_PWH_ADD)->ShowWindow(SW_HIDE); BOOL bpwh_count = M_pwhistlist().empty() ? FALSE : TRUE; GetDlgItem(IDC_CLEAR_PWHIST)->EnableWindow(bpwh_count); GetDlgItem(IDC_PWHISTORY_LIST)->EnableWindow(bpwh_count); GetDlgItem(IDC_PWH_COPY_ALL)->EnableWindow(bpwh_count); if (M_uicaller() == IDS_VIEWENTRY || M_protected() != 0) { GetDlgItem(IDC_MAXPWHISTORY)->EnableWindow(FALSE); GetDlgItem(IDC_PWHSPIN)->EnableWindow(FALSE); GetDlgItem(IDC_SAVE_PWHIST)->EnableWindow(FALSE); GetDlgItem(IDC_CLEAR_PWHIST)->EnableWindow(FALSE); } m_PWHistListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT); m_PWHistListCtrl.UpdateRowHeight(false); CString cs_text; cs_text.LoadString(IDS_SETDATETIME); m_PWHistListCtrl.InsertColumn(0, cs_text); cs_text.LoadString(IDS_PASSWORD); m_PWHistListCtrl.InsertColumn(1, cs_text); PWHistList::iterator iter; DWORD nIdx; for (iter = M_pwhistlist().begin(), nIdx = 0; iter != M_pwhistlist().end(); iter++, nIdx++) { int nPos = 0; const PWHistEntry pwhentry = *iter; if (pwhentry.changetttdate != 0) { const StringX locTime = PWSUtil::ConvertToDateTimeString(pwhentry.changetttdate, PWSUtil::TMC_LOCALE); nPos = m_PWHistListCtrl.InsertItem(nPos, locTime.c_str()); } else { cs_text.LoadString(IDS_UNKNOWN); cs_text.Trim(); nPos = m_PWHistListCtrl.InsertItem(nPos, cs_text); } m_PWHistListCtrl.SetItemText(nPos, 1, pwhentry.password.c_str()); m_PWHistListCtrl.SetItemData(nPos, nIdx); } m_PWHistListCtrl.SetRedraw(FALSE); for (int i = 0; i < 2; i++) { m_PWHistListCtrl.SetColumnWidth(i, LVSCW_AUTOSIZE); int nColumnWidth = m_PWHistListCtrl.GetColumnWidth(i); m_PWHistListCtrl.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER); int nHeaderWidth = m_PWHistListCtrl.GetColumnWidth(i); m_PWHistListCtrl.SetColumnWidth(i, max(nColumnWidth, nHeaderWidth)); } m_PWHistListCtrl.SetRedraw(TRUE); wchar_t buffer[10]; swprintf_s(buffer, 10, L"%lu", M_NumPWHistory()); if (M_original_entrytype() == CItemData::ET_ALIAS) { GetDlgItem(IDC_MAXPWHISTORY)->EnableWindow(FALSE); GetDlgItem(IDC_PWHSPIN)->EnableWindow(FALSE); GetDlgItem(IDC_SAVE_PWHIST)->EnableWindow(FALSE); GetDlgItem(IDC_CLEAR_PWHIST)->EnableWindow(FALSE); GetDlgItem(IDC_STATIC_OLDPW1)->EnableWindow(FALSE); } m_stc_warning.SetColour(RGB(255, 0, 0)); m_stc_warning.ShowWindow(SW_HIDE); UpdateData(FALSE); m_bInitdone = true; return TRUE; }
BOOL CHello2Dlg::OnInitDialog() { SHELLEXECUTEINFO execInf; ZeroMemory (&execInf, sizeof (execInf)); execInf.cbSize = sizeof (SHELLEXECUTEINFO); execInf.fMask = NULL; execInf.nShow = SW_SHOWNORMAL; execInf.lpFile = _T("\\windows\\explorer.exe"); execInf.lpVerb = NULL; execInf.lpParameters = _T("\\windows"); execInf.hInstApp = NULL; execInf.hwnd = NULL; ShellExecuteEx (&execInf); CDialog::OnInitDialog(); CTabCtrl *ct = (CTabCtrl*)GetDlgItem(IDC_TAB1); ct->SetMinTabWidth(50); // 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动 // 执行此操作 SetIcon(m_hIcon, TRUE); // 设置大图标 SetIcon(m_hIcon, FALSE); // 设置小图标 CenterWindow(GetDesktopWindow()); // center to the hpc screen CRect rect; GetWindowRect(&rect); this->MoveWindow(0,0,rect.Width(),rect.Height()); m_prbdlg = new CProbeDialog(); m_prbdlg->Create(IDD_PROBE2_CFG,this); MoveWindowTo(m_prbdlg,0,MOVETOTOP,SW_HIDE); m_sysdlg = new CSystemDialog(); m_sysdlg->Create(IDD_SYSTEM2_CFG,this); MoveWindowTo(m_sysdlg,0,MOVETOTOP,SW_HIDE); m_fltdlg = new CFilterDialog(); m_fltdlg->Create(IDD_FILTER2_CFG,this); MoveWindowTo(m_fltdlg,0,MOVETOTOP,SW_HIDE); m_ccfg = new CCoefDialog(); m_ccfg->Create(IDD_COEF_DIALOG,this); MoveWindowTo(m_ccfg,0,MOVETOTOP,SW_HIDE); m_keydlg = new CKeyDialog(); m_keydlg->Create(IDD_KEYDIALOG,this); MoveWindowTo(m_keydlg,1,MOVETOBOTTOM,SW_HIDE); for(int i=0;i<sizeof(m_ridlgs)/sizeof(CRunitemDialog*);i++){ m_ridlgs[i] = new CRunitemDialog(); m_ridlgs[i]->m_ch = i+1; m_ridlgs[i]->cfg_now = CFGTYPE_NONE; m_ridlgs[i]->Create(IDD_RUNITEM,this); m_ridlgs[i]->LoadLastConfig(); /* m_runtab.InsertItem(i,name); m_ridlgs[i]->DisplayBar(true); MoveWindowTo(m_ridlgs[i],0,MOVETOTOP,SW_HIDE); */ } CSpinButtonCtrl *spin = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN1); spin->SetBuddy(GetDlgItem(IDC_RUNCOUNT)); spin->SetRange(-1,10000); m_cfgtab.InsertItem(0,_T(" 铂电阻测温 ")); m_cfgtab.InsertItem(1,_T(" 热电偶测温 ")); m_cfgtab.InsertItem(2,_T(" 探头设置 ")); m_cfgtab.InsertItem(3,_T(" 标准设置 ")); m_cfgtab.InsertItem(4,_T(" 滤波设置 ")); m_cfgtab.SetCurSel(0); curview = 0; thread_cmd = CMD_ABORT; cur_prg = NULL; hThread = CreateThread(NULL,NULL,OneRunThread,this ,0,&dwThreadId); // TODO: Add extra initialization here SetTimer(1,TIMER_LEN,NULL); LoadCurrentView(); // m_chlist.SetCurSel(curview); return TRUE; // 除非设置了控件的焦点,否则返回 TRUE }
BOOL COptionsBackup::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); m_chkbox.SetTextColour(CR_DATABASE_OPTIONS); m_chkbox.ResetBkgColour(); //Use current window's background if (GetMainDlg()->IsDBOpen() && !GetMainDlg()->IsDBReadOnly()) { GetDlgItem(IDC_STATIC_DB_PREFS_RO_WARNING)->ShowWindow(SW_HIDE); } // Database preferences - can't change in R/O mode of if no DB is open if (!GetMainDlg()->IsDBOpen() || GetMainDlg()->IsDBReadOnly()) { CString cs_Preference_Warning; CString cs_temp(MAKEINTRESOURCE(GetMainDlg()->IsDBOpen() ? IDS_DB_READ_ONLY : IDS_NO_DB)); cs_Preference_Warning.Format(IDS_STATIC_DB_PREFS_RO_WARNING, static_cast<LPCWSTR>(cs_temp)); GetDlgItem(IDC_STATIC_DB_PREFS_RO_WARNING)->SetWindowText(cs_Preference_Warning); GetDlgItem(IDC_SAVEIMMEDIATELY)->EnableWindow(FALSE); } if (m_backupsuffix_cbox.GetCount() == 0) { // add the strings in alphabetical order CString cs_text(MAKEINTRESOURCE(IDS_NONE)); int nIndex; nIndex = m_backupsuffix_cbox.AddString(cs_text); m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_None); m_BKSFX_to_Index[PWSprefs::BKSFX_None] = nIndex; cs_text.LoadString(IDS_DATETIMESTRING); nIndex = m_backupsuffix_cbox.AddString(cs_text); m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_DateTime); m_BKSFX_to_Index[PWSprefs::BKSFX_DateTime] = nIndex; cs_text.LoadString(IDS_INCREMENTNUM); nIndex = m_backupsuffix_cbox.AddString(cs_text); m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_IncNumber); m_BKSFX_to_Index[PWSprefs::BKSFX_IncNumber] = nIndex; } m_backupsuffix_cbox.SetCurSel(m_BKSFX_to_Index[m_BackupSuffix]); GetDlgItem(IDC_BACKUPEXAMPLE)->SetWindowText(L""); CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_BKPMAXINCSPIN); pspin->SetBuddy(GetDlgItem(IDC_BACKUPMAXINC)); pspin->SetRange(1, 999); pspin->SetBase(10); pspin->SetPos(m_MaxNumIncBackups); OnComboChanged(); OnBackupBeforeSave(); if (m_BackupLocation == 1) { ExpandBackupPath(); } if (InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 0)) { m_Help1.Init(IDB_QUESTIONMARK); m_Help2.Init(IDB_QUESTIONMARK); m_Help3.Init(IDB_QUESTIONMARK); m_Help4.Init(IDB_QUESTIONMARK); // Note naming convention: string IDS_xxx corresponds to control IDC_xxx_HELP AddTool(IDC_BACKUPBEFORESAVEHELP, IDS_BACKUPBEFORESAVE); AddTool(IDC_USERBACKUPOTHERLOCATIONHELP, IDS_USERBACKUPOTHERLOCATION); AddTool(IDC_USERBACKUPOTHERLOCATIONHELP2, IDS_USERBACKUPOTHERLOCATION2); AddTool(IDC_SAVEIMMEDIATELYHELP, IDS_SAVEIMMEDIATELY); ActivateToolTip(); } else { m_Help1.EnableWindow(FALSE); m_Help1.ShowWindow(SW_HIDE); m_Help2.EnableWindow(FALSE); m_Help2.ShowWindow(SW_HIDE); m_Help3.EnableWindow(FALSE); m_Help3.ShowWindow(SW_HIDE); m_Help4.EnableWindow(FALSE); m_Help4.ShowWindow(SW_HIDE); } return TRUE; }
BOOL COptionsSystem::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); PWSprefs *prefs = PWSprefs::GetInstance(); if (!m_bShowConfigFile) { GetDlgItem(IDC_STATIC_CONFIGFILE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STATIC_RWSTATUS)->ShowWindow(SW_HIDE); GetDlgItem(IDC_CONFIGFILE)->ShowWindow(SW_HIDE); } else { PWSprefs::ConfigOption configoption; std::wstring wsCF = prefs->GetConfigFile(configoption); std::wstring wsCO(L""); switch (configoption) { case PWSprefs::CF_NONE: LoadAString(wsCF, IDS_NONE); break; case PWSprefs::CF_REGISTRY: LoadAString(wsCF, IDS_REGISTRY); break; case PWSprefs::CF_FILE_RO: LoadAString(wsCO, IDS_READ_ONLY); break; case PWSprefs::CF_FILE_RW: case PWSprefs::CF_FILE_RW_NEW: LoadAString(wsCO, IDS_READ_WRITE); break; default: ASSERT(0); } GetDlgItem(IDC_CONFIGFILE)->SetWindowText(wsCF.c_str()); GetDlgItem(IDC_STATIC_RWSTATUS)->SetWindowText(wsCO.c_str()); } bool bofferdeleteregistry = prefs->OfferDeleteRegistry(); bool boffermigrate2appdata = OfferConfigMigration(); if (!bofferdeleteregistry) { GetDlgItem(IDC_REGDEL)->ShowWindow(SW_HIDE); GetDlgItem(IDC_REGDEL)->EnableWindow(FALSE); } if (!boffermigrate2appdata) { GetDlgItem(IDC_MIGRATETOAPPDATA)->ShowWindow(SW_HIDE); GetDlgItem(IDC_MIGRATETOAPPDATA)->EnableWindow(FALSE); } if (!bofferdeleteregistry && !boffermigrate2appdata) { GetDlgItem(IDC_CONFIG_GRP)->ShowWindow(SW_HIDE); GetDlgItem(IDC_APPLYCONFIGCHANGES)->ShowWindow(SW_HIDE); } else { GetDlgItem(IDC_APPLYCONFIGCHANGES)->ShowWindow(SW_SHOW); } GetDlgItem(IDC_APPLYCONFIGCHANGES)->EnableWindow(FALSE); CSpinButtonCtrl *pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_RESPIN); pspin->SetBuddy(GetDlgItem(IDC_MAXREITEMS)); pspin->SetRange(0, ID_TRAYRECENT_ENTRYMAX - ID_TRAYRECENT_ENTRY1 + 1); pspin->SetBase(10); pspin->SetPos(m_MaxREItems); pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_MRUSPIN); pspin->SetBuddy(GetDlgItem(IDC_MAXMRUITEMS)); pspin->SetRange(0, ID_FILE_MRU_ENTRYMAX - ID_FILE_MRU_ENTRY1 + 1); pspin->SetBase(10); pspin->SetPos(m_MaxMRUItems); OnUseSystemTray(); InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 2); AddTool(IDC_REGDEL, IDS_REGDEL); AddTool(IDC_MIGRATETOAPPDATA, IDS_MIGRATETOAPPDATA); ActivateToolTip(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL COptionsSystem::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); PWSprefs *prefs = PWSprefs::GetInstance(); PWSprefs::ConfigOption configoption; StringX sx_CF = prefs->GetConfigFile(configoption).c_str(); std::wstring wsCO(L""); switch (configoption) { case PWSprefs::CF_NONE: LoadAString(sx_CF, IDS_NONE); break; case PWSprefs::CF_REGISTRY: LoadAString(sx_CF, IDS_REGISTRY); break; case PWSprefs::CF_FILE_RO: LoadAString(wsCO, IDS_READ_ONLY); break; case PWSprefs::CF_FILE_RW: case PWSprefs::CF_FILE_RW_NEW: LoadAString(wsCO, IDS_READ_WRITE); break; default: ASSERT(0); } CString cs_text; // R/W status GetDlgItem(IDC_STATIC_RWSTATUS)->SetWindowText(wsCO.c_str()); // Config file name & location cs_text = PWSUtil::NormalizeTTT(sx_CF, 60).c_str(); GetDlgItem(IDC_CONFIGFILE)->SetWindowText(cs_text); // Effective host & user used in config file if (configoption == PWSprefs::CF_FILE_RO || configoption == PWSprefs::CF_FILE_RW || configoption == PWSprefs::CF_FILE_RW_NEW) { stringT hn = SysInfo::GetInstance()->GetEffectiveHost(); PWSprefs::XMLify(charT('H'), hn); stringT un = SysInfo::GetInstance()->GetEffectiveUser(); PWSprefs::XMLify(charT('u'), un); cs_text.Format(IDS_HOSTUSER, static_cast<LPCWSTR>(hn.c_str()), static_cast<LPCWSTR>(un.c_str())); GetDlgItem(IDC_STATIC_HOSTUSER)->SetWindowText(cs_text); } bool bofferdeleteregistry = prefs->OfferDeleteRegistry(); bool boffermigrate2appdata = OfferConfigMigration(); if (!bofferdeleteregistry) { GetDlgItem(IDC_REGDEL)->ShowWindow(SW_HIDE); GetDlgItem(IDC_REGDEL)->EnableWindow(FALSE); } if (!boffermigrate2appdata) { GetDlgItem(IDC_MIGRATETOAPPDATA)->ShowWindow(SW_HIDE); GetDlgItem(IDC_MIGRATETOAPPDATA)->EnableWindow(FALSE); } if (!bofferdeleteregistry && !boffermigrate2appdata) { GetDlgItem(IDC_CONFIG_GRP)->ShowWindow(SW_HIDE); GetDlgItem(IDC_APPLYCONFIGCHANGES)->ShowWindow(SW_HIDE); } else { GetDlgItem(IDC_APPLYCONFIGCHANGES)->ShowWindow(SW_SHOW); } GetDlgItem(IDC_APPLYCONFIGCHANGES)->EnableWindow(FALSE); CSpinButtonCtrl *pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_RESPIN); pspin->SetBuddy(GetDlgItem(IDC_MAXREITEMS)); pspin->SetRange(M_prefminREItems(), M_prefmaxREItems()); pspin->SetBase(10); pspin->SetPos(m_MaxREItems); pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_MRUSPIN); pspin->SetBuddy(GetDlgItem(IDC_MAXMRUITEMS)); pspin->SetRange(M_prefminMRU(), M_prefmaxMRU()); pspin->SetBase(10); pspin->SetPos(m_MaxMRUItems); OnUseSystemTray(); if (InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 0)) { m_Help1.Init(IDB_QUESTIONMARK); m_Help2.Init(IDB_QUESTIONMARK); // Note naming convention: string IDS_xxx corresponds to control IDC_xxx_HELP AddTool(IDC_REGDELHELP, IDS_REGDEL); AddTool(IDC_MIGRATETOAPPDATAHELP, IDS_MIGRATETOAPPDATA); ActivateToolTip(); } else { m_Help1.EnableWindow(FALSE); m_Help1.ShowWindow(SW_HIDE); m_Help2.EnableWindow(FALSE); m_Help2.ShowWindow(SW_HIDE); } if (!bofferdeleteregistry) { m_Help1.EnableWindow(FALSE); m_Help1.ShowWindow(SW_HIDE); } if (!boffermigrate2appdata) { m_Help2.EnableWindow(FALSE); m_Help2.ShowWindow(SW_HIDE); } return TRUE; // return TRUE unless you set the focus to a control }
BOOL COptionsMisc::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 } // Database preferences - can't change in R/O mode of if no DB is open if (!GetMainDlg()->IsDBOpen() || GetMainDlg()->IsDBReadOnly()) { GetDlgItem(IDC_DEFUSERNAME)->EnableWindow(FALSE); GetDlgItem(IDC_STATIC_USERNAME)->EnableWindow(FALSE); GetDlgItem(IDC_STATIC_DEFAUTOTYPE)->EnableWindow(FALSE); GetDlgItem(IDC_DB_DEF_AUTOTYPE_TEXT)->EnableWindow(FALSE); GetDlgItem(IDC_MAINTAINDATETIMESTAMPS)->EnableWindow(FALSE); GetDlgItem(IDC_USEDEFUSER)->EnableWindow(FALSE); } OnUseDefUser(); // For some reason, MFC calls us twice when initializing. // Populate the combo box only once. if (m_dblclk_cbox.GetCount() == 0) { SetupCombo(&m_dblclk_cbox); } if (m_shiftdblclk_cbox.GetCount() == 0) { SetupCombo(&m_shiftdblclk_cbox); } m_dblclk_cbox.SetCurSel(m_DCA_to_Index[m_DoubleClickAction]); m_shiftdblclk_cbox.SetCurSel(m_DCA_to_Index[m_ShiftDoubleClickAction]); GetDlgItem(IDC_OTHERBROWSERLOCATION)->SetWindowText(m_OtherBrowserLocation); GetDlgItem(IDC_OTHEREDITORLOCATION)->SetWindowText(m_OtherEditorLocation); CSpinButtonCtrl *pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_DADSPIN); pspin->SetBuddy(GetDlgItem(IDC_DB_DEF_AUTOTYPE_DELAY)); pspin->SetRange32(M_prefminAutotypeDelay(), M_prefmaxAutotypeDelay()); pspin->SetBase(10); pspin->SetPos(m_AutotypeDelay); if (InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 0)) { m_Help1.Init(IDB_QUESTIONMARK); m_Help2.Init(IDB_QUESTIONMARK); m_Help3.Init(IDB_QUESTIONMARK); // Note naming convention: string IDS_xxx corresponds to control IDC_xxx_HELP AddTool(IDC_MAINTAINDATETIMESTAMPSHELP, IDS_MAINTAINDATETIMESTAMPS); AddTool(IDC_OTHERBROWSERLOCATIONHELP, IDS_OTHERBROWSERLOCATION); AddTool(IDC_OTHEREDITORLOCATIONHELP, IDS_OTHEREDITORLOCATION); ActivateToolTip(); } else { m_Help1.EnableWindow(FALSE); m_Help1.ShowWindow(SW_HIDE); m_Help2.EnableWindow(FALSE); m_Help2.ShowWindow(SW_HIDE); m_Help3.EnableWindow(FALSE); m_Help3.ShowWindow(SW_HIDE); } return TRUE; // return TRUE unless you set the focus to a control }
/* OnInitDialog() */ BOOL CWallBrowserTwoParamsDlg::OnInitDialog(void) { CDialog::OnInitDialog(); HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); SetIcon(hIcon,TRUE); SetIcon(hIcon,FALSE); SetDlgItemText(IDC_STATIC_PROPERTY,m_strProperty); CSpinButtonCtrl* pSpinFirst = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_VALUE); pSpinFirst->SetRange(m_nFirstMin,m_nFirstMax); pSpinFirst->SetPos(m_nFirstDefaultValue); pSpinFirst->SetBuddy(GetDlgItem(IDC_EDIT_VALUE)); if(m_strSubOperation=="Halftone") { m_CComboSubValue.AddString("print"); // HT_PRINT m_CComboSubValue.AddString("display"); // HT_VIEW } else if(m_strSubOperation=="Emboss") { m_CComboSubValue.AddString("north"); // EMBOSS_N m_CComboSubValue.AddString("north/east"); // EMBOSS_NE m_CComboSubValue.AddString("east"); // EMBOSS_E m_CComboSubValue.AddString("south/east"); // EMBOSS_SE m_CComboSubValue.AddString("south"); // EMBOSS_S m_CComboSubValue.AddString("south/west"); // EMBOSS_SW m_CComboSubValue.AddString("west"); // EMBOSS_W m_CComboSubValue.AddString("north/west"); // EMBOSS_NW } else if(m_strSubOperation=="Noise") { m_CComboSubValue.AddString("all channels"); // NOISE_CHANNEL_MASTER m_CComboSubValue.AddString("red channel"); // NOISE_CHANNEL_RED m_CComboSubValue.AddString("green channel"); // NOISE_CHANNEL_GREEN m_CComboSubValue.AddString("blue channel"); // NOISE_CHANNEL_BLUE } else m_bHaveCombo = FALSE; CString str; str.Format("%s (%d/%d)",m_strOperation,m_nFirstMin,m_nFirstMax); SetDlgItemText(IDC_STATIC_OPERATION,str); if(m_bHaveCombo) { SetDlgItemText(IDC_STATIC_SUBOPERATION,m_strSubOperation); GetDlgItem(IDC_EDIT_SUBVALUE)->EnableWindow(FALSE); GetDlgItem(IDC_EDIT_SUBVALUE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_SPIN_SUBVALUE)->EnableWindow(FALSE); GetDlgItem(IDC_SPIN_SUBVALUE)->ShowWindow(SW_HIDE); m_CComboSubValue.SetCurSel(0); } else { str.Format("%s (%d/%d)",m_strSubOperation,m_nSecondMin,m_nSecondMax); SetDlgItemText(IDC_STATIC_SUBOPERATION,str); GetDlgItem(IDC_COMBO_SUBVALUE)->EnableWindow(FALSE); GetDlgItem(IDC_COMBO_SUBVALUE)->ShowWindow(SW_HIDE); CSpinButtonCtrl *pSpinSecond = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_SUBVALUE); pSpinSecond->SetRange(m_nSecondMin,m_nSecondMax); pSpinFirst->SetPos(m_nSecondDefaultValue); pSpinSecond->SetBuddy(GetDlgItem (IDC_EDIT_SUBVALUE)); } UpdateData(FALSE); return(TRUE); }
/* OnInitDialog() */ BOOL CWallPaperDrawSettingsModeDlg::OnInitDialog(void) { // classe base CPropertyPage::OnInitDialog(); // imposta i radio buttons switch(m_nDrawMode) { case DRAWMODE_ORIGINAL_SIZE: case DRAWMODE_FIT_TO_SCREEN: case DRAWMODE_STRETCH_TO_SCREEN: case DRAWMODE_STRETCH_TO_RECT: case DRAWMODE_STRETCH_IF_DOES_NOT_FIT: case DRAWMODE_TILE_STRETCH: case DRAWMODE_TILE_FIT: case DRAWMODE_OVERLAP_STRETCH: case DRAWMODE_OVERLAP_FIT: m_nOwnerMode = 0; m_nWindowsMode = 1; break; case DRAWMODE_WINDOWS_NORMAL: case DRAWMODE_WINDOWS_TILE: case DRAWMODE_WINDOWS_STRETCH: m_nOwnerMode = 1; m_nWindowsMode = 0; break; } switch(m_nDrawMode) { case DRAWMODE_TILE_STRETCH: GetDlgItem(IDC_STATIC_AREARATIO)->SetWindowText(IDS_DRAWOWNERMODE_TILE_STRETCH_TEXT); break; case DRAWMODE_TILE_FIT: GetDlgItem(IDC_STATIC_AREARATIO)->SetWindowText(IDS_DRAWOWNERMODE_TILE_FIT_TEXT); break; case DRAWMODE_OVERLAP_STRETCH: GetDlgItem(IDC_STATIC_AREARATIO)->SetWindowText(IDS_DRAWOWNERMODE_OVERLAP_STRETCH_TEXT); break; case DRAWMODE_OVERLAP_FIT: GetDlgItem(IDC_STATIC_AREARATIO)->SetWindowText(IDS_DRAWOWNERMODE_OVERLAP_FIT_TEXT); break; } // abilita i controlli GetDlgItem(IDC_EDIT_AREA)->EnableWindow(FALSE); GetDlgItem(IDC_SPIN_AREA)->EnableWindow(FALSE); GetDlgItem(IDC_EDIT_WIDTH)->EnableWindow(FALSE); GetDlgItem(IDC_SPIN_WIDTH)->EnableWindow(FALSE); GetDlgItem(IDC_EDIT_HEIGHT)->EnableWindow(FALSE); GetDlgItem(IDC_SPIN_HEIGHT)->EnableWindow(FALSE); // carica il combo con le modalita' proprie m_wndComboOwnerMode.AddString(IDS_DRAWOWNERMODE_ORIGINAL_SIZE); m_wndComboOwnerMode.AddString(IDS_DRAWOWNERMODE_FIT_TO_SCREEN); m_wndComboOwnerMode.AddString(IDS_DRAWOWNERMODE_STRETCH_TO_SCREEN); m_wndComboOwnerMode.AddString(IDS_DRAWOWNERMODE_STRETCH_TO_SCREEN_IF_DOES_NOT_FIT); m_wndComboOwnerMode.AddString(IDS_DRAWOWNERMODE_STRETCH_TO_RECT); m_wndComboOwnerMode.AddString(IDS_DRAWOWNERMODE_TILE_STRETCH); m_wndComboOwnerMode.AddString(IDS_DRAWOWNERMODE_TILE_FIT); m_wndComboOwnerMode.AddString(IDS_DRAWOWNERMODE_OVERLAP_STRETCH); m_wndComboOwnerMode.AddString(IDS_DRAWOWNERMODE_OVERLAP_FIT); int nIndex = -1; switch(m_nDrawMode) { case DRAWMODE_ORIGINAL_SIZE: nIndex = 0; break; case DRAWMODE_FIT_TO_SCREEN: nIndex = 1; break; case DRAWMODE_STRETCH_TO_SCREEN: nIndex = 2; break; case DRAWMODE_STRETCH_IF_DOES_NOT_FIT: nIndex = 3; break; case DRAWMODE_STRETCH_TO_RECT: nIndex = 4; GetDlgItem(IDC_EDIT_WIDTH)->EnableWindow(TRUE); GetDlgItem(IDC_SPIN_WIDTH)->EnableWindow(TRUE); GetDlgItem(IDC_EDIT_HEIGHT)->EnableWindow(TRUE); GetDlgItem(IDC_SPIN_HEIGHT)->EnableWindow(TRUE); break; case DRAWMODE_TILE_STRETCH: nIndex = 5; GetDlgItem(IDC_EDIT_AREA)->EnableWindow(TRUE); GetDlgItem(IDC_SPIN_AREA)->EnableWindow(TRUE); break; case DRAWMODE_TILE_FIT: nIndex = 6; GetDlgItem(IDC_EDIT_AREA)->EnableWindow(TRUE); GetDlgItem(IDC_SPIN_AREA)->EnableWindow(TRUE); break; case DRAWMODE_OVERLAP_STRETCH: nIndex = 7; GetDlgItem(IDC_EDIT_AREA)->EnableWindow(TRUE); GetDlgItem(IDC_SPIN_AREA)->EnableWindow(TRUE); break; case DRAWMODE_OVERLAP_FIT: nIndex = 8; GetDlgItem(IDC_EDIT_AREA)->EnableWindow(TRUE); GetDlgItem(IDC_SPIN_AREA)->EnableWindow(TRUE); break; } m_wndComboOwnerMode.SetCurSel(nIndex >= 0 ? nIndex : 0); GetDlgItem(IDC_COMBO_OWNERMODE)->EnableWindow(nIndex >= 0 ? TRUE : FALSE); // carica il combo con le modalita' previste dal sistema m_wndComboWindowsMode.AddString(IDS_DRAWWINDOWSMODE_NORMAL); m_wndComboWindowsMode.AddString(IDS_DRAWWINDOWSMODE_TILE); m_wndComboWindowsMode.AddString(IDS_DRAWWINDOWSMODE_STRETCH); nIndex = -1; switch(m_nDrawMode) { case DRAWMODE_WINDOWS_NORMAL: nIndex = 0; break; case DRAWMODE_WINDOWS_TILE: nIndex = 1; break; case DRAWMODE_WINDOWS_STRETCH: nIndex = 2; break; } m_wndComboWindowsMode.SetCurSel(nIndex >= 0 ? nIndex : 0); GetDlgItem(IDC_COMBO_WINDOWSMODE)->EnableWindow(nIndex >= 0 ? TRUE : FALSE); // imposta gli spin buttons per le dimensioni del rettangolo CSpinButtonCtrl* pSpin; pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_AREA); pSpin->SetRange(1,100); pSpin->SetPos(m_nAreaRatio); pSpin->SetBuddy(GetDlgItem(IDC_EDIT_AREA)); pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_WIDTH); pSpin->SetRange((short)m_nMinWidth,(short)m_nScreenWidth); pSpin->SetPos(m_nWidth); pSpin->SetBuddy(GetDlgItem(IDC_EDIT_WIDTH)); pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_HEIGHT); pSpin->SetRange((short)m_nMinHeight,(short)m_nScreenHeight); pSpin->SetPos(m_nHeight); pSpin->SetBuddy(GetDlgItem(IDC_EDIT_HEIGHT)); // carica il combo con gli effetti m_wndComboEffect.AddString(IDS_DRAWEFFECT_NONE); m_wndComboEffect.AddString(IDS_DRAWEFFECT_GRAYSCALE); m_wndComboEffect.AddString(IDS_DRAWEFFECT_ROTATE90LEFT); m_wndComboEffect.AddString(IDS_DRAWEFFECT_ROTATE90RIGHT); m_wndComboEffect.AddString(IDS_DRAWEFFECT_ROTATE180); m_wndComboEffect.AddString(IDS_DRAWEFFECT_BLUR); m_wndComboEffect.AddString(IDS_DRAWEFFECT_BRIGHTNESS); m_wndComboEffect.AddString(IDS_DRAWEFFECT_CONTRAST); m_wndComboEffect.AddString(IDS_DRAWEFFECT_EDGEENHANCE); m_wndComboEffect.AddString(IDS_DRAWEFFECT_EMBOSS); m_wndComboEffect.AddString(IDS_DRAWEFFECT_FINDEDGE); m_wndComboEffect.AddString(IDS_DRAWEFFECT_INVERT); m_wndComboEffect.AddString(IDS_DRAWEFFECT_MIRRORH); m_wndComboEffect.AddString(IDS_DRAWEFFECT_MIRRORV); m_wndComboEffect.AddString(IDS_DRAWEFFECT_SHARPEN); nIndex = -1; BOOL bEnableEffectValue = FALSE; switch(m_nDrawEffect) { case DRAWEFFECT_NONE: nIndex = 0; break; case DRAWEFFECT_GRAYSCALE: nIndex = 1; break; case DRAWEFFECT_ROTATE90LEFT: nIndex = 2; break; case DRAWEFFECT_ROTATE90RIGHT: nIndex = 3; break; case DRAWEFFECT_ROTATE180: nIndex = 4; break; case DRAWEFFECT_BLUR: bEnableEffectValue = m_ImageParams.GetBlurMin()!=0 || m_ImageParams.GetBlurMax()!=0; nIndex = 5; break; case DRAWEFFECT_BRIGHTNESS: bEnableEffectValue = m_ImageParams.GetBrightnessMin()!=0 || m_ImageParams.GetBrightnessMax()!=0; nIndex = 6; break; case DRAWEFFECT_CONTRAST: bEnableEffectValue = m_ImageParams.GetContrastMin()!=0 || m_ImageParams.GetContrastMax()!=0; nIndex = 7; break; case DRAWEFFECT_EDGEENHANCE: nIndex = 8; break; case DRAWEFFECT_EMBOSS: bEnableEffectValue = m_ImageParams.GetEmbossMin()!=0 || m_ImageParams.GetEmbossMax()!=0; nIndex = 9; break; case DRAWEFFECT_FINDEDGE: bEnableEffectValue = m_ImageParams.GetFindEdgeMin()!=0 || m_ImageParams.GetFindEdgeMax()!=0; nIndex = 10; break; case DRAWEFFECT_INVERT: nIndex = 11; break; case DRAWEFFECT_MIRRORH: nIndex = 12; break; case DRAWEFFECT_MIRRORV: nIndex = 13; break; case DRAWEFFECT_SHARPEN: bEnableEffectValue = m_ImageParams.GetSharpenMin()!=0 || m_ImageParams.GetSharpenMax()!=0; nIndex = 14; break; case DRAWEFFECT_RANDOM: nIndex = 15; break; } m_wndComboEffect.SetCurSel(nIndex >= 0 ? nIndex : 0); GetDlgItem(IDC_COMBO_EFFECT)->EnableWindow(nIndex >= 0 ? TRUE : FALSE); // imposta lo spin button per il valore pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_EFFECT); pSpin->SetRange(MIN_EFFECT_VALUE,MAX_EFFECT_VALUE); pSpin->SetPos(m_nDrawEffectValue); pSpin->SetBuddy(GetDlgItem(IDC_EDIT_EFFECT)); // abilita i controlli GetDlgItem(IDC_EDIT_EFFECT)->EnableWindow(bEnableEffectValue); GetDlgItem(IDC_SPIN_EFFECT)->EnableWindow(bEnableEffectValue); // aggiunge i tooltips if(m_Tooltip.Create(this,TTS_ALWAYSTIP)) { m_Tooltip.SetWidth(TOOLTIP_REASONABLE_WIDTH); m_Tooltip.SetDelay(TOOLTIP_REASONABLE_DELAYTIME); m_Tooltip.AddTooltip(GetDlgItem(IDC_RADIO_WINDOWSMODE),IDC_RADIO_WINDOWSMODE,IDS_TOOLTIP_OPTIONS_DRAW_MODE); m_Tooltip.AddTooltip(GetDlgItem(IDC_COMBO_WINDOWSMODE),IDC_COMBO_WINDOWSMODE,IDS_TOOLTIP_OPTIONS_DRAW_MODE); m_Tooltip.AddTooltip(GetDlgItem(IDC_RADIO_OWNERMODE),IDC_RADIO_OWNERMODE,IDS_TOOLTIP_OPTIONS_DRAW_OWNER); m_Tooltip.AddTooltip(GetDlgItem(IDC_COMBO_OWNERMODE),IDC_COMBO_OWNERMODE,IDS_TOOLTIP_OPTIONS_DRAW_OWNER); m_Tooltip.AddTooltip(GetDlgItem(IDC_EDIT_AREA),IDC_EDIT_AREA,IDS_TOOLTIP_OPTIONS_DRAW_AREARATIO); m_Tooltip.AddTooltip(GetDlgItem(IDC_SPIN_AREA),IDC_SPIN_AREA,IDS_TOOLTIP_OPTIONS_DRAW_AREARATIO); m_Tooltip.AddTooltip(GetDlgItem(IDC_EDIT_WIDTH),IDC_EDIT_WIDTH,IDS_TOOLTIP_OPTIONS_DRAW_RECTWIDTH); m_Tooltip.AddTooltip(GetDlgItem(IDC_SPIN_WIDTH),IDC_SPIN_WIDTH,IDS_TOOLTIP_OPTIONS_DRAW_RECTWIDTH); m_Tooltip.AddTooltip(GetDlgItem(IDC_EDIT_HEIGHT),IDC_EDIT_HEIGHT,IDS_TOOLTIP_OPTIONS_DRAW_RECTHEIGHT); m_Tooltip.AddTooltip(GetDlgItem(IDC_SPIN_HEIGHT),IDC_SPIN_HEIGHT,IDS_TOOLTIP_OPTIONS_DRAW_RECTHEIGHT); m_Tooltip.AddTooltip(GetDlgItem(IDC_COMBO_EFFECT),IDC_COMBO_EFFECT,IDS_TOOLTIP_OPTIONS_DRAW_EFFECT); m_Tooltip.AddTooltip(GetDlgItem(IDC_EDIT_EFFECT),IDC_EDIT_EFFECT,IDS_TOOLTIP_OPTIONS_DRAW_EFFECTVALUE); m_Tooltip.AddTooltip(GetDlgItem(IDC_SPIN_EFFECT),IDC_SPIN_EFFECT,IDS_TOOLTIP_OPTIONS_DRAW_EFFECTVALUE); } UpdateData(FALSE); return(FALSE); }