简介
MemoryBox是一个简单的使用具有记忆功能的MessageBox式的对话。它"是"以Allquot;及"不来Allquot;像许多文件对话框的选项,并且可以在许多操作使用。
{S0}实施
首先,你必须添加MemoryBox到您的项目。这是通过在项目浏览器中使用"添加现有项目的选项。你需要的是包含在源文件MemoryBox演示所谓quot; MemoryBox.csquot;
MemoryBox应声明和构造外循环中,您要使用的MemoryBox的,在下面的例子所示:// Memory box is declared before the loop
MemoryBox memoryBox = new MemoryBox();
// Loop 5 times, counting the yeses and noes.
for (int i = 0; i < 5; i++)
{
MemoryBoxResult result = memoryBox.ShowMemoryDialog("This demo was " +
"written by Chris Johanson of Twin Rose " +
"Software.\r\nYou will be asked 5 times a yes or no, " +
"and given a running total.\r\n", "Demo Memory Box");
if (result == MemoryBoxResult.Cancel)
break;
if (result == MemoryBoxResult.Yes || result == MemoryBoxResult.YesToAll)
{
yesCount++;
}
if (result == MemoryBoxResult.No || result == MemoryBoxResult.NoToAll)
{
noCount++;
}
label1.Text = "Yes: " + yesCount + " No: " + noCount;
}
这应该这样做!如果您有任何意见,问题或建议,我很想听到他们的声音!
|克里斯约翰森