2017-02-16 3 views
3

私は、の上に常にのウィンドウを維持する方法を見つけようとしています。 (ウィンドウモードでなければなりません) 私は現在使っていますOpenTk.NetCore .netコアでウィンドウを作るためのライブラリ。 このウィンドウを上に維持するためにOpenTkを使用することは可能ですか、それとも別の方法ですか?openTk .netコアのウィンドウを常に上に置く

public class Display : GameWindow 
{ 
    public Display() : base(400, 300, GraphicsMode.Default) 
    { 
     //display window in top left corner 
     this.X = 0; 
     this.Y = 0; 
     //TODO : window should always been displayed on top 
     VSync = VSyncMode.On; 
     WindowBorder = WindowBorder.Hidden; //no title & border 
     //WindowState = WindowState.Fullscreen; 
    } 

    protected override void OnLoad(EventArgs e) 
    { 
     base.OnLoad(e); 

     GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f); 
     GL.Enable(EnableCap.DepthTest); 
    } 
    protected override void OnResize(EventArgs e) 
    { 
     base.OnResize(e); 

     GL.Viewport(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height); 

     Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView((float)Math.PI/4, Width/(float)Height, 1.0f, 64.0f); 
     GL.MatrixMode(MatrixMode.Projection); 
     GL.LoadMatrix(ref projection); 
    } 

    protected override void OnUpdateFrame(FrameEventArgs e) 
    { 
     base.OnUpdateFrame(e); 

     if (Keyboard[Key.Escape]) 
      Exit(); 
    } 

    protected override void OnRenderFrame(FrameEventArgs e) 
    { 
     base.OnRenderFrame(e); 

     GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); 

     Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, Vector3.UnitZ, Vector3.UnitY); 
     GL.MatrixMode(MatrixMode.Modelview); 
     GL.LoadMatrix(ref modelview); 
     GL.Begin(PrimitiveType.Triangles); 

     GL.Color3(1.0f, 0.0f, 0.0f); GL.Vertex3(2.0f, 1.0f, 4.0f); 
     GL.Color3(1.0f, 0.0f, 0.0f); GL.Vertex3(1.2f, 1.0f, 4.0f); 
     GL.Color3(1.0f, 0.0f, 0.0f); GL.Vertex3(1.6f, 1.5f, 4.0f); 
     GL.End(); 

     SwapBuffers(); 
    } 
} 
public class Program 
{ 
    [STAThread] 
    public static void Main(string[] args) 
    {    
     /* 
     * The 'using' idiom guarantees proper resource cleanup. 
     * We request 30 UpdateFrame events per second, and 30 
     * RenderFrame events. 
     */ 
     using (Display display = new Display()) 
     { 
      display.Run(30.0,30.0); 
     } 

    } 
} 

答えて

関連する問題