当前位置: 首页>>代码示例>>C#>>正文


C# DisplayDevice类代码示例

本文整理汇总了C#中DisplayDevice的典型用法代码示例。如果您正苦于以下问题:C# DisplayDevice类的具体用法?C# DisplayDevice怎么用?C# DisplayDevice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DisplayDevice类属于命名空间,在下文中一共展示了DisplayDevice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

    public override void Load()
    {
      _screens = new List<Screen>(Screen.AllScreens);

      IList<String> options = new List<String>();
      options.Add("[Settings.Appearance.System.StartupScreen.DoNotUseSelection]");

      foreach (Screen screen in Screen.AllScreens)
      {
        const int dwf = 0;
        DisplayDevice info = new DisplayDevice();
        string monitorname = null;
        info.cb = Marshal.SizeOf(info);
        if (EnumDisplayDevices(screen.DeviceName, 0, info, dwf))
          monitorname = info.DeviceString;
        options.Add(string.Format("{0} ({1}x{2})", monitorname, screen.Bounds.Width, screen.Bounds.Height));
      }

      int startupScreenNum = SettingsManager.Load<StartupSettings>().StartupScreenNum;

      if (startupScreenNum < Screen.AllScreens.Length)
        Selected = SettingsManager.Load<StartupSettings>().StartupScreenNum + 1;
      else
        Selected = 0;

      _items = options.Select(LocalizationHelper.CreateResourceString).ToList();
    }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:27,代码来源:StartupScreen.cs

示例2: SDL2GLNative

        public SDL2GLNative(int x, int y, int width, int height, string title,
            GraphicsMode mode,GameWindowFlags options, DisplayDevice device)
            : this()
        {
            if (width <= 0)
                throw new ArgumentOutOfRangeException("width", "Must be higher than zero.");
            if (height <= 0)
                throw new ArgumentOutOfRangeException("height", "Must be higher than zero.");


            Debug.Indent();

			IntPtr windowId;
			desiredSizeX = width;
			desiredSizeY = height;
			isFullscreen = options.HasFlag(GameWindowFlags.Fullscreen);
			if (isFullscreen)
			{
				FixupFullscreenRes(width,height,out width, out height);
			}
			lock (API.sdl_api_lock) {
				API.Init (API.INIT_VIDEO);
				API.VideoInit("",0);
				// NOTE: Seriously, letting the user set x and y coords is a _bad_ idea. We'll let the WM take care of it.
				windowId = API.CreateWindow(title, 0x1FFF0000, 0x1FFF0000, width, height, API.WindowFlags.OpenGL | ((isFullscreen)?API.WindowFlags.Fullscreen:0));
			}
			window = new SDL2WindowInfo(windowId);

			inputDriver = new SDL2Input(window);
            Debug.Unindent();

        }
开发者ID:sulix,项目名称:opentk-sdl2,代码行数:32,代码来源:SDL2GLNative.cs

示例3: X11DisplayDevice

        static X11DisplayDevice()
        {
            List<DisplayDevice> devices = new List<DisplayDevice>();
            try {
                xinerama_supported = QueryXinerama(devices);
            } catch {
                Debug.Print("Xinerama query failed.");
            }

            if (!xinerama_supported) {
                // We assume that devices are equivalent to the number of available screens.
                // Note: this won't work correctly in the case of distinct X servers.
                for (int i = 0; i < API.ScreenCount; i++) {
                    DisplayDevice dev = new DisplayDevice();
                    dev.IsPrimary = i == API.XDefaultScreen(API.DefaultDisplay);
                    devices.Add(dev);
                    deviceToScreen.Add(dev, i);
                }
            }

            try {
                xrandr_supported = QueryXRandR(devices);
            } catch { }

            if (!xrandr_supported) {
                Debug.Print("XRandR query failed, falling back to XF86.");
                try {
                    xf86_supported = QueryXF86(devices);
                }  catch { }

                if (!xf86_supported) {
                    Debug.Print("XF86 query failed, no DisplayDevice support available.");
                }
            }
        }
开发者ID:Chameleonherman,项目名称:ClassicalSharp,代码行数:35,代码来源:X11DisplayDevice.cs

