• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IDeviceContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetThemeMargins

        Padding GetThemeMargins(IDeviceContext dc, MarginTypes marginType)
        {
            NativeMethods.Margins margins;
            try
            {
                IntPtr hDc = dc.GetHdc();

                if (NativeMethods.GetThemeMargins(Renderer.Handle, hDc, Renderer.Part, Renderer.State, (int)marginType, IntPtr.Zero, out margins) == 0)
                {
                    return new Padding(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight);
                }

                return new Padding(0);
            }
            finally
            {
                dc.ReleaseHdc();
            }
        }
开发者ID:john-peterson,项目名称:processhacker,代码行数:19,代码来源:AeroRenderer.cs


示例17: Module

        public Module(IDeviceContext deviceContext, byte id, byte moduleType, byte channels, float gainFactor, 
      byte splineLevel, uint version, uint serial, string description)
        {
            DeviceContext = deviceContext;

              Id = id;
              ModuleType = moduleType;
              Channels = channels;
              GainFactor = gainFactor;
              SplineLevel = splineLevel;
              Version = version;
              Serial = serial;
              Description = description;

              Parameters = new List<IParameter>();

              active = false;
              queue = new ConcurrentQueue<IQuant>();
        }
开发者ID:DarkGraf,项目名称:CapdEmulator,代码行数:19,代码来源:Module.cs


示例18: StereoRenderer

        protected StereoRenderer(IDeviceContext deviceContext)
            : base(deviceContext)
        {
            DeviceSettings settings = Game.Context.Settings;
            Camera = new StereoCamera();
            Camera.Reset();

            stereoSourceBox = new ResourceRegion
            {
                Front = 0,
                Back = 1,
                Top = 0,
                Bottom = settings.ScreenHeight,
                Left = 0,
                Right = settings.ScreenWidth
            };

            backBuffer = Game.Context.GetBackBuffer();
            cStereoRenderer = new RenderStereoTextureCommand(settings.ScreenWidth, settings.ScreenHeight, this);
        }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:20,代码来源:StereoRenderer.cs


示例19: 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();

			KhronosApi.LogComment("Query OpenGL extensions.");

			#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

			// OpenGL extensions
			graphicsCapabilities._GlExtensions.Query();
			// Windows OpenGL extensions
			WindowsDeviceContext windowsDeviceContext = deviceContext as WindowsDeviceContext;
			if (windowsDeviceContext != null)
				graphicsCapabilities._WglExtensions.Query(windowsDeviceContext);
			// GLX OpenGL extensions
			XServerDeviceContext xserverDeviceContext = deviceContext as XServerDeviceContext;
			if (xserverDeviceContext != null)
				graphicsCapabilities._GlxExtensions.Query(xserverDeviceContext);

			// Query implementation limits
			graphicsCapabilities._GraphicsLimits = GraphicsLimits.Query(graphicsCapabilities._GlExtensions);

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


示例20: BoxRenderer

 public BoxRenderer(IDeviceContext deviceContext)
     : base(deviceContext)
 {
 }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:4,代码来源:BoxRenderer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IDiagramPresenter类代码示例发布时间:2022-05-24
下一篇:
C# IDevice类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap