473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Moving form objects around

I need to be able to move a few form abouts around after a event occurs
but when I do this it causes massive flickering is there any way to
reduce this?

Dec 8 '05 #1
6 1419
Hi

Checkout the SuspendLayout and ResumeLayout methods.

Also, what event are you talking about? It really depends how often you
want your form to draw. Every pixel of the movement? Only when it gets
to its destination?

Cheers,
Steven Nagy

Dec 8 '05 #2
Thanks for the suggestion but I am still seeing the flickering. Its
button that the user clicks that causes the form layout to require a
change.

Dec 8 '05 #3
Stick your code on here for the button event (just the important stuff)
and also try to answer some of my other questions. We'll get you
sorted!

Dec 8 '05 #4
private void Form_Resize(object sender, System.EventArgs e)
{
SuspendLayout();
// Panel1, and Custom1 are aligned top left as well.
// Panel1 surrounds Custom1 + 1 Pix this is implied below.
// Custom 1 uses GDI+ and has a Scroll bar that may or may not be
visible on the
// right side
// CustomTo*Edge calculated at load time distance from the * to the
Edge of the form.
Custom1.SuspendLayout();
// Keep this constant.
Custom1.Width = ClientRectangle.Width - Custom1.Left -
CustomToRightEdge;
Custom1.Height = ClientRectangle.Height - Custom1.Top -
CustomToBottomEdge;
// Recalculate and .Value member of the scroll bar so the user does
not get confused.
Custom1.RecalcScrollBar ();
panel1.Width = ClientRectangle.Width - panel1.Left - CustomToRightEdge
+ 2;
panel1.Height = ClientRectangle.Height - panel1.Top -
CustomToBottomEdge + 2;
leadsControl1.Invalidate();
leadsControl1.ResumeLayout(true); // If false scroll bar does not
move
ResumeLayout(false);
}

There is also a Custom control that is docked to the left side but it
does not flicker. And a label1 that is aligned to Top, Left that
requires no more complex logic, again it does not flicker. Flickering
is most apparent when resizing along the left edge of the Form.

It is possible to collapse panel1 and custom1 into one control, but it
would require calculating where the scroll bar is. The panel simply
draws a black box around custom1. I have also tried the WM_SETREDRAW
workaround however there is bleeding from what is behind the form while
the user is resizing, but the flicker is gone.

Dec 9 '05 #5
I just figured out that most of the logic above save the recalc scroll
bar and invalidate can be avoided by simply aligning to all edges
however this does not solve the problem of flickering. But it helped

Dec 9 '05 #6
Whats generally happening in the RecalcScrollBar method? Are you also
invalidating the control in there?

Dec 11 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Scott_From_PA | last post by:
I have a love hate thing going with Dreamweaver! One of the things I absolutely hate is the properties box when modifying form objects. Lets say you lay out a form in a table and it comes time...
6
by: Garma | last post by:
According to what I have learnt so far, instantiating global objects should be the last resort. Is there any reasons why so? Sometimes some objects or their pointers have to be shared among...
5
by: Fabri | last post by:
Someone call please tell me why this simple code: ================================================================= <html> <head> <title>Example</title> <style type="text/css"> #msg{...
0
by: Ben Hoffman | last post by:
I'm trying to make a simple function that plots a person on a grid (the form) and then moves them 5 feet (5 pixels) in the desired direction (degree). I can make the object (my person) and give...
2
by: matt | last post by:
is there a way to reuse form objects like you would code in a class? Say i havea groupbox with severl things in it, and i want to display this group box and components 5 times on the screen, is...
2
by: Jerry Spence1 | last post by:
One way of passing data to a thread is to encapsulate the thread inside a class. However, I can't refer to my main form objects from within the class/thread as it says "Reference to a non-shared...
2
by: Lady Di | last post by:
Hi can anyone tell me why do form objects in a web page require their own unique name? Thanks guys
2
by: WestAussie | last post by:
Hello This is my first attempt at using VB .NET, and I'm having some trouble identifying the correct means by which to access a form using a procedure stored within a module. I've been using VBA...
0
by: ineuw | last post by:
I am trying to display form fields with flush borders and eliminate the sunken effect. This works fine for text fields, but only partially for select boxes, or file inputs. IE6 and Firefox both...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.