示例4: LinuxNativeWindow

        public LinuxNativeWindow(IntPtr display, IntPtr gbm, int fd,
            int x, int y, int width, int height, string title,
            GraphicsMode mode, GameWindowFlags options,
            DisplayDevice display_device)
        {
            Debug.Print("[KMS] Creating window on display {0:x}", display);

            Title = title;

            display_device = display_device ?? DisplayDevice.Default;
            if (display_device == null)
            {
                throw new NotSupportedException("[KMS] Driver does not currently support headless systems");
            }

            window = new LinuxWindowInfo(display, fd, gbm, display_device.Id as LinuxDisplay);

            // Note: we only support fullscreen windows on KMS.
            // We implicitly override the requested width and height
            // by the width and height of the DisplayDevice, if any.
            width = display_device.Width;
            height = display_device.Height;
            bounds = new Rectangle(0, 0, width, height);
            client_size = bounds.Size;

            if (!mode.Index.HasValue)
            {
                mode = new EglGraphicsMode().SelectGraphicsMode(window, mode, 0);
            }
            Debug.Print("[KMS] Selected EGL mode {0}", mode);

            SurfaceFormat format = GetSurfaceFormat(display, mode);
            SurfaceFlags usage = SurfaceFlags.Rendering | SurfaceFlags.Scanout;
            if (!Gbm.IsFormatSupported(gbm, format, usage))
            {
                Debug.Print("[KMS] Failed to find suitable surface format, using XRGB8888");
                format = SurfaceFormat.XRGB8888;
            }

            Debug.Print("[KMS] Creating GBM surface on {0:x} with {1}x{2} {3} [{4}]",
                gbm, width, height, format, usage);
            IntPtr gbm_surface =  Gbm.CreateSurface(gbm,
                    width, height, format, usage);
            if (gbm_surface == IntPtr.Zero)
            {
                throw new NotSupportedException("[KMS] Failed to create GBM surface for rendering");
            }

            window.Handle = gbm_surface;
                Debug.Print("[KMS] Created GBM surface {0:x}", window.Handle);

            window.CreateWindowSurface(mode.Index.Value);
            Debug.Print("[KMS] Created EGL surface {0:x}", window.Surface);

            cursor_default = CreateCursor(gbm, Cursors.Default);
            cursor_empty = CreateCursor(gbm, Cursors.Empty);
            Cursor = MouseCursor.Default;
            exists = true;
        }
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:59,代码来源:LinuxNativeWindow.cs

示例5: WinDisplayDeviceDriver

            new Dictionary<DisplayDevice, string>();    // Needed for ChangeDisplaySettingsEx
        #region --- Constructors ---

        /// <summary>Queries available display devices and display resolutions.</summary>
        static WinDisplayDeviceDriver()
        {
            lock (display_lock)
            {
                // To minimize the need to add static methods to OpenTK.Graphics.DisplayDevice
                // we only allow settings to be set through its constructor.
                // Thus, we save all necessary parameters in temporary variables
                // and construct the device when every needed detail is available.
                // The main DisplayDevice constructor adds the newly constructed device
                // to the list of available devices.
                DisplayDevice opentk_dev;
                DisplayResolution opentk_dev_current_res = null;
                List<DisplayResolution> opentk_dev_available_res = new List<DisplayResolution>();
                bool opentk_dev_primary = false;
                int device_count = 0, mode_count = 0;
                // Get available video adapters and enumerate all monitors
                WindowsDisplayDevice dev1 = new WindowsDisplayDevice(), dev2 = new WindowsDisplayDevice();
                while (Functions.EnumDisplayDevices(null, device_count++, dev1, 0))
                {
                    if ((dev1.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) == DisplayDeviceStateFlags.None)
                        continue;
                    DeviceMode monitor_mode = new DeviceMode();
                    // The second function should only be executed when the first one fails
                    // (e.g. when the monitor is disabled)
                    if (Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.CurrentSettings, monitor_mode, 0) ||
                        Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.RegistrySettings, monitor_mode, 0))
                    {
                        opentk_dev_current_res = new DisplayResolution(
                            monitor_mode.Position.X, monitor_mode.Position.Y,
                            monitor_mode.PelsWidth, monitor_mode.PelsHeight,
                            monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency);
                        opentk_dev_primary =
                            (dev1.StateFlags & DisplayDeviceStateFlags.PrimaryDevice) != DisplayDeviceStateFlags.None;
                    }

                    opentk_dev_available_res.Clear();
                    mode_count = 0;
                    while (Functions.EnumDisplaySettings(dev1.DeviceName.ToString(), mode_count++, monitor_mode))
                    {
                        DisplayResolution res = new DisplayResolution(
                            monitor_mode.Position.X, monitor_mode.Position.Y,
                            monitor_mode.PelsWidth, monitor_mode.PelsHeight,
                            monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency);
                        opentk_dev_available_res.Add(res);
                    }

                    // Construct the OpenTK DisplayDevice through the accumulated parameters.
                    // The constructor will automatically add the DisplayDevice to the list
                    // of available devices.
                    opentk_dev = new DisplayDevice(
                        opentk_dev_current_res,
                        opentk_dev_primary,
                        opentk_dev_available_res,
                        opentk_dev_current_res.Bounds);
                    available_device_names.Add(opentk_dev, dev1.DeviceName);
                }
            }
        }
