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

Avoid Repaint

Hi,
I have a problem with Repaint my control. At first my control Create correctly. But with every changes like move scroll or anythings else my contrlo will be repaint. How can I avoid repainting in c#

it's my Event ONPaint :

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;

if (_BorderStyle == BorderStyle.Fixed3D)
{
e.Graphics.DrawRectangle(SystemPens.GradientActive Caption, ClientRectangle.Left,
ClientRectangle.Top, ClientRectangle.Width - 1, ClientRectangle.Height - 1);
}
else if (_BorderStyle == BorderStyle.FixedSingle)
{
e.Graphics.DrawRectangle(SystemPens.WindowText, ClientRectangle.Left,
ClientRectangle.Top, ClientRectangle.Width - 1, ClientRectangle.Height - 1);
}

if (Text != "None" && _bayStructure.Cells.Count > 0)
{
RestartLabels();
foreach (KeyValuePair<string, Rectangle> cell in _bayStructure.Cells)
{
DrawCell(e.Graphics, cell, Focused &&
cell.Key == SelectedItem.Key ? Status.Selected : Status.None);
DrawTier(e.Graphics, cell);

if (cell.Value.Top > _bayStructure.Floor)
{
DrawFooter(e.Graphics, format, cell);
}
else
{
DrawHeader(e.Graphics, format, cell);
}
}
if (_bayStructure.EnforceZero)
{
if (_bayStructure.DeckSize % 2 == 0)
{
DrawHeader(e.Graphics, format);
}
if (_bayStructure.HatchSize % 2 == 0)
{
DrawFooter(e.Graphics, format);
}
}
e.Graphics.DrawRectangle(SystemPens.WindowText, _bayStructure.CoverRectangle);
e.Graphics.DrawString(Text, Font, SystemBrushes.WindowText, ClientRectangle.Width / 2,
_bayStructure.PlanRectangle.Y + _bayStructure.PlanRectangle.Height +
(_PlanFooter && _foot_titles.Count > 0 ? 20 : 6), format);
}
else
{
e.Graphics.DrawString("NONE", Font, SystemBrushes.WindowText,
ClientRectangle.Width / 2, 20, format);
}
}

Please help me to resolve this Problem. Please MAil me if you have any reply
Dec 15 '07 #1
0 1123

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Ike | last post by:
I changing the size of frames dynamically in a page (I am restricted in that I cannot perform a reload of the content of any of the frames). In MSIE, when I resize the frames, thinks repaint...
2
by: Joe A | last post by:
I'm using Access 2002 on Windows XP PC, 500 megs ram, Front end/back end app. I have a simple form that draws a thermometer to indicate progress of code that is running. The thermometer form...
4
by: Bob | last post by:
Trying to repaint a form named fcon using a new filter: 'Repaint the form with the new data Forms!fcon.FilterOn = False Forms!fcon.Filter = "RecNo = " & currecno & " AND Currentvalue = -1"...
4
by: MLH | last post by:
Setting form's Picture property to another file from within VBA doesn't repaint the form with new bitmap - for instance... Me.Picture = "c:\pics\MyNewPic.jpg" I tried Me.Repaint afterward,...
2
by: aaron.kempf | last post by:
hey guys i have an ETL winform in VB 2005 and it's like-- off in la-la land. i know it's doing things-- it's happily crunching away. but i'm confused about what i need to do to make the main...
7
by: Paul | last post by:
I have a VB.NET form with a DataGrid. When I toggle to Excel (for example) and then back to my application the repaint of the DataGrid is really slow. You can see the repainting happening. When...
16
by: Richard Maher | last post by:
Hi, I have this Applet-hosted Socket connection to my server and in an ONevent/function I am retrieving all these lovely rows from the server and inserting them into the Select-List. (The on...
0
by: philaphan80 | last post by:
Is there a way to force the Visual Studio IDE (Page Control at design- time) to refresh / repaint itself upon drag & drop of *any* item from the toolbox? Perhaps a method I need to override within...
0
by: milkay | last post by:
<I have code that uses 2 images> the program creates a window and then when u press play, it removes all components in the container. then, i add a NewPanel object. i add mouse listeners and all...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...
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
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,...
0
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...

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.