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


C# IDeviceContext类代码示例

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


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

示例1: MeasureString

 private static SizeF MeasureString(IDeviceContext g, char chr, Font font, FontData data)
 {
     var chrValue = (int)chr;
         if ((font.Bold && font.Italic) || font.Bold)
         {
             if (chrValue > 255 && data.BoldCharacter[chrValue].Width == 0)
             {
                 data.BoldCharacter[chrValue] = FontData.MeasureString(g, font, chr.ToString());
             }
             return data.BoldCharacter[chrValue];
         }
         if (font.Italic)
         {
             if (chrValue > 255 && data.ItalicCharacter[chrValue].Width == 0)
             {
                 data.ItalicCharacter[chrValue] = FontData.MeasureString(g, font, chr.ToString());
             }
             return data.ItalicCharacter[chrValue];
         }
         if (chrValue > 255 && data.NormalCharacter[chrValue].Width == 0)
         {
             data.NormalCharacter[chrValue] = FontData.MeasureString(g, font, chr.ToString());
         }
         return data.NormalCharacter[chrValue];
 }
开发者ID:LeoTosti,项目名称:x-drone,代码行数:25,代码来源:MeasureString.cs

示例2: DrawText

 public static void DrawText(this VisualStyleRenderer rnd, IDeviceContext dc, ref Rectangle bounds, string text, System.Windows.Forms.TextFormatFlags flags, NativeMethods.DrawThemeTextOptions options)
 {
     NativeMethods.RECT rc = new NativeMethods.RECT(bounds);
     using (SafeGDIHandle hdc = new SafeGDIHandle(dc))
         NativeMethods.DrawThemeTextEx(rnd.Handle, hdc, rnd.Part, rnd.State, text, text.Length, (int)flags, ref rc, ref options);
     bounds = rc;
 }
开发者ID:tablesmit,项目名称:task-scheduler-managed-wrapper,代码行数:7,代码来源:VisualStylesRendererExtension.cs

示例3: GetMargins2

 public static System.Windows.Forms.Padding GetMargins2(this VisualStyleRenderer rnd, IDeviceContext dc, MarginProperty prop)
 {
     NativeMethods.RECT rc;
     using (SafeGDIHandle hdc = new SafeGDIHandle(dc))
         NativeMethods.GetThemeMargins(rnd.Handle, hdc, rnd.Part, rnd.State, (int)prop, IntPtr.Zero, out rc);
     return new System.Windows.Forms.Padding(rc.Left, rc.Top, rc.Right, rc.Bottom);
 }
开发者ID:tablesmit,项目名称:task-scheduler-managed-wrapper,代码行数:7,代码来源:VisualStylesRendererExtension.cs

