473,395 Members | 1,583 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,395 software developers and data experts.

Turn off screen updating while I fill a RichTextBox

I am filling a richtextbox via the AppendText method and it works great.
However, I would like to to off screen updating, add my 50 or so lines to the
richtextbox, and then turn screen updating back on.

How do I do this? SuspendLayout does not do this.

Thanks.
--
Dave B.
May 13 '07 #1
2 6213
Hi Dave,

You can use WM_SETREDRAW message to do this. Refer to following FAQ entry:

#Windows Forms FAQ - Windows Forms
http://msdn2.microsoft.com/en-us/net.../aa497373.aspx
How do I suspend painting a form until all its controls are initialized?

There is not currently a way to do this built into the framework, but
WM_SETREDRAW will do what you're looking for:

[ DllImport( "user32" ) ]
private static extern bool SendMessage( IntPtr hWnd, int msg,
int wParam, int lParam );
private const int WM_SETREDRAW = 0xB;

int paintFrozen;

private bool FreezePainting
{
get { return paintFrozen 0; }
set
{
if ( value && IsHandleCreated && Visible )
if ( 0 == paintFrozen++ )
SendMessage( Handle, WM_SETREDRAW, 0, 0 );

if ( !value )
{
if ( paintFrozen == 0 ) return;
if ( 0 == --paintFrozen )
{
SendMessage( Handle, WM_SETREDRAW, 1, 0 );
Invalidate( true );
}
}
}
}
Hope this helps.
Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 14 '07 #2
Hi Dave,

Does the above suggestion work for you? Please feel free to let me know if
there's anything unclear. Thanks.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 17 '07 #3

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
0
by: AK | last post by:
Hi, I have a medium sized app that I'm transferring to use curses. What happens is very very strange.. I am at my wits' ends. I worked with it all day yesterday and couldn't figure it out....
1
by: Luis Esteban Valencia | last post by:
Hello Everyone, Iam an intermediate ASP.Net programmer and iam facing a challenging task. I have a table in MS-SQL server database called 'Members'. The table has following fields... ...
3
by: Al | last post by:
Hello, How can I turn off auto scrolling in RIchTextBox? Thanks
0
by: genojoe | last post by:
When I an an image to a RichTextBox that is approximately 500K in size, when I type into the RTB during runtime, the screen (image) blinks everytime I type a character. If I copy the same text...
0
by: Terry Olsen | last post by:
The following code works fine in a TextBox for auto-scrolling: If AutoScroll = True Then txtChat.Select(txtChat.Text.Length, 0) txtChat.ScrollToCaret() End If If I set AutoScroll to True...
4
by: Terry | last post by:
I am trying to figure out if there is a way to get a regular asp.net TextBox to fill the screen, both height and width. When I drop a TextBox onto a blank asp.net page and set the height="100%",...
1
by: Speebs | last post by:
Hello, I have a little form that people can fill out to generate CD labels from an RTF template. The template basically contains variables that are replaced by the text typed into the form. ...
1
by: kelvin.koogan | last post by:
I am trying to do an operation where I find and highlight all instances of a string in a RichTextBox. E.g. pMatchesFound = Regex::Matches(pRichTextBox->Text, pStr, options); for (int i = 0; i...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...
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.