c# - Maximize/Minimize Form With Two KeyDown Methods Not Working -
i'm attempting wpf form maximize or minimize when "enter" pressed. however,when debugging, doesn't work.
can write can minimize not maximize, not able both once 1 action performed.
if push me in right direction, appreciated.
i'm using "enter" placeholder combination of 2 keys haven't decided yet. may annoying some, know, works me @ moment.
also, i'm attempting make general overlay program can run in background , can pop when key combination pressed.
private void mainwindow_keydown(object sender, keyeventargs e) { if (this.windowstate == windowstate.minimized) { if (e.key == key.enter) { this.windowstate = windowstate.maximized; } } } private void mainwindow_keydown2(object sender, keyeventargs e) { if (this.windowstate == windowstate.maximized) { if (e.key == key.enter) { this.windowstate = windowstate.minimized; } } }
try this
private void mainwindow_keydown(object sender, keyeventargs e) { if (e.key == key.enter) { if (this.windowstate == windowstate.minimized) { this.windowstate = windowstate.maximized; } else { this.windowstate = windowstate.minimized; } } }
Comments
Post a Comment