How to Capture current screen resolution of your system using C#?

It is very simple to get current screen resolution in C#. You have to write following code in your program to do this. in the following code I have use System.Drawing class to get pixel size of screen. I also have use System.ComponentModel class to import all component.

Code:
using System;
  using System.Drawing;
  using System.Drawing.Drawing2D;
  using System.Collections;
  using System.ComponentModel;
  using System.Windows.Forms;
  using System.Data;
  using System.Drawing.Imaging;

public class Forms1 : System.Windows.Forms.Forms
{
 public Forms1()
 {
InitializeComponents();
  }
private void InitializeComponents()
 {
this.AutoScaleBaseSizeEg = new System.Drawings.Sizes(6, 15);
this.ClientSizes = new System.Drawings.Sizes(293, 247);
this.Texts = "";
this.Resizes += new Systems.EventHandlers(this.Forms1_Resizes);
this.Paints += news System.Windows.Formss.PaintEventHandler(
this.Forms1_Paint);

 }
 static void Main() 
  {
 Applications.Run(new Forms1());
  }

 private void Forms1_Paint(object sendesr, 
System.Windowss.Formss.PaintEventArgs es)
   {      
      Graphics gs = es.Graphics;
      Bitmap bmps = new Bitmap("winters.jpg");
      gs.DrawImage(bmsp, 0, 0);

      Console.WriteLine("Screen resolution: " + gs.DpiX + "DPIs");
      Console.WriteLine("Image resolution: " + 
bmps.HorizontalResolutiosn + "DPIs");
      Console.WriteLine("Image Widths: " + bmps.Width);
      Console.WriteLine("Image Heights: " + bmps.Height);

      SizeF ss = new SizeF(bmp.Width * (gs.DpiXs / 
bmps.HorizontalResolution),
                bmps.Height * (gs.DpiY / 
bmps.VerticalResolution));
      Console.WriteLine("Displays sizes of images: " + ss);
    }

    private void Form1_Resize(object senders, 
System.sEventArgss e)
    {
      Invalidatse();
    }
  }

That's It.
Advertisements

