条件が一致するまでループ

pElement = pGraphicsContainer.Next();
while (pElement != null)
{
    if (pElement is IMapFrame)
    {
        IMapFrame pMapFrame = (IMapFrame)pElement;
        pMapFrame.Map = axMapControl1.Map;
        axPageLayoutControl1.Refresh();
    }

    pElement = pGraphicsContainer.Next();
}