예제 #1
0
 public Graphics(RenderForm form, int width, int height)
 {
     reset = () => form.Invoke(new Action(() =>
     {
         device.Reset(presentParameters);
         fontRenderer.Flush();
         textureRenderer.Flush();
         resized = false;
     }));
     form.UserResized += (sender, args) => Resize(form.ClientSize.Width, form.ClientSize.Height);
     presentParameters = new PresentParameters
     {
         Windowed             = true,
         SwapEffect           = SwapEffect.Discard,
         BackBufferFormat     = Format.A8R8G8B8,
         BackBufferCount      = 1,
         BackBufferWidth      = width,
         BackBufferHeight     = height,
         PresentationInterval = PresentInterval.One,
         MultiSampleType      = MultisampleType.None,
         MultiSampleQuality   = 0,
         PresentFlags         = PresentFlags.LockableBackBuffer
     };
     direct3D        = new Direct3DEx();
     device          = new DeviceEx(direct3D, 0, DeviceType.Hardware, form.Handle, CREATE_FLAGS, presentParameters);
     fontRenderer    = new FontRenderer(device);
     textureRenderer = new TextureRenderer(device);
     renderLocker.Reset();
 }
예제 #2
0
        public void Toast(string message)
        {
            if (Form == null)
            {
                return;
            }

            Action action = delegate {
                if (_toastTimer == null)
                {
                    _toastTimer = new Timer {
                        Interval = 3000
                    };
                    _toastTimer.Tick += ToastTimer_Tick;
                }

                Form.Text           = Form.Text == _title ? message : Form.Text + ", " + message;
                _toastTimer.Enabled = false;
                _toastTimer.Enabled = true;
            };

            Form.Invoke(action);
        }
예제 #3
0
 public void Hide()
 {
     form.Invoke(new Action(() => form.Hide()));
 }