本文整理汇总了C#中System.Windows.Forms.Control.GetChildControlsInTabOrder方法的典型用法代码示例。如果您正苦于以下问题:C# Control.GetChildControlsInTabOrder方法的具体用法?C# Control.GetChildControlsInTabOrder怎么用?C# Control.GetChildControlsInTabOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Control
的用法示例。
在下文中一共展示了Control.GetChildControlsInTabOrder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnumControls
internal System.Windows.Forms.UnsafeNativeMethods.IEnumUnknown EnumControls(Control ctl, int dwOleContF, int dwWhich)
{
System.Windows.Forms.UnsafeNativeMethods.IEnumUnknown unknown;
this.GetComponents();
this.LockComponents();
try
{
AxHost.AxContainer container;
ArrayList l = null;
bool selected = (dwWhich & 0x40000000) != 0;
bool flag2 = (dwWhich & 0x8000000) != 0;
bool flag3 = (dwWhich & 0x10000000) != 0;
bool flag4 = (dwWhich & 0x20000000) != 0;
dwWhich &= -2013265921;
if (flag3 && flag4)
{
throw AxHost.E_INVALIDARG;
}
if (((dwWhich == 2) || (dwWhich == 3)) && (flag3 || flag4))
{
throw AxHost.E_INVALIDARG;
}
int num = 0;
int tabIndex = -1;
Control[] array = null;
switch (dwWhich)
{
case 1:
{
Control parentInternal = ctl.ParentInternal;
if (parentInternal == null)
{
goto Label_00E2;
}
array = parentInternal.GetChildControlsInTabOrder(false);
if (!flag4)
{
break;
}
tabIndex = ctl.TabIndex;
goto Label_00EA;
}
case 2:
l = new ArrayList();
this.MaybeAdd(l, ctl, selected, dwOleContF, false);
goto Label_0128;
case 3:
array = ctl.GetChildControlsInTabOrder(false);
ctl = null;
goto Label_015F;
case 4:
{
Hashtable components = this.GetComponents();
array = new Control[components.Keys.Count];
components.Keys.CopyTo(array, 0);
ctl = this.parent;
goto Label_015F;
}
default:
throw AxHost.E_INVALIDARG;
}
if (flag3)
{
num = ctl.TabIndex + 1;
}
goto Label_00EA;
Label_00E2:
array = new Control[0];
Label_00EA:
ctl = null;
goto Label_015F;
Label_0102:
container = FindContainerForControl(ctl);
if (container == null)
{
goto Label_015F;
}
this.MaybeAdd(l, container.parent, selected, dwOleContF, true);
ctl = container.parent;
Label_0128:
if (ctl != null)
{
goto Label_0102;
}
Label_015F:
if (l == null)
{
l = new ArrayList();
if ((tabIndex == -1) && (array != null))
{
tabIndex = array.Length;
}
if (ctl != null)
{
this.MaybeAdd(l, ctl, selected, dwOleContF, false);
}
for (int i = num; i < tabIndex; i++)
{
//.........这里部分代码省略.........
示例2: EnumControls
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
internal UnsafeNativeMethods.IEnumUnknown EnumControls(Control ctl, int dwOleContF, int dwWhich) {
GetComponents();
LockComponents();
try {
ArrayList l = null;
bool selected = (dwWhich & NativeMethods.ActiveX.GC_WCH_FSELECTED) != 0;
bool reverse = (dwWhich & NativeMethods.ActiveX.GC_WCH_FREVERSEDIR) != 0;
// Note that visual basic actually ignores the next/prev flags... we will not
bool onlyNext = (dwWhich & NativeMethods.ActiveX.GC_WCH_FONLYNEXT) != 0;
bool onlyPrev = (dwWhich & NativeMethods.ActiveX.GC_WCH_FONLYPREV) != 0;
dwWhich = dwWhich & ~(NativeMethods.ActiveX.GC_WCH_FSELECTED | NativeMethods.ActiveX.GC_WCH_FREVERSEDIR |
NativeMethods.ActiveX.GC_WCH_FONLYNEXT | NativeMethods.ActiveX.GC_WCH_FONLYPREV);
if (onlyNext && onlyPrev) {
Debug.Fail("onlyNext && onlyPrev are both set!");
throw E_INVALIDARG;
}
if (dwWhich == NativeMethods.ActiveX.GC_WCH_CONTAINER || dwWhich == NativeMethods.ActiveX.GC_WCH_CONTAINED) {
if (onlyNext || onlyPrev) {
Debug.Fail("GC_WCH_FONLYNEXT or FONLYPREV used with CONTANER or CONATINED");
throw E_INVALIDARG;
}
}
int first = 0;
int last = -1; // meaning all
Control[] ctls = null;
switch (dwWhich) {
default:
Debug.Fail("Bad GC_WCH");
throw E_INVALIDARG;
case NativeMethods.ActiveX.GC_WCH_CONTAINED:
ctls = ctl.GetChildControlsInTabOrder(false);
ctl = null;
break;
case NativeMethods.ActiveX.GC_WCH_SIBLING:
Control p = ctl.ParentInternal;
if (p != null) {
ctls = p.GetChildControlsInTabOrder(false);
if (onlyPrev) {
last = ctl.TabIndex;
}
else if (onlyNext) {
first = ctl.TabIndex + 1;
}
}
else {
ctls = new Control[0];
}
ctl = null;
break;
case NativeMethods.ActiveX.GC_WCH_CONTAINER:
l = new ArrayList();
MaybeAdd(l, ctl, selected, dwOleContF, false);
while (ctl != null) {
AxContainer cont = FindContainerForControl(ctl);
if (cont != null) {
MaybeAdd(l, cont.parent, selected, dwOleContF, true);
ctl = cont.parent;
}
else {
break;
}
}
break;
case NativeMethods.ActiveX.GC_WCH_ALL:
Hashtable htbl = GetComponents();
ctls = new Control[htbl.Keys.Count];
htbl.Keys.CopyTo(ctls, 0);
ctl = parent;
break;
}
if (l == null) {
l = new ArrayList();
if (last == -1 && ctls != null) last = ctls.Length;
if (ctl != null) MaybeAdd(l, ctl, selected, dwOleContF, false);
for (int i = first; i < last; i++) {
MaybeAdd(l, ctls[i], selected, dwOleContF, false);
}
}
Object[] rval = new Object[l.Count];
l.CopyTo(rval, 0);
if (reverse) {
for (int i = 0, j = rval.Length - 1; i < j; i++, j--) {
Object temp = rval[i];
rval[i] = rval[j];
rval[j] = temp;
}
}
return new EnumUnknown(rval);
}
finally {
UnlockComponents();
}
}