This paper considers the problems of designing multivariable proportional-integral-derivative (PID) controllers for discrete-time systems with D-stability and/or performance constraints. First, the PID control problem is cast into a static output feedback (SOF) control problem, and linear matrix inequality (LMI) conditions are presented. Then, a cone complementarity linearisation (CCL) method is used to solve the SOF-stabilisation problem, and a coordinate transformation matrix (CTM) optimisation approach is extended to solve the optimal SOF control problem. Finally, a numerical example is provided to show the effectiveness and advantage of the CTM optimisation approach, and application to the anti-sway and positioning control of an overhead crane demonstrates the validity of the approach.