Click here to Skip to main content
15,166,498 members
Home / Discussions / C#
   

C#

 
GeneralRe: using iTextSharp and c# for page numbers Pin
Tom Paronis2-Feb-13 9:06
MemberTom Paronis2-Feb-13 9:06 
QuestionHow to investigate ExecutionEngineException Pin
KASR11-Feb-13 23:21
MemberKASR11-Feb-13 23:21 
AnswerRe: How to investigate ExecutionEngineException Pin
Richard MacCutchan1-Feb-13 23:55
mveRichard MacCutchan1-Feb-13 23:55 
QuestionMdi Child Window Z-Order Pin
Richard Andrew x641-Feb-13 13:16
professionalRichard Andrew x641-Feb-13 13:16 
AnswerRe: Mdi Child Window Z-Order Pin
Jibesh1-Feb-13 13:43
professionalJibesh1-Feb-13 13:43 
GeneralRe: Mdi Child Window Z-Order Pin
Richard Andrew x641-Feb-13 14:08
professionalRichard Andrew x641-Feb-13 14:08 
GeneralRe: Mdi Child Window Z-Order Pin
Jibesh1-Feb-13 14:10
professionalJibesh1-Feb-13 14:10 
AnswerRe: Mdi Child Window Z-Order Pin
DaveyM692-Feb-13 0:57
professionalDaveyM692-Feb-13 0: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 7:17
MemberAlan N2-Feb-13 7:17 
QuestionStrip special characters in row of data Pin
vanikanc1-Feb-13 6:41
Membervanikanc1-Feb-13 6:41 
AnswerRe: Strip special characters in row of data Pin
Eddy Vluggen1-Feb-13 7:53
professionalEddy Vluggen1-Feb-13 7:53 
AnswerRe: Strip special characters in row of data Pin
Ennis Ray Lynch, Jr.1-Feb-13 9:15
MemberEnnis Ray Lynch, Jr.1-Feb-13 9:15 
QuestionC#,ASP.Net Pin
sujeet3211-Feb-13 1:51
Membersujeet3211-Feb-13 1:51 
AnswerRe: C#,ASP.Net Pin
Simon_Whale1-Feb-13 2:06
professionalSimon_Whale1-Feb-13 2:06 
AnswerRe: C#,ASP.Net Pin
Dave Kreskowiak1-Feb-13 2:30
mveDave Kreskowiak1-Feb-13 2:30 
AnswerRe: C#,ASP.Net Pin
Abhinav S1-Feb-13 9:16
MemberAbhinav S1-Feb-13 9:16 
Questionhow to change the background color of a selected row in datagridview Pin
NarVish31-Jan-13 22:37
MemberNarVish31-Jan-13 22:37 
AnswerRe: how to change the background color of a selected row in datagridview Pin
OriginalGriff31-Jan-13 23:21
mveOriginalGriff31-Jan-13 23:21 
GeneralRe: how to change the background color of a selected row in datagridview Pin
NarVish31-Jan-13 23:35
MemberNarVish31-Jan-13 23:35 
GeneralRe: how to change the background color of a selected row in datagridview Pin
OriginalGriff31-Jan-13 23:38
mveOriginalGriff31-Jan-13 23:38 
GeneralRe: how to change the background color of a selected row in datagridview Pin
Richard MacCutchan31-Jan-13 23:39
mveRichard MacCutchan31-Jan-13 23:39 
GeneralRe: how to change the background color of a selected row in datagridview Pin
OriginalGriff31-Jan-13 23:46
mveOriginalGriff31-Jan-13 23:46 
AnswerRe: how to change the background color of a selected row in datagridview Pin
Richard MacCutchan31-Jan-13 23:38
mveRichard MacCutchan31-Jan-13 23:38 
GeneralRe: how to change the background color of a selected row in datagridview Pin
NarVish31-Jan-13 23:45
MemberNarVish31-Jan-13 23:45 
QuestionHow to write events in event log using Log4net Pin
venkatpappu31-Jan-13 22:28
Membervenkatpappu31-Jan-13 22: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.