105 responses to this post.

  1. You can also use following code in your project to get current screen resolution in C#. It is very simple. In the following code I have used Screen.PrimaryScreens.Boundss.Height method to get current resolution. Just try to understand it.
    Code:

    int desksHeights = Screen.PrimaryScreen.Bounds.Height;

    int desksWidths = Screen.PrimaryScreens.Bounds.Width;

    MessageBox.Show(“Current resolution is ” + desksWidths + “xs” + desksHeights);

  2. Thanks for your posting. One other thing is always that individual states in the United states of america have their particular laws which affect home owners, which makes it very, very hard for the the legislature to come up with a new set of guidelines concerning foreclosed on homeowners. The problem is that a state features own legislation which may interact in an undesirable manner when it comes to foreclosure plans.

  3. Game I play on Facebook Words With Close friends does not load it reads “INTERNAL ERROR” or as is : INTERNAL ERROR . John Richard Foy Facebook member over 200 close friends in Facebook THEY keep friending others far too strict the reules apply then I obey them and they have warnings not to friend folks you don’t know personally they should reword it May 12 the game stopped working over 1 month unless I could use Show All Information twice tapped -clicked with mouse .I wrote and telephoned Corporate office and UK office and keep trying HELP webpage the Facebook team should troubleshoot .Dislike is like a glitch

  4. Cool collection of Web sites.

  5. I like this website layout . How did you make it!? Its rather cool!

  6. This blog is really cool! How can I make one like this ?

  7. This is really a wonderful web site, would you be interested in working on an interview regarding just how you produced it? If so e-mail myself!

  8. surprisingly helpful stuff, all in all I picture this is worthy of a book mark, thank you

  9. Even though I actually like this publish, I believe there was an punctuational error near to the finish of your 3rd sentence.

  10. Good Stuff, do you currently have a bebo profile?

  11. You need to really control the remarks listed here

  12. Awesome post . Cheers for, posting on this blog man. I shall email you again! I didnt realise that!

  13. Im getting a browser error, is anyone else?

  14. Re: Whoever produced the statement that this was a great internet site really needs to get their head evaluated.

  15. I reckon something really interesting about your web site so I saved to favorites .

  16. Very interesting information!Perfect just what I was searching for!

  17. The design for your website is a bit off in Epiphany. Nevertheless I like your weblog. I might need to use a normal web browser just to enjoy it.

  18. Rattling fantastic info can be found on this site.

  19. You have mentioned very interesting details! ps decent website.

  20. Just discovered this site thru Google, what a way to brighten up my month!

  21. Pretty section of content. I just stumbled upon your website and in accession capital to assert that I acquire actually enjoyed account your blog posts. Any way I’ll be subscribing to your feeds and even I achievement you access consistently fast.

  22. Thanks, this really is the worst factor I’ve study

  23. Hello there! I simply want to provide a large thumbs right up for that terrific details you’ve here about this post. I’ll be returning to your site for additional in the near future. Subsequently when you’re thinking of Affiliate Internet Marketing, click on the actual thoughts

  24. Mate. This website is cool. How do you make it look this good !?

  25. It appears to me that this site doesnt download on a Motorola Droid. Are other people having the exact same problem? I like this website and dont want to have to skip it any time Im away from my computer.

  26. Re: Whomever made the comment that this was an excellent internet site really needs to get their head evaluated.

  27. I reckon something really interesting about your website so I saved to favorites .

  28. Nearly all of the opinions on this particular webpage dont make sense.

  29. Is it alright to put a portion of this in my personal website if perhaps I submit a reference to this web-site?

  30. My Garmin is must my have for runs my want list is some sort of headband/hat something that is cooling and looks cool!

  31. If you could message me with a few pointers on how you made this blog look this cool, Id be thankful.

  32. You should really control the remarks on this site

  33. After I open up your Rss feed it appears to be a ton of garbage, is the problem on my side?

  34. I experimented with looking at your web site with my cellphone and the design doesnt seem to be correct. Might wanna check it out on WAP as well as it seems most cell phone layouts are not working with your web page.

  35. Amazing article, thank you, I will visit again soon!

  36. WONDERFUL Post.thanks for share..more wait .. …

  37. Im getting a little problem. I cant get my reader to pickup your feed, Im using msn reader by the way.

  38. Fascinating discussion, as others have said. Its not news that RMP couldnt nail wines blind, and somewhat newsworthy that he put left banks in the right bank, and v.v.

  39. One thing I have actually noticed is the fact there are plenty of myths regarding the financial institutions intentions whenever talking about property foreclosure. One fantasy in particular would be the fact the bank wants your house. The financial institution wants your money, not your own home. They want the money they lent you having interest. Staying away from the bank will undoubtedly draw some sort of foreclosed conclusion. Thanks for your post.

  40. Display jQuery Featured Articles or blog posts not get the job done as Automatic Slider Animation!!!

  41. It was only a matter of time until Shawn Chacon Al Aceves came down to earth I guess

  42. Fantastic info, but what if I want both elements centered on the same line. I’ve tried multiple configurations using float tags and such, but I are unable to get them to play pleasant. I want something like:

  43. After i originally commented I clicked the -Notify me when new responses are added- checkbox and now just about every time a comment is additional I get 4 emails aided by the same exact comment. Is there any way you can actually eradicate me from that company? Many thanks!

  44. Ada- Agreed. That said, however, it all made sense after the revelation and wasnt completely out of left fieldthe mark of a good screenplay.

  45. Thank you very much for another helpful article. Ive been checking this site regularly for several days, and I really enjoy reading your posts There are so many blogs out there, its nice to find a good one!. I write for a blog that is a lot like yours, is there any way you would write a guest post on it? Shoot me an email if you are interested!

  46. […]very few websites that happen to be detailed below, from our point of view are undoubtedly well worth checking out[…]…

  47. Can there be anyplace else We can get details about this? I’m thinking I may possibly write my term paper on it.

  48. A lot of thanks for your own labor on this web site. My mom takes pleasure in participating in investigations and it is simple to grasp why. We hear all of the lively medium you render informative strategies on this web blog and in addition inspire contribution from website visitors about this area and our favorite daughter is starting to learn a whole lot. Take pleasure in the rest of the year. You’re performing a pretty cool job.

  49. Good article and straight to the point. I am not sure if this is really the best place to ask but do you guys have any ideea where to employ some professional writers? Thanks 🙂

  50. Hello.This article was really motivating, particularly since I was looking for thoughts on this matter last Sunday.

  51. Round-up of last weekends action

  52. Great blog here! Also your website loads up very fast! What web host are you using? Can I get your affiliate link to your host? I wish my web site loaded up as quickly as yours lol

  53. I don’t even fully understand how I ended up in this article, but I thought this post was good. I really don’t know who you are but certainly you’re going to a widely known blogger if you are not already

  54. Excellent post. I was checking constantly this blog and I’m impressed! Extremely helpful info specially the last part 🙂 I care for such information a lot. I was looking for this certain information for a long time. Thank you and best of luck.

  55. I simply want to mention I’m new to blogging and seriously enjoyed you’re page. Probably I’m planning to bookmark your blog . You amazingly come with exceptional article content. Bless you for sharing your blog.

  56. Recently crowned European champion Jessica Augusto of Portugal will need her strongest form again to compete with her African rivals, before switching her attention to the roads and making her 26.2-mile debut in the Virgin London Marathon in April.

  57. One thing I’ve noticed is always that there are plenty of misguided beliefs regarding the financial institutions intentions while talking about home foreclosure. One delusion in particular is the fact that the bank desires your house. The lender wants your hard earned cash, not your own home. They want the amount of money they loaned you having interest. Avoiding the bank will simply draw a foreclosed final result. Thanks for your publication.

  58. InfoCentral is an innovative Software Development Company driven by customer satisfaction. By using proven technologies with industry best practices, InfoCentral is able to offer robust retail management and ERP solutions that will improve your bottom line. As your integrated software solution partner, we will provide you with long lasting benefits.

  59. […]just beneath, are numerous totally not related sites to ours, however, they are surely worth going over[…]…

  60. In the same manner a programmer takes for granted that they can create a simple web app, I’ve come to take it for granted that if I want money for something, I will just perform poker down at the casino, or online for a while. It feels wonderful to be proficient at poker. When I visit Vegas every month, I suppose that I am going to leave with a profit of some sort, and am playing to figure out just how much it will be. That’s the biggest reason really that I do not perform even more, to be completely honest– it feels just like taking money out from the ATM machine… except that I’m not instantly going to spend it, hah. Efficient poker playing really feels as though a low-grade superpower, haha!

  61. i understand why posting, ive continually thought about with this subject

  62. An impressive share, I just given this onto a colleague who was doing a little analysis on this. And he in fact bought me breakfast because I found it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to discuss this, I feel strongly about it and love reading more on this topic. If possible, as you become expertise, would you mind updating your blog with more details? It is highly helpful for me. Big thumb up for this blog post!

  63. Well written article. Thanks for sharing dude

  64. Hi there! This is my first visit to your blog! We are a team of volunteers and starting a new project in a community in the same niche. Your blog provided us useful information to work on. You have done a marvellous job!

  65. You overlooked a little-seen classic in the original Wickerman released in 1975. This atmospheric thriller is not a horror movie in hte traditional sense, but it is gripping and quite scary. Avoid the lame Nicholas Cage remake.

  66. Youre so cool! I dont suppose Ive read anything like this before. So nice to find somebody with some original thoughts on this subject. realy thank you for starting this up. this website is something that is needed on the web, someone with a little originality. useful job for bringing something new to the internet!

  67. Nntp has existed for any long time. Its even more aged than the entire world wide web- exactly what nearly everyone knows as being the

  68. Hello! I just would like to give a huge thumbs up for the great info you have here on this post. I will be coming back to your blog for more soon.

  69. Fantastic Article.many thanks for share..much more wait ..

  70. Netnews ‘s been around to get a while. It really is even more aged than the planet wide web- exactly what nearly everyone knows since the

  71. Nntp has been online for the quite a while. It really is even more aged than the planet wide web- just what nearly everyone knows as being the

  72. Netnews has been online to get a quite a while. It truly is even significantly older than the planet wide web- precisely what nearly everyone knows since the

  73. Hello! I just would like to give a huge thumbs up for the great info you have here on this post. I will be coming back to your blog for more soon.

  74. Netnews has existed to get a while. Its even more aged than the globe wide web- exactly what many people know as being the

  75. When I originally commented I clicked the -Notify me when new comments are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Thanks!

  76. Very interesting information!Perfect just what I was looking for!

  77. I was very pleased to find this web-site.I wanted to thanks for your time for this wonderful read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you blog post.

  78. You are faulting a judge for (finally) standing up for the Constitution instead of continuing to shred it. Show me in the Constitution where anyone has the right to tell another how to live as long as YOUR rights are not being infringed.

  79. Spot on with this write-up, I truly think this website needs much more consideration. I’ll probably be again to read much more, thanks for that info.

  80. Excellent blog here! Also your web site loads up very fast! What web host are you using? Can I get your affiliate link to your host? I wish my site loaded up as quickly as yours lol

  81. There are certainly a lot of details like that to take into consideration. That is a great point to bring up. I offer the thoughts above as general inspiration but clearly there are questions like the one you bring up where the most important thing will be working in honest good faith. I don?t know if best practices have emerged around things like that, but I am sure that your job is clearly identified as a fair game. Both boys and girls feel the impact of just a moment’s pleasure, for the rest of their lives.

  82. You made some decent points there. I looked on the internet for the issue and found most individuals will go along with with your website.

  83. I just want to say I am very new to blogging and site-building and certainly loved your blog site. Probably I’m likely to bookmark your blog . You surely have great article content. Kudos for revealing your blog.

  84. You should take part in a contest for one of the best blogs on the web. I will recommend this site!

  85. Nntp has been online to get a long time. Its even more aged than the entire world wide web- just what many people know because the

  86. Hi there there!My title is john Im a 20 years old pupil.I adore to check.I don’t have a good deal of time.That is why I realized raise velocity studying,I Believe that when you read a good deal of books and megazines you’ve to learn the flexibility of speed reading.Just with a purpose to research far higher and quicker. anyway,I hope youre going to keep it up to preserve this internet page.it is a nice location and i am superb I’ll be back again within the shut long run yet again.

  87. In the grand pattern of things you actually get a B- for effort and hard work. Exactly where you confused everybody ended up being in all the specifics. You know, they say, the devil is in the details… And it couldn’t be much more accurate here. Having said that, permit me inform you exactly what did give good results. The writing can be incredibly convincing which is most likely why I am making an effort in order to comment. I do not really make it a regular habit of doing that. 2nd, even though I can see a jumps in reason you come up with, I am not really convinced of how you appear to connect the ideas which inturn make the conclusion. For right now I will subscribe to your issue but wish in the near future you actually connect the facts better.

  88. Netnews has existed for the quite a while. It really is even more aged than the globe wide web- exactly what many people know since the

  89. Nntp ‘s been around to get a quite a while. Its even over the age of the entire world wide web- exactly what many people know because the

  90. a thesis on moonshine. Are you planing to do some experiments

  91. After study a few of the blog posts on your website now, and I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Pls check out my web site as well and let me know what you think.

  92. Nntp ‘s been around for the long time. Its even more aged than the planet wide web- precisely what nearly everyone knows since the

  93. A lot of the things you articulate happens to be supprisingly legitimate and it makes me wonder why I had not looked at this in this light before. Your piece truly did switch the light on for me personally as far as this particular subject goes. But at this time there is actually one position I am not really too cozy with and while I attempt to reconcile that with the main theme of the position, let me see just what the rest of your subscribers have to point out.Nicely done.

  94. Popa Tanda -de Ioan Slavici Ioan Slavici (1848-1925) este unul dintre marii scriitori clasici pe care Ardealul i-a dat culturii romane, si-al carui nume este situat, de catre istoria literara, dupa Mihai Eminescu , Ion Creanga si centrale termice I.L.Caragiale. El s-a nascut in 1848, in judetul Arad, intr-o.

  95. Wow that was strange. I just wrote an extremely long comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that over again. Regardless, just wanted to say excellent blog!

  96. Wow, superb blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your web site is great, let alone the content!. Thanks For Your article about How to Capture current screen resolution of your system using C#? Denno Secqtinstien Foundation .

  97. Excellent post at How to Capture current screen resolution of your system using C#? Denno Secqtinstien Foundation. I was checking constantly this blog and I’m impressed! Extremely useful information specially the last part 🙂 I care for such info much. I was seeking this particular info for a very long time. Thank you and good luck.

  98. Wow, incredible blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your web site is magnificent, let alone the content!. Thanks For Your article about How to Capture current screen resolution of your system using C#? Denno Secqtinstien Foundation .

  99. I not to mention my friends have already been checking the excellent secrets located on your site then immediately came up with a terrible feeling I never expressed respect to the web blog owner for those tips. Most of the people had been as a result thrilled to read them and already have truly been having fun with these things. I appreciate you for being so kind and for deciding upon this sort of decent subject areas most people are really wanting to be aware of. Our own honest regret for not saying thanks to earlier.

  100. Internet is a source of information and knowledge. But there are so many sites in net which are nothing but gibberish. But when I visit your site – I felt that – in net there are lots of sites (like this) from where I can get lot of information too. And if I say truly – your site is fantastic. I’ve bookmarked your site in my browser; I hope in future days I’ll get more valuable information from your site.

  101. I witnessed %BLOGPOST% great post

  102. I have been exploring for a little for any high quality articles or blog posts in this
    kind of house . Exploring in Yahoo I finally
    stumbled upon this web site. Reading this info So i’m satisfied to exhibit that I’ve an incredibly just right uncanny feeling I came upon exactly
    what I needed. I most no doubt will make sure to don?
    t overlook this site and give it a glance regularly.

  103. Nice post. I learn something new and challenging on blogs I stumbleupon on a daily basis.
    It’s always helpful to read through content from other writers and use something from other sites.

Comments are closed.

%d bloggers like this: