Solved

Resizing a Dynamic Form Containing a PictureBox With an Animated Gif

Posted on 2013-05-27
1
422 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 a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now