Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

C++ - Maximize and Unmaximize

$
0
0

Hello, I'm really new to c++ and first started console applications, but anyway, im developing my c++ application, it's a borderless form with my own theme for it,

I have successfully figured out how to move it, but cannot figure out how to do an if statement for a maximize event, so here's what I do when it gives me an

error.

private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
if (this->WindowState = FormWindowState::Maximized){

this->WindowState = FormWindowState::Normal;
}
else
{
this->WindowState = FormWindowState::Maximized;
}
}

It says  error C2451: conditional expression of type 'void' is illegal

But if I do this:

private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
if (this->WindowState == FormWindowState::Maximized){

this->WindowState == FormWindowState::Normal;
}
else
{
this->WindowState == FormWindowState::Maximized;
}
}

It compiles without errors however, when I click the button, it simply does nothing, like its not working.

and it says this warning when I compile:

warning C4553: '==' : operator has no effect; did you intend '='?

But I tryed putting just one =(equal sign) and it gives the error like I before I tryed ==.

Please somebody, could you correct the code for me, and explain what I did wrong.

Your help is greatly appreciated, Diamonds :D


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>