7. Let variables $x, y$ satisfy the constraint conditions
$$
\left\{\begin{array}{l}
2 x-y+2 \geqslant 0, \\
8 x-y-4 \leqslant 0, \\
x \geqslant 0, y \geqslant 0,
\end{array}\right.
$$

The objective function $z=a b x+y(a, b$ both greater than 0$)$ has a maximum value of 8. Then the minimum value of $a+b$ is ( ).
(A) 3
(B) 4
(C) 5
(D) 6
7. B.

By plotting, we know that at the point $(1,4)$
$$
z_{\max }=a b+4=8 \Rightarrow a b=4 \text {. }
$$

Also, since $a>0, b>0$, we have $a+b \geqslant 2 \sqrt{a b}=4$.