开发者ID:prepare,项目名称:HTML-Renderer,代码行数:62,代码来源:WinDisplayDevice.cs

示例6: WinGLNative

        public WinGLNative(int x, int y, int width, int height, string title, GameWindowFlags options, DisplayDevice device)
        {
            WindowProcedureDelegate = WindowProcedure;
            // To avoid issues with Ati drivers on Windows 6+ with compositing enabled, the context will not be
            // bound to the top-level window, but rather to a child window docked in the parent.
            window = new WinWindowInfo(
                CreateWindow(x, y, width, height, title, options, device, IntPtr.Zero), null);
            child_window = new WinWindowInfo(
                CreateWindow(0, 0, ClientSize.Width, ClientSize.Height, title, options, device, window.WindowHandle), window);

            exists = true;
        }
开发者ID:umby24,项目名称:ClassicalSharp,代码行数:12,代码来源:WinGLNative.cs

示例7: TryChangeResolution

        public sealed override bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
        {
            DeviceMode mode = null;

            if (resolution != null)
            {
                mode = new DeviceMode();
                mode.PelsWidth = resolution.Width;
                mode.PelsHeight = resolution.Height;
                mode.BitsPerPel = resolution.BitsPerPixel;
                mode.DisplayFrequency = (int)resolution.RefreshRate;
                mode.Fields = Constants.DM_BITSPERPEL
                    | Constants.DM_PELSWIDTH
                    | Constants.DM_PELSHEIGHT
                    | Constants.DM_DISPLAYFREQUENCY;
            }

            return Constants.DISP_CHANGE_SUCCESSFUL == 
                Functions.ChangeDisplaySettingsEx((string)device.Id, mode, IntPtr.Zero,
                    ChangeDisplaySettingsEnum.Fullscreen, IntPtr.Zero);
        }
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:21,代码来源:WinDisplayDevice.cs

示例8: Sdl2DisplayDeviceDriver

        public Sdl2DisplayDeviceDriver()
        {
            int displays = SDL.GetNumVideoDisplays();
            for (int d = 0; d < displays; d++)
            {
                Rect bounds;
                SDL.GetDisplayBounds(d, out bounds);

                DisplayMode current_mode;
                SDL.GetCurrentDisplayMode(d, out current_mode);

                var mode_list = new List<DisplayResolution>();
                int num_modes = SDL.GetNumDisplayModes(d);
                for (int m = 0; m < num_modes; m++)
                {
                    DisplayMode sdl_mode;
                    SDL.GetDisplayMode(d, m, out sdl_mode);
                    mode_list.Add(new DisplayResolution(
                        bounds.X, bounds.Y,
                        sdl_mode.Width, sdl_mode.Height,
                        TranslateFormat(sdl_mode.Format),
                        sdl_mode.RefreshRate));
                }

                var current_resolution = new DisplayResolution(
                    bounds.X, bounds.Y,
                    current_mode.Width, current_mode.Height,
                    TranslateFormat(current_mode.Format),
                    current_mode.RefreshRate);

                var device = new DisplayDevice(
                    current_resolution, d == 0, mode_list, TranslateBounds(bounds), d);

                AvailableDevices.Add(device);
                if (d == 0)
                    Primary = device;
            }
        }
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:38,代码来源:Sdl2DisplayDeviceDriver.cs

