本文整理汇总了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();
}
示例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;
}