private void createPreview()
{
int height = 0; int width = 0;
pictureBoxTextures.Dock = DockStyle.Fill;
height = pictureBoxTextures.Height;
width = pictureBoxTextures.Width;
writeDDS(Application.StartupPath + "\\temp.dds", null);
FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_DDS;
System.Drawing.Bitmap image = FreeImage.LoadBitmap(Application.StartupPath + "\\temp.dds", FREE_IMAGE_LOAD_FLAGS.DEFAULT, ref format);
if (image.Height <= height && image.Width <= width) {
pictureBoxTextures.Dock = DockStyle.None;
pictureBoxTextures.Width = image.Width;
pictureBoxTextures.Height = image.Height;
}
pictureBoxTextures.Image = image;
}