示例9: RefreshDisplayDevices

        void RefreshDisplayDevices ()
		{
			List<DisplayDevice> devices = new List<DisplayDevice> ();

			int numVideoDevices = 0;
			lock (API.sdl_api_lock) {
				numVideoDevices = API.GetNumVideoDisplays ();
			}

			for (int i = 0; i < numVideoDevices; ++i)
			{
				DisplayDevice dev = new DisplayDevice();
				List<DisplayResolution> resolutions = new List<DisplayResolution>();
				if (i == 0) dev.IsPrimary = true;
				int numResolutions = 0;
				lock (API.sdl_api_lock) {
					numResolutions = API.GetNumDisplayModes(i);
				}
				for (int res = 0; res < numResolutions; ++res)
				{
					lock (API.sdl_api_lock)
					{
						API.DisplayMode modeRect;
						API.GetDisplayMode(i, res, out modeRect);
						resolutions.Add (new DisplayResolution(0, 0, modeRect.w, modeRect.h, 32, modeRect.refresh_rate));
					}
				}
				dev.AvailableResolutions = resolutions;
				devices.Add(dev);
			}
             
            AvailableDevices.Clear();
            AvailableDevices.AddRange(devices);
            Primary = FindDefaultDevice(devices);
            
        }
开发者ID:sulix,项目名称:opentk-sdl2,代码行数:36,代码来源:SDL2DisplayDevice.cs

示例10: WinGLNative

        public WinGLNative(int x, int y, int width, int height, string title, GameWindowFlags options, DisplayDevice device)
        {
            lock (SyncRoot)
            {
                // This is the main window procedure callback. We need the callback in order to create the window, so
                // don't move it below the CreateWindow calls.
                WindowProcedureDelegate = WindowProcedure;

                //// This timer callback is called periodically when the window enters a sizing / moving modal loop.
                //ModalLoopCallback = delegate(IntPtr handle, WindowMessage msg, UIntPtr eventId, int time)
                //{
                //    // Todo: find a way to notify the frontend that it should process queued up UpdateFrame/RenderFrame events.
                //    if (Move != null)
                //        Move(this, EventArgs.Empty);
                //};

                // To avoid issues with Ati drivers on Windows 6+ with compositing enabled, the context will not be
                // bound to the top-level window, but rather to a child window docked in the parent.
                window = new WinWindowInfo(
                    CreateWindow(x, y, width, height, title, options, device, IntPtr.Zero), null);
                child_window = new WinWindowInfo(
                    CreateWindow(0, 0, ClientSize.Width, ClientSize.Height, title, options, device, window.WindowHandle), window);

                exists = true;

                keyboard.Description = "Standard Windows keyboard";
                keyboard.NumberOfFunctionKeys = 12;
                keyboard.NumberOfKeys = 101;
                keyboard.NumberOfLeds = 3;

                mouse.Description = "Standard Windows mouse";
                mouse.NumberOfButtons = 3;
                mouse.NumberOfWheels = 1;

                keyboards.Add(keyboard);
                mice.Add(mouse);
            }
        }
开发者ID:Terracorrupt,项目名称:duality,代码行数:38,代码来源:WinGLNative.cs

示例11: CreateNativeWindow

 public INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title,
     GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
 {
     return default_implementation.CreateNativeWindow(x, y, width, height, title, mode, options, device);
 }
开发者ID:dakahler,项目名称:alloclave,代码行数:5,代码来源:Factory.cs

示例12: DisplayConfig

		private string displayConfigFriendlyName;	// provided by DisplayConfig (if supported)



		/// <summary>Initializes a new <see cref="DisplayMonitor"/> instance.</summary>
		/// <param name="displayDevice">A valid <see cref="DisplayDevice"/> structure.</param>
		/// <param name="monitorHandle">A handle (HMONITOR) to the monitor.</param>
		internal DisplayMonitor( DisplayDevice displayDevice, IntPtr monitorHandle )
			: base( displayDevice )
		{
			info = GetMonitorInfo( handle = monitorHandle );
		}
开发者ID:YHiniger,项目名称:ManagedX.Display,代码行数:12,代码来源:DisplayMonitor.cs

示例13: HandleTo

 static internal IntPtr HandleTo(DisplayDevice displayDevice)
 {
     return (IntPtr)displayDevice.Id;
 }
开发者ID:Munk801,项目名称:Journey-to-the-West-Video-Game,代码行数:4,代码来源:QuartzDisplayDeviceDriver.cs

示例14: TryRestoreResolution

 public bool TryRestoreResolution(DisplayDevice device)
 {
     return TryChangeResolution(device, null);
 }
开发者ID:jcnossen,项目名称:upspring.net,代码行数:4,代码来源:WinDisplayDevice.cs

示例15: TryRestoreResolution

 public override bool TryRestoreResolution(DisplayDevice device)
 {
     Sdl2Factory.UseFullscreenDesktop = true;
     return true;
 }
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:5,代码来源:Sdl2DisplayDeviceDriver.cs


注:本文中的DisplayDevice类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。