c# - How to make a windows form fill the entire screen -


i've got function creates bitmap , pass bitmap function creates new windows form, new picturebox , set image property of picturebox bitmap.

add picturebox new windowsform .show(); new form.

i'm attempting fill entire screen new form , fill new form new picturebox , if there overflow have scroll bars; however, cannot new form fill window nor can scroll bars show.

any suggestions?

void showwindow(bitmap elevation) {      form f = new form();     f.text = "cad drawing";     f.dock = dockstyle.fill;      picturebox pb = new picturebox();     pb.image = elevation;     pb.dock = dockstyle.fill;      f.controls.add(pb);     f.bringtofront();     f.show(); } 

the current result

    void showwindow(bitmap elevation)     {          form f = new form();         f.text = "cad drawing";         f.dock = dockstyle.fill;         f.windowstate = formwindowstate.maximized;          panel p = new panel();         p.dock = dockstyle.fill;         p.autoscroll = true;         p.borderstyle = borderstyle.fixedsingle;          picturebox pb = new picturebox();         pb.image = elevation;         pb.width = elevation.width;         pb.height = elevation.height;         //pb.focus();          p.controls.add(pb);          f.controls.add(p);         f.bringtofront();         f.show();     } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -