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


C# DisplayMode.ToString方法代码示例

本文整理汇总了C#中DisplayMode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DisplayMode.ToString方法的具体用法?C# DisplayMode.ToString怎么用?C# DisplayMode.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DisplayMode的用法示例。


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

示例1: typeof

        /// <summary>
        /// HACK! This function will be removed in 0.3.15
        /// Checks if the specified OpenTK.Platform.DisplayMode is available, and selects it if it is.
        /// </summary>
        /// <param name="mode">The OpenTK.Platform.DisplayMode to select.</param>
        /// <param name="info">The OpenTK.Platform.IWindowInfo that describes the display to use. Note: a window handle is not necessary for this function!</param>
        /// <returns>True if the DisplayMode is available, false otherwise.</returns>
        bool IGLContextCreationHack.SelectDisplayMode(DisplayMode mode, IWindowInfo info)
        {
            List<int> visualAttributes = new List<int>();

            // TODO: Improve modesetting code.
            if (mode == null || mode.Color.BitsPerPixel == 0)
            {
                // Define the bare essentials - needed for compatibility with Mono's System.Windows.Forms
                Debug.Print("Preparing visual for System.Windows.Forms (compatibility mode)");
            
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA);
                /*visualAttributes.Add((int)Glx.Enums.GLXAttribute.RED_SIZE);
                visualAttributes.Add((int)1);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.GREEN_SIZE);
                visualAttributes.Add((int)1);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.BLUE_SIZE);
                visualAttributes.Add((int)1);*/
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE);
                visualAttributes.Add((int)1);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
                visualAttributes.Add((int)0);
            }
            else
            {
                Debug.Print("Preparing visual for DisplayMode: {0}", mode.ToString());

                visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.RED_SIZE);
                visualAttributes.Add((int)mode.Color.Red);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.GREEN_SIZE);
                visualAttributes.Add((int)mode.Color.Green);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.BLUE_SIZE);
                visualAttributes.Add((int)mode.Color.Blue);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.ALPHA_SIZE);
                visualAttributes.Add((int)mode.Color.Alpha);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE);
                visualAttributes.Add((int)mode.DepthBits);
                visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
                visualAttributes.Add((int)0);
            }

            windowInfo.CopyInfoFrom(info);
            visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, visualAttributes.ToArray());
            if (visual == IntPtr.Zero)
                return false;
            else
            {
                windowInfo.VisualInfo = (XVisualInfo)Marshal.PtrToStructure(visual,
                                                                            typeof(XVisualInfo));
                Debug.Print("Chose visual {0}", windowInfo.VisualInfo.ToString());
            }
            return true;
        }
开发者ID:nebenjamin,项目名称:cpsc-431-project,代码行数:60,代码来源:X11GLContext.cs

示例2: Slurpify

        /// <summary>
        /// Helper function to "Slurpify" a link.
        /// </summary>
        /// <param name="url">The URL of the document you wish to slurp.</param>
        /// <param name="displayMode">How a document is displayed on Scribd</param>
        /// <param name="isPrivate">Public or private display of the document</param>
        /// <returns>A Slurpified <see cref="T:System.string"/></returns>
        public static string Slurpify(string url, DisplayMode displayMode, bool isPrivate)
        {
            if (!string.IsNullOrEmpty(Service.PublisherID))
            {
                string _url = @"http://www.scribd.com/slurp?url={0}&display_mode={1}&privacy={2}&publisher_id={3}";
                return string.Format(_url, url, displayMode.ToString().ToLower(), isPrivate == true ? "private" : "public", Service.PublisherID);
            }

            // Notify users
            OnErrorOccurred(10004, Properties.Resources.ERR_NO_PUBLISHERID);

            return string.Empty;
        }
开发者ID:JPaulDuncan,项目名称:Scribd.Net,代码行数:20,代码来源:Service.cs

