C# 自訂義搜尋控件


使用這個方法就可以更方便的搜尋需要的Controls

// 遞迴尋找控制項的方法
private Control FindControlByName(Control parentControl, string name)
{
    if (parentControl.Name == name)
    {
        return parentControl;
    }

    foreach (Control childControl in parentControl.Controls)
    {
        Control targetControl = FindControlByName(childControl, name);
        if (targetControl != null)
        {
            return targetControl;
        }
    }

    return null;
}
#C# #Winform







你可能感興趣的文章

淺談產品開發與工作流程

淺談產品開發與工作流程

網域申請及網站部署遠端伺服器

網域申請及網站部署遠端伺服器

[BE101]  PHP 與 MySQL  (語法)

[BE101] PHP 與 MySQL (語法)






留言討論