Solved

Resizing a Dynamic Form Containing a PictureBox With an Animated Gif

Posted on 2013-05-27
1
424 Views
Last Modified: 2013-05-28
I am using a small 17 x 17 pixel animated gif, which is loaded a picturebox, which is resized and added to a dynamic form's controls.  The code below resides in the Form1_Load event, and at run-time for some reason, the size of the dynamic form not go below (what looks like 200 x 50 pixels).    I am trying to kill all form features that are preventing it from sizing to about 20 x 20 pixels.   The form will take on a width and height of e.g. 300 x 300 pixels if I set the width and height to 300 by 300, respectively.   I have seen an MSDN paper on scaling conditions for forms, however, don't know it it applies.   Is there an autoscaling scale like dpi or fonts that I need to set?  Overall, the form will not size to anything like 5 x 5, 30 x 30, etc.  

        Dim GifForm as New Form
        Dim gifpb As New Picturebox
        gifpb.Image = My.Resources.ajax_loader '(this is a 17 x 17 pixel animated Gif)
        gifpb.SizeMode = PictureBoxSizeMode.AutoSize
        gifpb.Left = 0
        gifpb.Top = 0
        gifpb.Width = 17
        gifpb.Height = 17
        gifpb.BringToFront()
        GifForm.Enabled = True
        GifForm.FormBorderStyle = Windows.Forms.FormBorderStyle.None
        GifForm.AutoSize = True
        GifForm.Dock = DockStyle.Fill
        GifForm.Width = 20
        GifForm.Height = 20
        GifForm.WindowState = FormWindowState.Normal
        GifForm.Controls.Add(gifpb)

Open in new window

0
Comment
Question by:lep1
1 Comment
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 100 total points
ID: 39200394
You say that this code is in Form1_Load?

Your code creates a new form (GifForm as New Form) but does not display it (no call to the Show method). I suspect that what you are seeing on the screen is Form1, not GifForm.

What are you trying to do exactly?
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question