c# - Showing a Windows form on a secondary monitor? -
i'm trying set windows form on secondary monitor, follows:
private void button1_click(object sender, eventargs e) { matrixview n = new matrixview(); screen[] screens = screen.allscreens; setformlocation(n, screens[1]); n.show(); } private void setformlocation(form form, screen screen) { // first method rectangle bounds = screen.bounds; form.setbounds(bounds.x, bounds.y, bounds.width, bounds.height); // second method //point location = screen.bounds.location; //size size = screen.bounds.size; //form.left = location.x; //form.top = location.y; //form.width = size.width; //form.height = size.height; }
the properties of bounds seem correct, in both methods i've tried, maximizes form on primary monitor. ideas?
try setting windowstartuplocation parameter "manual" inside setformlocation method.
Comments
Post a Comment