2. If the vertex of the parabola $y=x^{2}-4 x+m$ is on the $x$-axis, then the value of $m$ is ( ).
(A) 0
(B) 1
(C) 2
(D) 4
2. D.

From the condition, the discriminant of $x^{2}-4 x+m=0$ is $\Delta=4^{2}-4 m=0 \Rightarrow m=4$.