本文整理汇总了C#中System.Windows.Forms.Control.GetStyle方法的典型用法代码示例。如果您正苦于以下问题:C# Control.GetStyle方法的具体用法?C# Control.GetStyle怎么用?C# Control.GetStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Control
的用法示例。
在下文中一共展示了Control.GetStyle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindControlForward
private static Control FindControlForward(Control container, Control start) {
Control found;
found = null;
if (start == null) {
return FindFlatForward(container, start);
}
if (start.child_controls != null && start.child_controls.Count > 0 &&
(start == container || !((start is IContainerControl) && start.GetStyle(ControlStyles.ContainerControl)))) {
return FindControlForward(start, null);
}
else {
while (start != container) {
found = FindFlatForward(start.parent, start);
if (found != null) {
return found;
}
start = start.parent;
}
}
return null;
}
示例2: ValidateThisControl
private bool ValidateThisControl (Control c, ValidationConstraints constraints)
{
if (constraints == ValidationConstraints.None)
return true;
if ((constraints & ValidationConstraints.Enabled) == ValidationConstraints.Enabled && !c.Enabled)
return false;
if ((constraints & ValidationConstraints.Selectable) == ValidationConstraints.Selectable && !c.GetStyle (ControlStyles.Selectable))
return false;
if ((constraints & ValidationConstraints.TabStop) == ValidationConstraints.TabStop && !c.TabStop)
return false;
if ((constraints & ValidationConstraints.Visible) == ValidationConstraints.Visible && !c.Visible)
return false;
return true;
}
示例3: GetNextControl
// Get the next or previous control in the tab order.
public Control GetNextControl(Control ctl, bool forward)
{
if (!Contains(ctl))
{
ctl = this;
}
if (forward && ctl.children != null && ctl.numChildren > 0 && (ctl == this || !(ctl is IContainerControl) || !ctl.GetStyle(ControlStyles.ContainerControl)))
{
// Find the first control in the children.
Control found = ctl.children[0];
for (int i = 1; i < ctl.numChildren; i++)
{
if (found.tabIndex > ctl.children[i].tabIndex)
{
found = ctl.children[i];
}
}
return found;
}
// Search through the childs hierarchy for the next control, until we've search "this" control.
while (ctl != this)
{
Control found = null;
if (ctl.parent.numChildren > 0)
{
bool passedStart = false;
if (forward)
{
for (int i = 0; i < ctl.parent.numChildren; i++)
{
Control child = ctl.parent.children[i];
if (child == ctl)
{
passedStart = true;
}
else if (child.tabIndex >= ctl.tabIndex && (child.tabIndex != ctl.tabIndex || passedStart))
{
if (found == null || found.tabIndex > child.tabIndex)
{
found = ctl.parent.children[i];
}
}
}
if (found != null)
{
return found;
}
}
else // backwards
{
// Search up through the childs hierarchy for the previous control, until we've search in this control.
for (int i = ctl.parent.numChildren - 1; i >= 0 ; i--)
{
Control child = ctl.parent.children[i];
if (child == ctl)
{
passedStart = true;
}
else if (child.tabIndex <= ctl.tabIndex && (child.tabIndex != ctl.tabIndex || passedStart))
{
if (found == null || found.tabIndex < child.tabIndex)
{
found = ctl.parent.children[i];
}
}
}
if (found == null)
{
if (ctl.parent == this)
{
return null;
}
return ctl.parent;
}
else
{
ctl = found;
break;
}
}
}
ctl = ctl.parent;
}
if (!forward)
{
// Find the container because there was no control found.
#if CONFIG_COMPONENT_MODEL
while (ctl.numChildren > 0 && (ctl ==this || !(ctl is IContainer) || !ctl.GetStyle(ControlStyles.ContainerControl)))
#else
while (ctl.numChildren > 0 && (ctl ==this || !ctl.GetStyle(ControlStyles.ContainerControl)))
#endif
{
Control found = ctl.children[ctl.numChildren - 1];
for (int i = ctl.numChildren - 2; i >= 0; i--)
{
//.........这里部分代码省略.........