示例3: CreateWindow

        public void CreateWindow(DisplayMode windowMode, out IGLContext context)
        {
            Debug.Print("Creating native window with mode: {0}", windowMode.ToString());
            Debug.Indent();

            CreateParams cp = new CreateParams();
            cp.ClassStyle =
                (int)WindowClassStyle.OwnDC |
                (int)WindowClassStyle.VRedraw |
                (int)WindowClassStyle.HRedraw |
                (int)WindowClassStyle.Ime;
            cp.Style =
                (int)WindowStyle.Visible |
                (int)WindowStyle.ClipChildren |
                (int)WindowStyle.ClipSiblings |
                (int)WindowStyle.OverlappedWindow;

            Rectangle rect = new Rectangle();
            rect.top = rect.left = 0;
            rect.bottom = windowMode.Height;
            rect.right = windowMode.Width;
            Functions.AdjustWindowRect(ref rect, WindowStyle.OverlappedWindow, false);

            // Not used
            Top = 0;
            Left = 0;
            Right = windowMode.Width;
            Bottom = windowMode.Height;
            // --------

            top_border = -rect.top;
            left_border = -rect.left;
            bottom_border = rect.bottom - windowMode.Height;
            right_border = rect.right - windowMode.Width;

            cp.Width = rect.right - rect.left;
            cp.Height = rect.bottom - rect.top;
            cp.Caption = "OpenTK Game Window";

            // Keep in mind that some construction code runs in WM_CREATE,
            // which is raised CreateHandle()
            CreateHandle(cp);

            if (this.Handle != IntPtr.Zero)
            {
                Debug.WriteLine("Window creation succesful.");
                //context.Info = new OpenTK.Platform.WindowInfo(this);
                //context.CreateContext();
                //Debug.WriteLine("Context creation successful.");
                exists = true;
            }
            else throw new ApplicationException(String.Format(
                    "Could not create native window and/or context. Handle: {0}",
                    this.Handle));

            Functions.SetWindowPos(this.Handle, WindowPlacementOptions.TOP, Left, Top, cp.Width, cp.Height, SetWindowPosFlags.SHOWWINDOW);

            //context = new GLContext(mode, window);
            //context.CreateContext();

            context = new WinGLContext();
            (context as IGLContextCreationHack).SetWindowHandle(window.Handle);
            (context as IGLContextCreationHack).SelectDisplayMode(mode, window);
            context.CreateContext(true, null);

            Debug.Unindent();
        }
开发者ID:nebenjamin,项目名称:cpsc-431-project,代码行数:67,代码来源:WinGLNative.cs

