本文整理汇总了C#中Dialog.GenerateOutput方法的典型用法代码示例。如果您正苦于以下问题:C# Dialog.GenerateOutput方法的具体用法?C# Dialog.GenerateOutput怎么用?C# Dialog.GenerateOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dialog
的用法示例。
在下文中一共展示了Dialog.GenerateOutput方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadDialogFromRCFile
/// <summary>
/// Reads a dialog from a .rc file.
/// </summary>
/// <param name="reader">StreamReader to read dialog from.</param>
/// <param name="writer">XmlWriter to write output to.</param>
/// <param name="dialog">Dialog being read.</param>
/// <returns>Error or ErrorCode.None.</returns>
private static ErrorCode ReadDialogFromRCFile(StreamReader reader, XmlWriter writer, Dialog dialog)
{
string curLine;
string curToken;
string dlgCaption;
// Skip the next line (STYLE)
if (null == (curLine = ReadLineFromFile(reader)))
{
return ErrorCode.ReadLine;
}
/*
if (null == (curLine = ReadLineFromFile(reader)))
{
return ErrorCode.ReadLine;
}
*/
// Look for the "CAPTION" line
if (null == (curLine = ReadLineFromFile(reader)))
{
return ErrorCode.ReadLine;
}
GetTokenFromLine(curLine, out curToken, 1);
if (0 == String.Compare(curToken, "CAPTION"))
{
// Found the dialog's caption
// Get the dialog caption
GetTokenFromLine(curLine, out dlgCaption, 2);
int firstQuote = dlgCaption.IndexOf('\"');
int lastQuote = dlgCaption.LastIndexOf('\"');
if (-1 != firstQuote && -1 != lastQuote)
{
dialog.Title = dlgCaption.Substring(firstQuote, (lastQuote - firstQuote) - 1);
}
}
// Write the entire dialog if it was properly formatted in the RC file
if (null != dialog)
{
dialog.GenerateOutput(writer);
}
// Skip the next line (FONT)
if (null == (curLine = ReadLineFromFile(reader)))
{
return ErrorCode.ReadLine;
}
// Look for the "BEGIN" line
if (null == (curLine = ReadLineFromFile(reader)))
{
return ErrorCode.ReadLine;
}
GetTokenFromLine(curLine, out curToken, 1);
if (0 == String.Compare(curToken, "BEGIN"))
{
bool foundDialogEnd = false;
while (!foundDialogEnd)
{
// Look for the "END" line
if (null == (curLine = ReadLineFromFile(reader)))
{
return ErrorCode.ReadLine;
}
GetTokenFromLine(curLine, out curToken, 1);
if (0 == String.Compare(curToken, "END"))
{
foundDialogEnd = true;
}
else
{
Control newControl = new Control(null, ControlType.Initialize, 0, 0, 0, 0);
// Determine the type of control we have
GetTokenFromLine(curLine, out curToken, 1);
if (0 == String.Compare(curToken, "DEFPUSHBUTTON"))
{
SetupPushButton(newControl, curLine, true);
}
else if (0 == String.Compare(curToken, "PUSHBUTTON"))
{
SetupPushButton(newControl, curLine, false);
}
else if (0 == String.Compare(curToken, "EDITTEXT"))
{
SetupEditBox(newControl, curLine);
//.........这里部分代码省略.........