473,811 Members | 3,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1438
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(obj ect sender, System.EventArg s 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.Suspend Layout();
// Keep this constant.
Custom1.Width = ClientRectangle .Width - Custom1.Left -
CustomToRightEd ge;
Custom1.Height = ClientRectangle .Height - Custom1.Top -
CustomToBottomE dge;
// Recalculate and .Value member of the scroll bar so the user does
not get confused.
Custom1.RecalcS crollBar ();
panel1.Width = ClientRectangle .Width - panel1.Left - CustomToRightEd ge
+ 2;
panel1.Height = ClientRectangle .Height - panel1.Top -
CustomToBottomE dge + 2;
leadsControl1.I nvalidate();
leadsControl1.R esumeLayout(tru e); // If false scroll bar does not
move
ResumeLayout(fa lse);
}

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
1469
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 to establish the form names and values. You can only see 11 characters max when modifying the Checked Value and or Initial Value in the properties box. Its crazy! Can anybody recommend a program that has a properties box with entry
6
2309
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 several other objects, I'd like to know how this is handled commonly. Could someone elaborate on this? Another situation is some objects could be shared among several threads. How to handle it commonly?
5
2792
by: Fabri | last post by:
Someone call please tell me why this simple code: ================================================================= <html> <head> <title>Example</title> <style type="text/css"> #msg{ position: absolute; background-color: white;
0
762
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 it a direction, but I can't get it to actually follow that direction for only the desired 5 pixels. Example: the user selected 320 degrees to move the person 5 feet NW
2
976
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 there a way to declare it and set the parameters for each one? like box1.label1.text = asdf, box2.label1.text = text and change the location of each box1. thanks,
2
1559
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 member requires an Object reference". How do I refer to items such as Textbox1.text etc on my main form? -Jerry
2
2492
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
1696
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 in Excel (self taught) where for example I could access a forms textbox using the statement 'frmInput.txtAge.Text'. In my .NET project I have created a form with a textbox but have been unable to access it from a module using the same process....
0
1322
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 display this problem but with different form objects. Any help is greatly appreciated. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/transitional.dtd"> <html> <head> <style type="text/css"> .flat
0
9724
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10394
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10127
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5552
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.