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


C# Surface.Unuse方法代码示例

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


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

示例1: Control

		public Control()
		{
			this.DesignMode = this.DesignMode;
			this.SuspendLayout();
			// 
			// backend
			// 
			if (!this.DesignMode)
			{
				this.backend = Backend.Control.Create();
				this.backend.Initialized += () => this.Initialized.Call();
				#region Pointer Events Hookup
				this.backend.MouseClick += (sender, arguments) =>
				{
					Error.Log.Call((Action<System.Windows.Forms.MouseEventArgs>)(e =>
					{
						Geometry2D.Single.Point position = new Geometry2D.Single.Point(e.X, e.Y);
						switch (e.Button)
						{
							case System.Windows.Forms.MouseButtons.Left:
								this.PointerLeftClicked(position);
								break;
							case System.Windows.Forms.MouseButtons.Middle:
								this.PointerMiddleClicked(position);
								break;
							case System.Windows.Forms.MouseButtons.Right:
								this.PointerRightClicked(position);
								break;
						}
					}), arguments);
				};
				this.backend.MouseMove += (sender, arguments) =>
				{
					Error.Log.Call((Action<System.Windows.Forms.MouseEventArgs>)(e =>
					{
						Geometry2D.Single.Point currentPosition = new Geometry2D.Single.Point(e.X, e.Y);
						this.PointerMoved((Geometry2D.Single.Size)(currentPosition - this.lastPointerPosition), currentPosition, e.Button == System.Windows.Forms.MouseButtons.Left, e.Button == System.Windows.Forms.MouseButtons.Middle, e.Button == System.Windows.Forms.MouseButtons.Right);
						this.lastPointerPosition = currentPosition;
					}), arguments);
				};
				this.backend.MouseWheel += (sender, arguments) => Error.Log.Call((Action<System.Windows.Forms.MouseEventArgs>)(e => this.PointerWheelChanged(e.Delta / 120f, new Geometry2D.Single.Point(e.X, e.Y))), arguments);
				#endregion
				this.backend.Draw += renderer =>
				{
					using (Surface surface = new Surface(renderer))
					{
						surface.Use();
						surface.Transform = Geometry2D.Single.Transform.CreateTranslation(surface.Size / 2);
						this.Draw(surface);
						surface.Unuse();
					}
				};
				this.backend.AutoSize = true;
				this.backend.BackColor = System.Drawing.Color.Transparent;
				this.backend.Dock = System.Windows.Forms.DockStyle.Fill;
				this.backend.Location = new System.Drawing.Point(0, 0);
				this.backend.Name = "backend";
				this.backend.Size = new System.Drawing.Size(150, 150);
				this.backend.TabIndex = 0;
				this.backend.VSync = false;
				this.Controls.Add(this.backend);
			}
			// 
			// Control
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Name = "Viewer";
			this.ResumeLayout(false);
			this.PerformLayout();
		}
开发者ID:imintsystems,项目名称:Kean,代码行数:71,代码来源:Control.cs

示例2: Read

		public Draw.Image Read()
		{
			Draw.Image result;
			Renderer renderer = this.CreateRenderer();
			using (Surface surface = new Surface(renderer))
			{
				surface.Use();
				result = surface.Read();
				surface.Unuse();
			}
			return result;
		}
开发者ID:imintsystems,项目名称:Kean,代码行数:12,代码来源:Control.cs


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