The spin-dependent electron transport in a two-dimensional electron gas (2DEG) modulated by a stripe of magnetized ferromagnetic metal under an applied voltage was investigated theoretically. It is revealed that highly spin-polarized current can be achieved in this kind of nanosystems. It is also shown that the spin polarity of the electron transport can be switched by adjusting the applied voltage to the stripe in the device. These interesting properties may provide an alternative scheme to spin polarize electrons into semiconductors, and this device may be used as a voltage-tunable spin filter.