A Democrat in the North Carolina state House switched to the Republican Party, giving the GOP veto-proof control in both chambers of the legislature and handing Democratic Gov. Roy Cooper a setback in trying to block hardline conservative policies in his final two years in office.