added a timing solution to prevent windows from resizing when changing the frame
option
This commit is contained in:
Ulf
2013-06-13 01:06:54 +02:00
parent f3b8ed6aa8
commit 02e945999b
9 changed files with 223 additions and 189 deletions

View File

@@ -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;
}
}
}