示例4: CreateWindow

        /// <summary>
        /// Opens a new render window with the given DisplayMode.
        /// </summary>
        /// <param name="mode">The DisplayMode of the render window.</param>
        /// <remarks>
        /// Creates the window visual and colormap. Associates the colormap/visual
        /// with the window and raises the window on top of the window stack.
        /// <para>
        /// Colormap creation is currently disabled.
        /// </para>
        /// </remarks>
        public void CreateWindow(DisplayMode mode, out IGLContext glContext)
        {
            if (exists)
                throw new ApplicationException("Render window already exists!");

            Debug.Print("Creating GameWindow with mode: {0}", mode != null ? mode.ToString() : "default");
            Debug.Indent();

            glContext = new X11GLContext();
            (glContext as IGLContextCreationHack).SelectDisplayMode(mode, window);
            if (glContext == null)
                throw new ApplicationException("Could not create GLContext");
            Debug.Print("Created GLContext");
            window.VisualInfo = ((X11.WindowInfo)((IGLContextInternal)glContext).Info).VisualInfo;
            //window.VisualInfo = Marshal.PtrToStructure(Glx.ChooseVisual(window.Display, window.Screen, 

            // Create a window on this display using the visual above
            Debug.Write("Opening render window... ");

            XSetWindowAttributes attributes = new XSetWindowAttributes();
            attributes.background_pixel = IntPtr.Zero;
            attributes.border_pixel = IntPtr.Zero;
            attributes.colormap =
                API.CreateColormap(window.Display, window.RootWindow, window.VisualInfo.visual, 0/*AllocNone*/);
            window.EventMask =
                EventMask.StructureNotifyMask | EventMask.SubstructureNotifyMask | EventMask.ExposureMask |
                EventMask.KeyReleaseMask | EventMask.KeyPressMask |
                    EventMask.PointerMotionMask | /* Bad! EventMask.PointerMotionHintMask | */
                    EventMask.ButtonPressMask | EventMask.ButtonReleaseMask;
            attributes.event_mask = (IntPtr)window.EventMask;

            uint mask = (uint)SetWindowValuemask.ColorMap | (uint)SetWindowValuemask.EventMask |
                (uint)SetWindowValuemask.BackPixel | (uint)SetWindowValuemask.BorderPixel;

            window.Handle = Functions.XCreateWindow(window.Display, window.RootWindow,
                0, 0, mode.Width, mode.Height, 0, window.VisualInfo.depth/*(int)CreateWindowArgs.CopyFromParent*/,
                (int)CreateWindowArgs.InputOutput, window.VisualInfo.visual, (UIntPtr)mask, ref attributes);

            if (window.Handle == IntPtr.Zero)
                throw new ApplicationException("XCreateWindow call failed (returned 0).");

            // Set the window hints
            XSizeHints hints = new XSizeHints();
            hints.x = 0;
            hints.y = 0;
            hints.width = mode.Width;
            hints.height = mode.Height;
            hints.flags = (IntPtr)(XSizeHintsFlags.USSize | XSizeHintsFlags.USPosition);
            Functions.XSetWMNormalHints(window.Display, window.Handle, ref hints);

            // Register for window destroy notification
            IntPtr wm_destroy_atom = Functions.XInternAtom(window.Display,
                "WM_DELETE_WINDOW", true);
            XWMHints hint = new XWMHints();
            Functions.XSetWMProtocols(window.Display, window.Handle, new IntPtr[] { wm_destroy_atom }, 1);

            Top = Left = 0;
            Right = Width;
            Bottom = Height;

            //XTextProperty text = new XTextProperty();
            //text.value = "OpenTK Game Window";
            //text.format = 8;
            //Functions.XSetWMName(window.Display, window.Handle, ref text);
            //Functions.XSetWMProperties(display, window, name, name, 0,  /*None*/ null, 0, hints);

            Debug.Print("done! (id: {0})", window.Handle);

            (glContext as IGLContextCreationHack).SetWindowHandle(window.Handle);

            API.MapRaised(window.Display, window.Handle);
            mapped = true;

            glContext.CreateContext(true, null);

            driver = new X11Input(window);

            Debug.Unindent();
            Debug.WriteLine("GameWindow creation completed successfully!");
            exists = true;
        }
开发者ID:nebenjamin,项目名称:cpsc-431-project,代码行数:92,代码来源:X11GLNative.cs

示例5: LuaProfileResultsView

		public LuaProfileResultsView(IManager manager, Document doc)
			: base(manager, doc)
		{
			InitializeComponent();

			m_comparer = new ListViewItemComparer();
			profileListView.ListViewItemSorter = m_comparer;
			m_displayMode = DisplayMode.Seconds;

			m_totalTime = 0;
			LuaProfileResultsDocument profileDoc = (LuaProfileResultsDocument) Document;
			foreach (LuaProfileEntry entry in profileDoc.Functions)
			{
				m_totalCount += entry.m_count;
				m_totalTime += entry.m_timeSelf;
				m_totalTimeChildren += entry.m_timeChildren;
			}

			toolStripComboBox1.Text = m_displayMode.ToString();

			UpdateList();
		}
开发者ID:zcnet4,项目名称:lua-tilde,代码行数:22,代码来源:LuaProfileResultsView.cs


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