本文整理汇总了C#中System.Factory.SetWindowAssociation方法的典型用法代码示例。如果您正苦于以下问题:C# Factory.SetWindowAssociation方法的具体用法?C# Factory.SetWindowAssociation怎么用?C# Factory.SetWindowAssociation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Factory
的用法示例。
在下文中一共展示了Factory.SetWindowAssociation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeviceContext10
/// <summary>
/// Initializes a new instance of the <see cref="DeviceContext10"/> class.
/// </summary>
/// <param name="handle">The window handle to associate with the device.</param>
/// <param name="settings">The settings used to configure the device.</param>
internal DeviceContext10(IntPtr handle, DeviceSettings10 settings)
{
if (handle == IntPtr.Zero)
throw new ArgumentException("Value must be a valid window handle.", "handle");
if (settings == null)
throw new ArgumentNullException("settings");
this.settings = settings;
factory = new Factory();
device = new Direct3D10.Device(factory.GetAdapter(settings.AdapterOrdinal), Direct3D10.DriverType.Hardware, settings.CreationFlags);
swapChain = new SwapChain(factory, device, new SwapChainDescription
{
BufferCount = 1,
Flags = SwapChainFlags.None,
IsWindowed = true,
ModeDescription = new ModeDescription(settings.Width, settings.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm),
OutputHandle = handle,
SampleDescription = new SampleDescription(1, 0),
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput
});
factory.SetWindowAssociation(handle, WindowAssociationFlags.IgnoreAll | WindowAssociationFlags.IgnoreAltEnter);
}
示例2: D3D11RenderingPane
public D3D11RenderingPane( Factory dxgiFactory, SlimDX.Direct3D11.Device d3D11Device, DeviceContext d3D11DeviceContext, D3D11HwndDescription d3D11HwndDescription )
{
mDxgiFactory = dxgiFactory;
mD3D11Device = d3D11Device;
mD3D11DeviceContext = d3D11DeviceContext;
var swapChainDescription = new SwapChainDescription
{
BufferCount = 1,
ModeDescription =
new ModeDescription( d3D11HwndDescription.Width,
d3D11HwndDescription.Height,
new Rational( 60, 1 ),
Format.R8G8B8A8_UNorm ),
IsWindowed = true,
OutputHandle = d3D11HwndDescription.Handle,
SampleDescription = new SampleDescription( 1, 0 ),
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput
};
mSwapChain = new SwapChain( mDxgiFactory, mD3D11Device, swapChainDescription );
mDxgiFactory.SetWindowAssociation( d3D11HwndDescription.Handle, WindowAssociationFlags.IgnoreAll );
CreateD3D11Resources( d3D11HwndDescription.Width, d3D11HwndDescription.Height );
PauseRendering = false;
}
示例3: Direct3D11Base
public Direct3D11Base(Form form,
SwapChainDescription swapDesc,
Adapter adapter = null,
DriverType type = DriverType.Hardware,
DeviceCreationFlags flags = DeviceCreationFlags.None,
FeatureLevel[] levels = null)
{
IsDisposed = false;
try
{
_isInitializing = true;
_form = form;
_isComposited = DwmApi.IsCompositionEnabled;
if (_isComposited)
{
DwmApi.EnableMMCSS(true);
DwmPresentParameters present = new DwmPresentParameters()
{
IsQueued = true,
BufferCount = 2,
RefreshesPerFrame = 1,
};
DwmApi.SetPresentParameters(form.Handle, ref present);
}
if (swapDesc.OutputHandle != IntPtr.Zero) { throw new ArgumentException("Output handle must not be set."); }
if (swapDesc.Usage != Usage.RenderTargetOutput) { throw new ArgumentException("Usage must be RenderTargetOutput."); }
swapDesc.OutputHandle = _form.Handle;
bool setFullscreen = !swapDesc.IsWindowed;
swapDesc.IsWindowed = true;
Device.CreateWithSwapChain(adapter, type, DeviceCreationFlags.None, levels, swapDesc, out _device, out _swapChain);
_swapChain.ResizeTarget(swapDesc.ModeDescription);
_factory = _swapChain.GetParent<Factory>();
_factory.SetWindowAssociation(_form.Handle, WindowAssociationFlags.IgnoreAll);
_form.SizeChanged += SizeChanged_Handler;
_form.ResizeBegin += ResizeBegin_Handler;
_form.Resize += Resize_Handler;
_form.ResizeEnd += ResizeEnd_Handler;
_form.KeyDown += KeyDown_Handler;
if (setFullscreen)
{
ChangeMode(true);
}
_isInitializing = false;
}
catch
{
Dispose();
throw;
}
}
示例4: Main
private static void Main()
{
// Device creation
var form = new RenderForm("Stereo test")
{
ClientSize = size,
//FormBorderStyle = System.Windows.Forms.FormBorderStyle.None,
//WindowState = FormWindowState.Maximized
};
form.KeyDown += new KeyEventHandler(form_KeyDown);
// form.Resize += new EventHandler(form_Resize);
ModeDescription mDesc = new ModeDescription(form.ClientSize.Width, form.ClientSize.Height,
new Rational(120000, 1000), Format.R8G8B8A8_UNorm);
mDesc.ScanlineOrdering = DisplayModeScanlineOrdering.Progressive;
mDesc.Scaling = DisplayModeScaling.Unspecified;
var desc = new SwapChainDescription()
{
BufferCount = 1,
ModeDescription = mDesc,
Flags = SwapChainFlags.AllowModeSwitch,
IsWindowed = false,
OutputHandle = form.Handle,
SampleDescription = new SampleDescription(1, 0),
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput
};
Device.CreateWithSwapChain(null, DriverType.Hardware, DeviceCreationFlags.Debug, desc, out device,
out swapChain);
//Stops Alt+enter from causing fullscreen skrewiness.
factory = swapChain.GetParent<Factory>();
factory.SetWindowAssociation(form.Handle, WindowAssociationFlags.IgnoreAll);
backBuffer = Resource.FromSwapChain<Texture2D>(swapChain, 0);
renderView = new RenderTargetView(device, backBuffer);
ImageLoadInformation info = new ImageLoadInformation()
{
BindFlags = BindFlags.None,
CpuAccessFlags = CpuAccessFlags.Read,
FilterFlags = FilterFlags.None,
Format = SlimDX.DXGI.Format.R8G8B8A8_UNorm,
MipFilterFlags = FilterFlags.None,
OptionFlags = ResourceOptionFlags.None,
Usage = ResourceUsage.Staging,
MipLevels = 1
};
// Make texture 3D
sourceTexture = Texture2D.FromFile(device, "medusa.jpg", info);
ImageLoadInformation info2 = new ImageLoadInformation()
{
BindFlags = BindFlags.ShaderResource,
CpuAccessFlags = CpuAccessFlags.None,
FilterFlags = FilterFlags.None,
Format = SlimDX.DXGI.Format.R8G8B8A8_UNorm,
MipFilterFlags = FilterFlags.None,
OptionFlags = ResourceOptionFlags.None,
Usage = ResourceUsage.Default,
MipLevels = 1
};
Texture2D tShader = Texture2D.FromFile(device, "medusa.jpg", info2);
srv = new ShaderResourceView(device, tShader);
//ResizeDevice(new Size(1920, 1080), true);
// Create a quad that fills the whole screen
BuildQuad();
// Create world view (ortho) projection matrices
//QuaternionCam qCam = new QuaternionCam();
// Load effect from file. It is a basic effect that renders a full screen quad through
// an ortho projectio=n matrix
effect = Effect.FromFile(device, "Texture.fx", "fx_4_0", ShaderFlags.Debug, EffectFlags.None);
EffectTechnique technique = effect.GetTechniqueByIndex(0);
EffectPass pass = technique.GetPassByIndex(0);
InputLayout layout = new InputLayout(device, pass.Description.Signature, new[]
{
new InputElement(
"POSITION", 0,
Format.
R32G32B32A32_Float,
0, 0),
new InputElement(
"TEXCOORD", 0,
Format.
R32G32_Float,
16, 0)
});
//effect.GetVariableByName("mWorld").AsMatrix().SetMatrix(
// Matrix.Translation(Layout.OrthographicTransform(Vector2.Zero, 99, size)));
//effect.GetVariableByName("mView").AsMatrix().SetMatrix(qCam.View);
//effect.GetVariableByName("mProjection").AsMatrix().SetMatrix(qCam.OrthoProjection);
//effect.GetVariableByName("tDiffuse").AsResource().SetResource(srv);
// Set RT and Viewports
device.OutputMerger.SetTargets(renderView);
//.........这里部分代码省略.........
示例5: DeviceContext11
public DeviceContext11(IntPtr handle, DeviceSettings settings)
{
Contract.Requires(handle != IntPtr.Zero);
Contract.Requires(settings != null);
Settings = settings;
LogEvent.Engine.Log(settings.ToString());
eventHandlerList = new EventHandlerList();
SwapChainDescription swapChainDesc = new SwapChainDescription
{
BufferCount = 1,
IsWindowed = Settings.IsWindowed,
ModeDescription =
new ModeDescription{
Width = Settings.ScreenWidth,
Height = Settings.ScreenHeight,
RefreshRate= new Rational(0, 1),
Format = Settings.Format,
Scaling = DisplayModeScaling.Unspecified,
ScanlineOrdering = DisplayModeScanlineOrdering.Unspecified,
},
//new Rational(120, 1), Settings.Format),
OutputHandle = handle,
SampleDescription = Settings.SampleDescription,
Flags = SwapChainFlags.AllowModeSwitch,
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput,
};
FeatureLevel[] featureLevels = new FeatureLevel[] { FeatureLevel.Level_11_0, FeatureLevel.Level_10_1, FeatureLevel.Level_10_0 };
LogEvent.Engine.Log(Resources.INFO_OE_DeviceCreating);
Device.CreateWithSwapChain(DriverType.Hardware, Settings.CreationFlags, featureLevels, swapChainDesc, out device, out swapChain);
factory = swapChain.GetParent<Factory>();
factory.SetWindowAssociation(handle, WindowAssociationFlags.IgnoreAltEnter | WindowAssociationFlags.IgnoreAll);
immediate = device.ImmediateContext;
CreateTargets();
LogEvent.Engine.Log(Resources.INFO_OE_DeviceCreated);
}