1
General / Flicker in winform when using WS_EX_COMPOSITED
« on: July 21, 2022, 08:58:20 am »
It was OK, before I add this code.
I have to use this code, but I don't know how to remove flicker.
Is there any solution?
This is my code when sfml is shown
protected override CreateParams CreateParams
{
get
{
CreateParams handleParam = base.CreateParams;
handleParam.ExStyle |= 0x02000000; // WS_EX_COMPOSITED
return handleParam;
}
}
{
get
{
CreateParams handleParam = base.CreateParams;
handleParam.ExStyle |= 0x02000000; // WS_EX_COMPOSITED
return handleParam;
}
}
I have to use this code, but I don't know how to remove flicker.
Is there any solution?
This is my code when sfml is shown
m_renderSurface = new PictureBox();
m_renderSurface.Location = new System.Drawing.Point(0, 0);
m_renderSurface.Size = new System.Drawing.Size(m_parentPanel.Size.Width, m_parentPanel.Size.Height);
m_parentPanel.Controls.Add(m_renderSurface);
SFML.Window.ContextSettings setting = new SFML.Window.ContextSettings();
setting.AntialiasingLevel = 8;
m_renderWindow = new SFML.Graphics.RenderWindow(m_renderSurface.Handle, setting);
m_renderWindow.SetVerticalSyncEnabled(true);
m_renderWindow.SetVisible(true);
while (m_renderWindow.IsOpen)
{
try
{
System.Windows.Forms.Application.DoEvents();
m_renderWindow.DispatchEvents();
m_renderWindow.Clear(colorWindow);
SetItems();
DrawItems();
m_renderWindow.Display();
}
catch
{
break;
}
}
m_renderSurface.Location = new System.Drawing.Point(0, 0);
m_renderSurface.Size = new System.Drawing.Size(m_parentPanel.Size.Width, m_parentPanel.Size.Height);
m_parentPanel.Controls.Add(m_renderSurface);
SFML.Window.ContextSettings setting = new SFML.Window.ContextSettings();
setting.AntialiasingLevel = 8;
m_renderWindow = new SFML.Graphics.RenderWindow(m_renderSurface.Handle, setting);
m_renderWindow.SetVerticalSyncEnabled(true);
m_renderWindow.SetVisible(true);
while (m_renderWindow.IsOpen)
{
try
{
System.Windows.Forms.Application.DoEvents();
m_renderWindow.DispatchEvents();
m_renderWindow.Clear(colorWindow);
SetItems();
DrawItems();
m_renderWindow.Display();
}
catch
{
break;
}
}