Rectangle ^ClientResolution = gcnew Rectangle();

ClientResolution = Screen::GetBounds();          

float CurrentWidth = 1366 ;
float CurrentHeight = 768;

float RatioWidth = ((float)ClientResolution->Width / (float)CurrentWidth );

float RatioHeight =((float)ClientResolution->Height / (float)CurrentHeight);

	this->Scale(RatioWidth,RatioHeight);

error C2661: 'System::Windows::Forms:: Screen::GetBounds' : no overloaded function takes 0 arguments

Any help would be much appreciated.

Recommended Answers

All 9 Replies

Try changing line 3 to ClientResolution = Screen::GetBounds(this->ClientRectangle); You need to give GetBounds a rectangle or a control so it can give you back the resolution of the screen showing that object, so give it the rectangle of the form.

Thanks. The code works but it did not make sense. The application still have a screen size or resolution problem . Maybe you have another bright idea ?

The code works but it did not make sense. The application still have a screen size or resolution problem.

You're going to have to elaborate on what you mean by those two statements.

You're going to have to elaborate on what you mean by those two statements.

Dear jonsca ,
The syntax of the code was corrected by your help.Then I tested the app on a desktop which has 1024 X 768 screen res. As a result I saw that the forms are all maximized unnecessarily.i'm afraid that the syntax of the code passed but semantically failed .

What did the ClientResolution return for values?

Also, that overload of Scale has been obsolete since before .NET 2.0 (according to MSDN) so you might want to try the overload that takes a SizeF object. I don't know if the results will be any better, but there must be some reason it was deprecated.

What did the ClientResolution return for values?

ClientResolution is 1024 by 768 pixel

You're right there are some obsolote points -everwhere-, but still we can not say it is a compiler bug or not. However please let me know some more about your idea then i would try

Where is current resolution coming from, is that the size of your form's window? What do you want to happen to it (shrink if it's too big?) I don't mean to seem dense in asking you these questions, it's just I'm sure it's not a compiler bug, you've probably just got the ratios flipped over.

Good proposal jonsca, i need to get the compiler to apply...

The code below urges the form windows to stay stable on client machines which have different resolutions. This is for Daniweb users.

float ClientWidthF = 1280;   // clients upper width
float ClientHeightF = 1024;  // clients upper height

float CurrentWidthF  = System::Windows::Forms::SystemInformation::PrimaryMonitorSize.Width; // 1024 average

float CurrentHeightF = System::Windows::Forms::SystemInformation::PrimaryMonitorSize.Height; // 768 average

float OranWidthF = ((float)ClientWidthF / (float)CurrentWidthF );  

float OranHeightF =((float)ClientHeightF / (float)CurrentHeightF);  

width->Text = Convert::ToString(OranWidthF);    // optimal in this case
height->Text = Convert::ToString(OranHeightF); 

this->Scale(OranWidthF,OranHeightF); 
this->CenterToScreen();

Special thanks goes to jonsca . Thank you .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.