?
Solved

Resizing a Dynamic Form Containing a PictureBox With an Animated Gif

Posted on 2013-05-27
1
Medium Priority
?
428 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

752 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