refactor
added a timing solution to prevent windows from resizing when changing the frame option
This commit is contained in:
29
Preview.cs
29
Preview.cs
@@ -14,19 +14,22 @@ namespace PreviewToy
|
||||
public IntPtr sourceWindow;
|
||||
private DwmApi.DWM_THUMBNAIL_PROPERTIES m_ThumbnailProperties;
|
||||
private bool has_been_set_up = false;
|
||||
private PreviewToyMain spawner;
|
||||
private PreviewToyHandler spawner;
|
||||
|
||||
public Preview(IntPtr sourceWindow, String title, PreviewToyMain spawner, Size size)
|
||||
public Preview(IntPtr sourceWindow, String title, PreviewToyHandler spawner, Size size)
|
||||
{
|
||||
has_been_set_up = false;
|
||||
|
||||
this.sourceWindow = sourceWindow;
|
||||
this.spawner = spawner;
|
||||
this.Size = size;
|
||||
this.spawner = spawner;
|
||||
|
||||
InitializeComponent();
|
||||
SetUp();
|
||||
|
||||
this.Text = title;
|
||||
|
||||
has_been_set_up = true;
|
||||
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
@@ -69,8 +72,7 @@ namespace PreviewToy
|
||||
m_ThumbnailProperties.rcDestination = new DwmApi.RECT(0, 0, ClientRectangle.Right, ClientRectangle.Bottom);
|
||||
|
||||
DwmApi.DwmUpdateThumbnailProperties(m_hThumbnail, m_ThumbnailProperties);
|
||||
|
||||
has_been_set_up = true;
|
||||
|
||||
}
|
||||
|
||||
private void Preview_Load(object sender, EventArgs e)
|
||||
@@ -78,11 +80,6 @@ namespace PreviewToy
|
||||
|
||||
}
|
||||
|
||||
private void pictureBox1_Click(object sender, EventArgs e)
|
||||
{
|
||||
bring_client_to_foreground();
|
||||
}
|
||||
|
||||
public void bring_client_to_foreground()
|
||||
{
|
||||
DwmApi.SetForegroundWindow(sourceWindow);
|
||||
@@ -97,5 +94,15 @@ namespace PreviewToy
|
||||
}
|
||||
}
|
||||
|
||||
private void render_area_Click(object sender, EventArgs e)
|
||||
{
|
||||
bring_client_to_foreground();
|
||||
}
|
||||
|
||||
public void set_render_area_size(Size size)
|
||||
{
|
||||
this.Size = size;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user