?
Solved

Resizing a Dynamic Form Containing a PictureBox With an Animated Gif

Posted on 2013-05-27
1
Medium Priority
?
436 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 200 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

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

864 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