Click here to Skip to main content
15,884,298 members
Home / Discussions / C#
   

C#

 
GeneralRe: using iTextSharp and c# for page numbers Pin
Tom Paronis2-Feb-13 8:06
Tom Paronis2-Feb-13 8:06 
QuestionHow to investigate ExecutionEngineException Pin
KASR11-Feb-13 22:21
KASR11-Feb-13 22:21 
AnswerRe: How to investigate ExecutionEngineException Pin
Richard MacCutchan1-Feb-13 22:55
mveRichard MacCutchan1-Feb-13 22:55 
QuestionMdi Child Window Z-Order Pin
Richard Andrew x641-Feb-13 12:16
professionalRichard Andrew x641-Feb-13 12:16 
AnswerRe: Mdi Child Window Z-Order Pin
Jibesh1-Feb-13 12:43
professionalJibesh1-Feb-13 12:43 
GeneralRe: Mdi Child Window Z-Order Pin
Richard Andrew x641-Feb-13 13:08
professionalRichard Andrew x641-Feb-13 13:08 
GeneralRe: Mdi Child Window Z-Order Pin
Jibesh1-Feb-13 13:10
professionalJibesh1-Feb-13 13:10 
AnswerRe: Mdi Child Window Z-Order Pin
DaveyM691-Feb-13 23:57
professionalDaveyM691-Feb-13 23:57 
Although you've managed to get the top window, I thought this was an interesting one so I've had a play around.

Windows has a function EnumChildWindows[^] which gets the windows in Z order.

Something like this in the parent will get you an IEnumerable<Form> of the children in z order.

C#
private delegate bool EnumChildProc(IntPtr hwnd, IntPtr lParam);

[DllImport("User32.dll")]
private static extern bool EnumChildWindows(IntPtr hWndParent, EnumChildProc lpEnumFunc, IntPtr lParam);

private IEnumerable<Form> GetChildrenSortedByZOrder()
{
    List<IntPtr> handles = new List<IntPtr>();
    if (IsHandleCreated)
    {
        EnumChildWindows(Handle,
            (hWnd, lparam) =>
            {
                handles.Add(hWnd);
                return true;
            }, IntPtr.Zero);
    }
    List<Form> children = new List<Form>(handles.Count);
    foreach (IntPtr handle in handles)
    {
        Form form = FromHandle(handle) as Form;
        if (form != null)
            children.Add(form);
    }
    return children;
}

Dave

Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.
Astonish us. Be exceptional. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)



AnswerRe: Mdi Child Window Z-Order Pin
Alan N2-Feb-13 6:17
Alan N2-Feb-13 6:17 
QuestionStrip special characters in row of data Pin
vanikanc1-Feb-13 5:41
vanikanc1-Feb-13 5:41 
AnswerRe: Strip special characters in row of data Pin
Eddy Vluggen1-Feb-13 6:53
professionalEddy Vluggen1-Feb-13 6:53 
AnswerRe: Strip special characters in row of data Pin
Ennis Ray Lynch, Jr.1-Feb-13 8:15
Ennis Ray Lynch, Jr.1-Feb-13 8:15 
QuestionC#,ASP.Net Pin
sujeet3211-Feb-13 0:51
sujeet3211-Feb-13 0:51 
AnswerRe: C#,ASP.Net Pin
Simon_Whale1-Feb-13 1:06
Simon_Whale1-Feb-13 1:06 
AnswerRe: C#,ASP.Net Pin
Dave Kreskowiak1-Feb-13 1:30
mveDave Kreskowiak1-Feb-13 1:30 
AnswerRe: C#,ASP.Net Pin
Abhinav S1-Feb-13 8:16
Abhinav S1-Feb-13 8:16 
Questionhow to change the background color of a selected row in datagridview Pin
NarVish31-Jan-13 21:37
NarVish31-Jan-13 21:37 
AnswerRe: how to change the background color of a selected row in datagridview Pin
OriginalGriff31-Jan-13 22:21
mveOriginalGriff31-Jan-13 22:21 
GeneralRe: how to change the background color of a selected row in datagridview Pin
NarVish31-Jan-13 22:35
NarVish31-Jan-13 22:35 
GeneralRe: how to change the background color of a selected row in datagridview Pin
OriginalGriff31-Jan-13 22:38
mveOriginalGriff31-Jan-13 22:38 
GeneralRe: how to change the background color of a selected row in datagridview Pin
Richard MacCutchan31-Jan-13 22:39
mveRichard MacCutchan31-Jan-13 22:39 
GeneralRe: how to change the background color of a selected row in datagridview Pin
OriginalGriff31-Jan-13 22:46
mveOriginalGriff31-Jan-13 22:46 
AnswerRe: how to change the background color of a selected row in datagridview Pin
Richard MacCutchan31-Jan-13 22:38
mveRichard MacCutchan31-Jan-13 22:38 
GeneralRe: how to change the background color of a selected row in datagridview Pin
NarVish31-Jan-13 22:45
NarVish31-Jan-13 22:45 
QuestionHow to write events in event log using Log4net Pin
venkatpappu31-Jan-13 21:28
venkatpappu31-Jan-13 21:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.