CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 3 123 LastLast
Results 1 to 15 of 31
  1. #1
    Join Date
    Dec 2009
    Location
    Kathmandu,Nepal
    Posts
    168

    Red face Screen Resolution!!

    Hello....Please Evaluate and help me on this problem.....Here I have a simple form with background Picture and 4 buttonsThe Problem is that I have created this Sample Apps in the screen resolution of 1024 X 768.....so when I change my screen resolution to 800 X 600 Other 3 buttons gets hidden...and If I change my screen Resolution to more than 1024 X 768 say 1280 X 1024 then the Space between buttons and Screen Extrimities on the Right and down Increases......Please Hemp me on this Apps so that It works fine on most of the desktop screen resolutions.....
    Last edited by rocky_upadhaya; February 11th, 2010 at 06:26 AM.

  2. #2
    Join Date
    Dec 2009
    Location
    Kathmandu,Nepal
    Posts
    168

    Re: Screen Resolution!!

    Since This Problem seems impossible or very hard for my level of knowledge till now and no one is willing to help me on this problem I am very frustated......So Please Suggest me code to change the screen resolution....I have found some code in the internet but was unable to use them cause I didnt knew exact namespace....or something else.......Please help me out here
    Code:
                 string Htscreen = SystemInformation.PrimaryMonitorSize .Height .ToString();
                 string WtScreen=SystemInformation.PrimaryMonitorSize.Width .ToString();
    I want to keep HtScreen and WtScreen values to change the screen resolution to original state if I exit from the application Bu please Help me on the code for changing screen resolution....
    Last edited by rocky_upadhaya; February 1st, 2010 at 10:00 AM.

  3. #3
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: Screen Resolution!!

    Quote Originally Posted by rocky_upadhaya
    Since This Problem seems impossible or very hard for my level of knowledge till now and no one is willing to help me on this problem I am very frustated.
    I don't think it is fair to say that no one is willing to help you. I've noticed that you have another post on the subject and you had a lot of replies there. If the problem is not solved yet you have to be more patient. It is probably a difficult think to do. Otherwise Google would have solved it for you. Also try other forums. Secondly frustration will not help. The help you get is voluntary, it is not owed. If you get any be grateful. Thirdly why do you want to change the resolution if you don't mind me asking?
    Last edited by nelo; February 1st, 2010 at 10:09 AM. Reason: Correction. Missing word.

  4. #4
    Join Date
    Dec 2009
    Location
    Kathmandu,Nepal
    Posts
    168

    Re: Screen Resolution!!

    Sorry for using "not Willing" term...that was all my bad....I want to change the screen resolution because few weeks back I Took my csharp application to my friend's computer...but his default screen resolution was in 800 X 600 so It didnt looked nice plus many of my buttons got hidden..........

  5. #5
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: Screen Resolution!!

    So you want your application to change the resolution on the machine it is running on? I'm sure that is possible but a better way to address the real problem is to re-design the screen. Fight the battles worth fighting for...

  6. #6
    Join Date
    Dec 2009
    Location
    Kathmandu,Nepal
    Posts
    168

    Re: Screen Resolution!!

    No I Just Wanted to mimic it from simple games.....like some game like counter strike etc.... Works fine in almost all resolution because they change the system screen resolution to their resolution during gameplay only.....Since I my current knowledge was not good enough for my application to run fine on atleast 3-4 default monitor resolution...I have presented this question infront of you guys if someone has any idea??

  7. #7
    Join Date
    Apr 2007
    Location
    Florida
    Posts
    403

    Re: Screen Resolution!!

    I've never tried changing the resolution before, but I just did a google search for "C# change resolution" and there are tons of examples.

  8. #8
    Join Date
    Dec 2009
    Location
    Kathmandu,Nepal
    Posts
    168

    Re: Screen Resolution!!

    Common Let's not give such a answer.....Everyone knows how to use Bing or Google...Tried few of them with no success...The Most promising was..
    Code:
    Resolution.CResolution ChangeRes = new Resolution.CResolution(FixHeight, FixWidth);
    I dont only put question and relax....Yes I do keep question in Here more than others do..but I also do my homework(research) parallely too.....I just put because if someone already knows the solution to the question it would be easier for me and other guys who may have the similar problem......sometimes I can be little unreasonable too....so sorry 4 that in advance.....but in the code above it says "The type or namespace name 'Resolution' could not be found (are you missing a using directive or an assembly reference?)......does anyone has any idea on what using statement is required??

  9. #9
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: Screen Resolution!!

    Quote Originally Posted by rocky_upadhaya
    sometimes I can be little unreasonable too....so sorry 4 that in advance.....but in the code above it says "The type or namespace name 'Resolution' could not be found (are you missing a using directive or an assembly reference?)......does anyone has any idea on what using statement is required??
    You probably need to download the source for that code snippet you got from your research. From my quick research the class 'CResolution' is in the 'Resolution' namespace. They are not a part of the .NET Framework. Download the source and integrate it into your application (You can do that here). I still think you are putting a lot of effort for very little benefit. Why not re-design the UI to fit the smallest possible resolution you intend to support?

  10. #10
    Join Date
    Apr 2007
    Location
    Florida
    Posts
    403

    Re: Screen Resolution!!

    You can right click on the keyword (Resolution) and go to Resolve and choose the include namespace option.

    Edit: If the namespace exists in your project references that is...
    Last edited by mariocatch; February 1st, 2010 at 01:10 PM. Reason: Edit

  11. #11
    Join Date
    Dec 2009
    Location
    Kathmandu,Nepal
    Posts
    168

    Re: Screen Resolution!!

    nelo....has a point but.....I will re adjust my UI to make it make it run in any screen resolution.....but It would be helpful for future too...any ways thanks guys.......I have now downloaded .cs file which has Resolution namespace and a class called CResolution...I have never used csharp file templete written by other and use it in my code may I Expect a help from you guys??
    Last edited by rocky_upadhaya; February 1st, 2010 at 01:32 PM.

  12. #12
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Screen Resolution!!

    Rocky, I didn't reply to this thread because I thought you had solved the issue of resizing your app in reponse to a resize notification (sent to your app when the user changes the resolution). I figured if you were able to do that, then it would be a simple matter for you to resize your app on startup (if you were able to do it dynamically in the other post).

    What I didn't understand is that you wanted to force a resolution change.

    Now that I understand what you are looking for, the best is I can say is don't do that. The vast majority of users don't want some application screwing with their user settings - changing resolution is a big no, no. Plus, you may not be able to pull it off anyway because the user may not have permissions to change the resolution. What are you going to do then? Fail? The professional way to deal with this is to make your app work under any resolution. Or at least reasonable resolutions - I wouldn't bother supporting 640 x 480 or 800 x 600.

    As far as getting google answers. Understand that your google may not be as powerful as other's google (like 2nd or 3rd degree black belt google). So don't be upset if someone gives you google search terms because the terms they give you may be the actual terms you need to find the answer (even though you've already search with weak google). Remember our goal as the Code Guru collective is to be able to say at one point, "the google is strong in that one".

    So young jedi, be sure that you are patient and listen to the responses you get here and actually put the advice into practice.

  13. #13
    Join Date
    Dec 2009
    Location
    Kathmandu,Nepal
    Posts
    168

    Re: Screen Resolution!!

    Oh! I got the point....But do you have idea behind games like Mario,sonic and Counterstrike run on almost all screen resolution?? I just want to understand the idea now and if possible implement it.....otherwise I am now totally satisfied with answers of Arjay, nelo and MarioCatch....

  14. #14
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Screen Resolution!!

    Well, I think you are talking about two different things. The actual screen resolution is set by the user, your game will adapt to that and scale appropriately to fit either in windowed or full screen mode. The ability to display in full screen is independent from the current resolution setting.

  15. #15
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Screen Resolution!!

    Quote Originally Posted by rocky_upadhaya View Post
    Oh! I got the point....But do you have idea behind games like Mario,sonic and Counterstrike run on almost all screen resolution?? I just want to understand the idea now and if possible implement it.....otherwise I am now totally satisfied with answers of Arjay, nelo and MarioCatch....
    Yes. They detect the current screen resolution and adjust their sizing as appropriate. Build yourself a simple form app that is resizable (when the user drags the lower, right corner of the form). Next, makes the controls in the form resizable. After that detect screen changes (like you did in the other app). Finally make the form resize itself on startup. Once you all that, then that's all you need to know with regard to resolution. If you need to know how to set the resolution, by the time you have worked through the previous items, you'll know how to do it.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured