急!!!!

holyelle 2002-05-17 09:40:49
对话框在用comboboxex控件时,我加入了图像列表,
初始化时setcursel(0)我想问,如果改变了值,下次调用是怎么使对话框里的之保持当前的颜色?比方说,初始化为green,我用对话框变了,变为blue,我想下次显示出blue
怎么办?
...全文
90 14 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
qhq800 2002-05-18
  • 打赏
  • 举报
回复
注册表
或自制一个文件
zdhe 2002-05-18
  • 打赏
  • 举报
回复
as your like. event dlg public parameter is also OK.
jimconrad 2002-05-18
  • 打赏
  • 举报
回复
除了这个显而易见的办法,其他办法我想都是会使任务变得更加繁琐。
jimconrad 2002-05-18
  • 打赏
  • 举报
回复
作为该对话框类的成员变量。因为很明显,你所说的颜色是这个对话框的一个属性。
如果该对话框关闭之后,对象没有销毁,那么存储在该对象的成员变量里就可以了。如果对象销毁,那么必须存储在引用(使用)该对话框类的调用类里面,作为调用类的成员变量。一般不作为全局变量,那样灵活性不好。
HKer_007 2002-05-18
  • 打赏
  • 举报
回复
定义全局变量
holyelle 2002-05-18
  • 打赏
  • 举报
回复
还有别的方法么?
alidiedie 2002-05-18
  • 打赏
  • 举报
回复
我明白了 ,你是不是说程序没有关闭,只是对话框暂时关闭啊。那就简单了,你用一个成员变量保存啊 。那就没有楼上说的那么复杂了
cadinfo 2002-05-17
  • 打赏
  • 举报
回复
1.ini文件
2.注册表
关闭时写入,打开时读取。
countrynew 2002-05-17
  • 打赏
  • 举报
回复
给你个例子

BOOL CMyApp::InitInstance()
{
// CMyApp is derived from CWinApp.

const char *pszKey = "MyApp";
const char *pszName = "Julian";
int iAge = 26;

// Change the registry key under which our settings are stored.

SetRegistryKey(_T(""));

// Write the information to the registry.

WriteProfileString(pszKey, "Name", pszName);
WriteProfileInt(pszKey, "Age", iAge);

// Read the information from the registry.

CString strName = GetProfileString(pszKey, "Name");
int iAge2 = GetProfileInt(pszKey, "Age", 0);

ASSERT(strName == pszName);
ASSERT(iAge2 == iAge);

return TRUE;
}

countrynew 2002-05-17
  • 打赏
  • 举报
回复
把他保存到一个.ini文件中,在initdialog里读出
skywolfY 2002-05-17
  • 打赏
  • 举报
回复
笨当法,全局变量保存。
不然就一直别关,不想要时hide,想要时改一下窗口模式再显示出来.
holyelle 2002-05-17
  • 打赏
  • 举报
回复
我说下次调用是说在一次打开对话框,不是关闭程序,应该要简单一些把
jimconrad 2002-05-17
  • 打赏
  • 举报
回复
save the selection in the disk like diskfile, read the file and load it when the program restart.
masterz 2002-05-17
  • 打赏
  • 举报
回复
save the selection in registry, load it when the program restart

16,548

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