Solved

Resizing a Dynamic Form Containing a PictureBox With an Animated Gif

Posted on 2013-05-27
1
421 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

22 Experts available now in Live!

Get 1:1 Help Now