Results 1 to 4 of 4

Problem with Resolution in Windows Application

This is a discussion on Problem with Resolution in Windows Application within the C++ forums, part of the Courses category; I have developed a software using C#. The software is working smoothly in high resolution i.e in 1024x768. But when ...

  1. #1
    *I am Banned*
    Join Date
    Dec 2007
    Location
    Karachi
    Posts
    423

    Problem with Resolution in Windows Application

    I have developed a software using C#. The software is working smoothly in
    high resolution i.e in 1024x768. But when I shift the screen resolution to 800x600, I am facing problems. I am not able to view most of the controls in the form. The forms are movin beyond the screen. Kindly help me out in sorting this problem...It is highly urgent....Thanks

  2. #2
    iTT Student
    Join Date
    Jun 2010
    Location
    Pakistan
    Posts
    5

    Re: Problem with Resolution in Windows Application

    nice. plzz send me c++ software. this is my email prince_aijazali@yahoo thanks

  3. #3
    /\/\oderator
    Join Date
    Aug 2010
    Location
    karachi
    Age
    31
    Posts
    354

    Re: Problem with Resolution in Windows Application

    have u used #pragma or not to tell if resolution is 1200x768 and if resolution is 600x800 execute this code

  4. #4
    *I am Banned*
    Join Date
    Apr 2010
    Location
    lahore
    Age
    44
    Posts
    293

    Re: Problem with Resolution in Windows Application

    i did this in vb6, working fine for me, you can convert this in c#.

    'Declare the following
    Private Const CDS_UPDATEREGISTRY = &H1
    'Changes resolution on the fly, without rebooting
    'Call with:
    'Call ChangeRes(800,600)
    'or Call ChangeRes(640,480) for example
    ' if resolution is not possible, a dialog is displayed
    Private Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lpDevMode As Any) As Boolean
    Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwflags As Long) As Long
    Const CCDEVICENAME = 32
    Const CCFORMNAME = 32
    Const DM_PELSWIDTH = &H80000
    Const DM_PELSHEIGHT = &H100000
    Private Type DEVMODE
    dmDeviceName As String * CCDEVICENAME
    dmSpecVersion As Integer
    dmDriverVersion As Integer
    dmSize As Integer
    dmDriverExtra As Integer
    dmFields As Long
    dmOrientation As Integer
    dmPaperSize As Integer
    dmPaperLength As Integer
    dmPaperWidth As Integer
    dmScale As Integer
    dmCopies As Integer
    dmDefaultSource As Integer
    dmPrintQuality As Integer
    dmColor As Integer
    dmDuplex As Integer
    dmYResolution As Integer
    dmTTOption As Integer
    dmCollate As Integer
    dmFormName As String * CCFORMNAME
    dmUnusedPadding As Integer
    dmBitsPerPel As Integer
    dmPelsWidth As Long
    dmPelsHeight As Long
    dmDisplayFlags As Long
    dmDisplayFrequency As Long
    End Type
    Dim DevM As DEVMODE
    Sub ChangeRes(iWidth As Single, iHeight As Single)
    Dim a As Boolean
    Dim i As Integer
    i = 0
    Do
    a = EnumDisplaySettings(0&, i, DevM)
    i = i + 1
    Loop Until (a = False)
    Dim b&
    DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
    DevM.dmPelsWidth = iWidth
    DevM.dmPelsHeight = iHeight
    ' ChangeDisplaySettings DevM, 0
    'change the following in "ChangeRes"
    ChangeDisplaySettings DevM, CDS_UPDATEREGISTRY
    End Sub

Tags for this Thread

Posting Permissions

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