示例4: UxThemeDrawThemeBackground

		public int UxThemeDrawThemeBackground (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, Rectangle bounds)
		{
			XplatUIWin32.RECT BoundsRect = XplatUIWin32.RECT.FromRectangle (bounds);

			int result = UXTheme.DrawThemeBackground(hTheme, dc.GetHdc (), iPartId, iStateId, ref BoundsRect, IntPtr.Zero);
			dc.ReleaseHdc ();
			return result;
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:8,代码来源:VisualStylesNative.cs

示例5: UxThemeDrawThemeText

		public int UxThemeDrawThemeText (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, string text, TextFormatFlags textFlags, Rectangle bounds)
		{
			XplatUIWin32.RECT BoundsRect = XplatUIWin32.RECT.FromRectangle (bounds);

			int result = UXTheme.DrawThemeText (hTheme, dc.GetHdc (), iPartId, iStateId, text, text.Length, (uint)textFlags, 0, ref BoundsRect);
			dc.ReleaseHdc ();
			return result;
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:8,代码来源:VisualStylesNative.cs

示例6: UxThemeDrawThemeEdge

		public int UxThemeDrawThemeEdge (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects, out Rectangle result)
		{
			XplatUIWin32.RECT BoundsRect = XplatUIWin32.RECT.FromRectangle (bounds);
			XplatUIWin32.RECT retval;

			int hresult = UXTheme.DrawThemeEdge (hTheme, dc.GetHdc (), iPartId, iStateId, ref BoundsRect, (uint)style, (uint)edges + (uint)effects, out retval);
			dc.ReleaseHdc ();
			result = retval.ToRectangle();
			return hresult;
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:10,代码来源:VisualStylesNative.cs

示例7: SwapBgraToRgba

        public void SwapBgraToRgba(IDeviceContext context, ITexture2D target, ITexture2D texture)
        {
            var uav = target.ViewAsUnorderedAccessResource(rgbaFormat, 0);
            var srv = texture.ViewAsShaderResource(bgraFormat, 0, 1);

            context.ShaderForDispatching = computeShader;
            context.ComputeStage.ShaderResources[0] = srv;
            context.ComputeStage.UnorderedAccessResources[0] = uav;

            context.Dispatch(RavcMath.DivideAndCeil(target.Width, 16), RavcMath.DivideAndCeil(target.Height, 16), 1);
        }
开发者ID:Zulkir,项目名称:RAVC,代码行数:11,代码来源:GpuChannelSwapper.cs

示例8: StyleContext

        public StyleContext(IDeviceContext deviceContext, IStyleProxy proxy, IControlDecoratorFactory decoratorFactory)
        {
            DeviceContext = deviceContext;

            _proxy = proxy;
            _decoratorFactory = decoratorFactory;

            Current = this;

            RegisterDefaultControlDectorators();
        }
开发者ID:jamilgeor,项目名称:Crayon,代码行数:11,代码来源:StyleContext.cs

示例9: Renderer

 protected Renderer(IDeviceContext deviceContext)
 {
     DeviceContext = deviceContext;
     DeviceContext.DeviceDisposing += OnDisposing;
     DeviceContext.DeviceResize += OnDeviceResize;
     DeviceContext.DeviceSuspend += OnDeviceSuspend;
     DeviceContext.DeviceResume += OnDeviceResume;
     Scene = new SceneManager();
     Camera = new QuaternionCam();
     buffers = new List<SlimDX.Direct3D11.Buffer>();
 }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:11,代码来源:Renderer.cs

示例10: IsSupported

		/// <summary>
		/// Check whether one of the extention strings is supported.
		/// </summary>
		/// <param name="ctx">
		/// A <see cref="GraphicsContext"/> that specifies the current OpenGL version to test for extension support. In the case this
		/// parameter is null, the test fallback to the current OpenGL version.
		/// </param>
		public bool IsSupported(GraphicsContext ctx, IDeviceContext deviceContext)
		{
			if (IsSupportedExtension(ctx, deviceContext, mExtensionString) == true)
				return (true);
			if (mExtensionAlternatives != null) {
				foreach (string ext in mExtensionAlternatives)
					if (IsSupportedExtension(ctx, deviceContext, ext) == true)
						return (true);
			}

			return (false);
		}
开发者ID:MagmaiKH,项目名称:OpenGL.Net,代码行数:19,代码来源:GraphicsExtensionAttribute.cs

示例11: DrawGlassBackground

 public static void DrawGlassBackground(this VisualStyleRenderer rnd, IDeviceContext dc, Rectangle bounds, Rectangle clipRectangle)
 {
     DrawWrapper(rnd, dc, bounds,
         delegate(IntPtr memoryHdc)
         {
             RECT rBounds = new RECT(bounds);
             RECT rClip = new RECT(clipRectangle);
             // Draw background
             DrawThemeBackground(rnd.Handle, memoryHdc, rnd.Part, rnd.State, ref rBounds, ref rClip);
         }
     );
 }
开发者ID:JohnThomson,项目名称:testBloom,代码行数:12,代码来源:VisualStylesRendererExtender.cs

示例12: UxThemeDrawThemeParentBackground

		public int UxThemeDrawThemeParentBackground (IDeviceContext dc, Rectangle bounds, Control childControl)
		{
			int result;

			XplatUIWin32.RECT BoundsRect = XplatUIWin32.RECT.FromRectangle (bounds);

			using (Graphics g = Graphics.FromHwnd (childControl.Handle)) {
				IntPtr hdc = g.GetHdc ();
				result = UXTheme.DrawThemeParentBackground (childControl.Handle, hdc, ref BoundsRect);
				g.ReleaseHdc (hdc);
			}

			return result;
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:14,代码来源:VisualStylesNative.cs

示例13: DrawGlassBackground

 public static void DrawGlassBackground(this VisualStyleRenderer rnd, IDeviceContext dc, Rectangle bounds, Rectangle clipRectangle, bool rightToLeft = false)
 {
     DrawWrapper(rnd, dc, bounds,
         delegate(IntPtr memoryHdc)
         {
             NativeMethods.RECT rBounds = new NativeMethods.RECT(bounds);
             NativeMethods.RECT rClip = new NativeMethods.RECT(clipRectangle);
             // Draw background
             if (rightToLeft) NativeMethods.SetLayout(memoryHdc, 1);
             NativeMethods.DrawThemeBackground(rnd.Handle, memoryHdc, rnd.Part, rnd.State, ref rBounds, ref rClip);
             NativeMethods.SetLayout(memoryHdc, 0);
         }
     );
 }
开发者ID:tablesmit,项目名称:task-scheduler-managed-wrapper,代码行数:14,代码来源:VisualStylesRendererExtension.cs

示例14: WidgetTextureRenderer

 public WidgetTextureRenderer(int width, int height, IDeviceContext deviceContext)
     : base(deviceContext)
 {
     this.width = width;
     this.height = height;
     Hud = Hud.FromDescription(Game.Context.Device,
         new HudDescription(
             cameraEnabled: false,
             width: width,
             height: height,
             zFar: Camera.FarClip,
             zNear: Camera.NearClip,
             multithreaded: false
             ));
     Camera.ChangeScreenSize(width, height);
     command = new RenderToTextureCommand(width, height, Scene);
 }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:17,代码来源:WidgetTextureRenderer.cs

示例15: Query

		/// <summary>
		/// Query OpenGL implementation extensions.
		/// </summary>
		/// <param name="ctx"></param>
		/// <returns></returns>
		public static GraphicsCapabilities Query(GraphicsContext ctx, IDeviceContext deviceContext)
		{
			GraphicsCapabilities graphicsCapabilities = new GraphicsCapabilities();
			FieldInfo[] capsFields = typeof(GraphicsCapabilities).GetFields(BindingFlags.Public | BindingFlags.Instance);

			#region Platform Extension Reload

			// Since at this point there's a current OpenGL context, it's possible to use
			// {glx|wgl}GetExtensionsString to retrieve platform specific extensions

			switch (Environment.OSVersion.Platform) {
				case PlatformID.Win32NT:
				case PlatformID.Win32Windows:
				case PlatformID.Win32S:
				case PlatformID.WinCE:
					Wgl.SyncDelegates();
					break;
			}

			#endregion

			// Only boolean fields are considered
			FieldInfo[] extsFields = Array.FindAll<FieldInfo>(capsFields, delegate(FieldInfo info) {
				return (info.FieldType == typeof(bool));
			});

			foreach (FieldInfo field in extsFields) {
				Attribute[] graphicsExtensionAttributes = Attribute.GetCustomAttributes(field, typeof(GraphicsExtensionAttribute));
				GraphicsExtensionDisabledAttribute graphicsExtensionDisabled = (GraphicsExtensionDisabledAttribute)Attribute.GetCustomAttribute(field, typeof(GraphicsExtensionDisabledAttribute));
				bool implemented = false;

				// Check whether at least one extension is implemented
				implemented = Array.Exists(graphicsExtensionAttributes, delegate(Attribute item) {
					return ((GraphicsExtensionAttribute)item).IsSupported(ctx, deviceContext);
				});
				// Check whether the required extensions are artifically disabled
				if (graphicsExtensionDisabled != null)
					implemented = false;

				field.SetValue(graphicsCapabilities, implemented);
			}

			return (graphicsCapabilities);
		}
开发者ID:MagmaiKH,项目名称:OpenGL.Net,代码行数:49,代码来源:GraphicsCapabilities.cs


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