本文整理汇总了C#中TControlDef.GetAction方法的典型用法代码示例。如果您正苦于以下问题:C# TControlDef.GetAction方法的具体用法?C# TControlDef.GetAction怎么用?C# TControlDef.GetAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TControlDef
的用法示例。
在下文中一共展示了TControlDef.GetAction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetControlProperties
//.........这里部分代码省略.........
}
else if (ctrl.GetAttribute("Stretch").ToLower() == "none")
{
// do nothing (here just to avoid throwing the following Exception)
Console.WriteLine(
"HINT: Attribute 'Stretch' with value 'none' does not affect the layout since this is the default. Control: '" +
ctrl.controlName + "'.");
}
else
{
throw new Exception("Invalid value for Attribute 'Stretch' of Control '" + ctrl.controlName + "': '" +
ctrl.GetAttribute("Stretch") + "'. Supported values are: horizontally, vertically, fully, none.");
}
}
#endregion
if (ctrl.HasAttribute("Dock"))
{
writer.SetControlProperty(ctrl, "Dock");
}
if (ctrl.HasAttribute("Visible")
&& (ctrl.GetAttribute("Visible").ToLower() == "false"))
{
writer.SetControlProperty(ctrl, "Visible", "false");
}
if (ctrl.HasAttribute("Enabled")
&& (ctrl.GetAttribute("Enabled").ToLower() == "false"))
{
writer.SetControlProperty(ctrl, "Enabled", "false");
}
else if ((ctrl.GetAction() != null) && (TYml2Xml.GetAttribute(ctrl.GetAction().actionNode, "InitiallyEnabled").ToLower() == "false"))
{
string ActionEnabling = ctrl.controlName + ".Enabled = false;" + Environment.NewLine;
writer.Template.AddToCodelet("INITACTIONSTATE", ActionEnabling);
}
if (ctrl.HasAttribute("TabStop")
&& (ctrl.GetAttribute("TabStop").ToLower() == "false"))
{
writer.SetControlProperty(ctrl, "TabStop", "false");
}
if (ctrl.HasAttribute("TabIndex"))
{
writer.SetControlProperty(ctrl, "TabIndex", ctrl.GetAttribute("TabIndex"));
}
if (ctrl.HasAttribute("BorderStyle"))
{
writer.SetControlProperty(ctrl, "BorderStyle", "System.Windows.Forms.BorderStyle." + ctrl.GetAttribute("BorderStyle"));
if (ctrl.GetAttribute("BorderStyle").ToLower() == "none")
{
writer.SetControlProperty(ctrl, "Margin", "new System.Windows.Forms.Padding(0, 5, 0, 0)");
}
}
if (ctrl.HasAttribute("Padding"))
{
writer.SetControlProperty(ctrl, "Padding", "new System.Windows.Forms.Padding(" + ctrl.GetAttribute("Padding") + ")");
}
if (ctrl.HasAttribute("Margin"))
示例2: SetControlProperties
/// <summary>write the code for the designer file where the properties of the control are written</summary>
public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
{
if (IsMniFilterFindClickAndIgnore(writer, ctrl, false))
{
return writer.FTemplate;
}
base.SetControlProperties(writer, ctrl);
// deactivate menu items that have no action assigned yet.
if ((ctrl.GetAction() == null) && !ctrl.HasAttribute("ActionClick") && !ctrl.HasAttribute("ActionOpenScreen")
&& (ctrl.NumberChildren == 0) && !(this is MenuItemSeparatorGenerator))
{
string ActionEnabling = ctrl.controlName + ".Enabled = false;" + Environment.NewLine;
writer.Template.AddToCodelet("ACTIONENABLINGDISABLEMISSINGFUNCS", ActionEnabling);
}
writer.SetControlProperty(ctrl, "Text", "\"" + ctrl.Label + "\"");
if (ctrl.HasAttribute("ShortcutKeys"))
{
writer.SetControlProperty(ctrl, "ShortcutKeys", ctrl.GetAttribute("ShortcutKeys"));
}
// todo: this.toolStripMenuItem1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
return writer.FTemplate;
}
示例3: IsMniFilterFindClickAndIgnore
private bool IsMniFilterFindClickAndIgnore(TFormWriter writer, TControlDef ctrl, bool LogMessage)
{
if (writer.FCodeStorage.ManualFileExistsAndContains("void MniFilterFind_Click("))
{
// if there is manual code then we will use it
return false;
}
// Screens that have no Filter/Find panel do not qualify for the Filter/Find menus
if (!writer.FCodeStorage.FControlList.ContainsKey("pnlFilterAndFind"))
{
if ((ctrl.GetAction() != null) && (ctrl.GetAction().actionClick == "MniFilterFind_Click"))
{
if (LogMessage)
{
TLogging.Log("Ignoring MniFilterFind_Click menus on this screen");
}
return true;
}
}
return false;
}
示例4: SetControlProperties
/// <summary>write the code for the designer file where the properties of the control are written</summary>
public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
{
bool OverrideImageAlign = false;
bool OverrideTextAlign = false;
bool NoLabel = false;
TLogging.LogAtLevel(1, "ButtonGenerator.SetControlProperties for Control " + ctrl.controlName);
if (!ctrl.HasAttribute("Width"))
{
ctrl.SetAttribute("Width", (PanelLayoutGenerator.MeasureTextWidth(ctrl.Label) + 15).ToString());
}
if (ctrl.HasAttribute("NoLabel") && (ctrl.GetAttribute("NoLabel").ToLower() == "true"))
{
writer.SetControlProperty(ctrl, "Text", "\"\"");
NoLabel = true;
}
else
{
writer.SetControlProperty(ctrl, "Size", "new System.Drawing.Size(" +
ctrl.GetAttribute("Width").ToString() + ", " + ctrl.GetAttribute("Height").ToString() + ")");
writer.SetControlProperty(ctrl, "Text", "\"" + ctrl.Label + "\"");
}
if (ctrl.IsOnHorizontalGridButtonPanel)
{
TLogging.LogAtLevel(1, "Setting Height for Control '" + ctrl.controlName + "' to 23 as it is on a horizontal Grid Button Panel");
FDefaultHeight = 23;
if (!ctrl.HasAttribute("ImageAlign"))
{
if (NoLabel)
{
//TLogging.LogAtLevel(1, "Setting ImageAlign Attribute of Control '" + ctrl.controlName + "' to System.Drawing.ContentAlignment.BottomCenter as it is on a horizontal Grid Button Panel (no Text)");
writer.SetControlProperty(ctrl, "ImageAlign", "System.Drawing.ContentAlignment.BottomCenter");
}
else
{
//TLogging.LogAtLevel(1, "Setting ImageAlign Attribute of Control '" + ctrl.controlName + "' to System.Drawing.ContentAlignment.BottomLeft as it is on a horizontal Grid Button Panel");
writer.SetControlProperty(ctrl, "ImageAlign", "System.Drawing.ContentAlignment.BottomLeft");
// Note: In this case want the text centered on the Button, which the TextAlign Property will achieve.
// However, its default value is System.Drawing.ContentAlignment.MiddleCenter which means we don't need to explicitly write this out into the Designer file...
//TLogging.LogAtLevel(1, "Setting TextAlign Attribute of Control '" + ctrl.controlName + "' to System.Drawing.ContentAlignment.MiddleCenter as it is on a horizontal Grid Button Panel");
// writer.SetControlProperty(ctrl, "TextAlign", "System.Drawing.ContentAlignment.MiddleCenter");
}
OverrideImageAlign = true;
OverrideTextAlign = true;
}
}
else
{
if (!ctrl.HasAttribute("Height"))
{
ctrl.SetAttribute("Height", FDefaultHeight.ToString());
}
}
base.SetControlProperties(writer, ctrl);
if (ctrl.GetAttribute("AcceptButton").ToLower() == "true")
{
writer.Template.AddToCodelet("INITUSERCONTROLS", "this.AcceptButton = " + ctrl.controlName + ";" + Environment.NewLine);
}
if (ctrl.GetAction() != null)
{
string img = ctrl.GetAction().actionImage;
if (img.Length > 0)
{
ctrl.SetAttribute("Width", (Convert.ToInt32(ctrl.GetAttribute("Width")) +
Convert.ToInt32(ctrl.GetAttribute("IconWidth", "15"))).ToString());
writer.SetControlProperty(ctrl, "Size", "new System.Drawing.Size(" +
ctrl.GetAttribute("Width").ToString() + ", " + ctrl.GetAttribute("Height").ToString() + ")");
if (writer.GetControlProperty(ctrl.controlName, "Text") == "\"\"")
{
if ((!ctrl.HasAttribute("ImageAlign"))
&& !OverrideImageAlign)
{
// Note: In this case we want the Image centered on the Button, which the ImageAlign Property will achieve.
// However, its default value is System.Drawing.ContentAlignment.MiddleCenter which means we don't need to explicitly write this out into the Designer file...
//Console.WriteLine("Setting ImageAlign Attribute of Control '" + ctrl.controlName + "' to System.Drawing.ContentAlignment.MiddleCenter as it is NOT on a horizontal Grid Button Panel (no Text)");
// writer.SetControlProperty(ctrl, "ImageAlign", "System.Drawing.ContentAlignment.MiddleCenter");
}
}
else
{
if ((!ctrl.HasAttribute("ImageAlign"))
&& !OverrideImageAlign)
{
//Console.WriteLine("Setting ImageAlign Attribute of Control '" + ctrl.controlName + "' to System.Drawing.ContentAlignment.MiddleLeft as it is NOT on a horizontal Grid Button Panel");
writer.SetControlProperty(ctrl, "ImageAlign", "System.Drawing.ContentAlignment.MiddleLeft");
}
//.........这里部分代码省略.........