We have studied the nucleation of superconductivity in mesoscopic structures of different shape (triangle, square and rectangle). This was made possible by using an analytical gauge transformation for the vector potential A which gives A(n) = 0 for the normal component along the boundary line of the rectangle. As a consequence the superconductor-vacuum boundary condition reduces to the Neumann boundary condition. By solving the linearized Ginzburg-Landau equation with this boundary condition we have determined the field-temperature superconducting phase boundary and the corresponding vortex patterns. The comparison of these patterns for different structures demonstrates that the critical parameters of a superconductor can be manipulated and fine-tuned through nanostructuring. (C) 2003 Elsevier Science B.V. All rights reserved.