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

How to create a duble buffer transparent control

HI,

I create a custom transparent control, set the style is
ControlStyles.DoubleBuffer, It display black background. How
to create a double buffer transparent control?
Nov 16 '05 #1
3 7989
Hi,

To create a double buffered control the styles that you need to turned on
are

SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint, true);

All those styles are necesery for double buffering to work and it works for
transparent controls as well.

If you still have ptoblems I'd suggest to post some code(preffered) or
explain how you create that transparent conrol. The problem could be there.

--

Stoitcho Goutsev (100) [C# MVP]
"°Ë´óɽÈË" <zh**********@hotmail.com> wrote in message
news:OY**************@tk2msftngp13.phx.gbl...
HI,

I create a custom transparent control, set the style is
ControlStyles.DoubleBuffer, It display black background. How
to create a double buffer transparent control?

Nov 16 '05 #2
Thank you! The code is:

public class TransControl : System.Windows.Forms.Control {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public TransControl() {
// This call is required by the Windows.Forms Form Designer.
base.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.StandardClick |
ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);

}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing ) {
if( disposing ) {
}
base.Dispose( disposing );
}

protected override void OnPaint(PaintEventArgs e) {
base.OnPaint (e);
}

protected override void OnPaintBackground(PaintEventArgs pevent) {
//do not allow the background to be painted
}
}

"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:ON*************@tk2msftngp13.phx.gbl...
Hi,

To create a double buffered control the styles that you need to turned on
are

SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);

All those styles are necesery for double buffering to work and it works for transparent controls as well.

If you still have ptoblems I'd suggest to post some code(preffered) or
explain how you create that transparent conrol. The problem could be there.
--

Stoitcho Goutsev (100) [C# MVP]
"°Ë´óɽÈË" <zh**********@hotmail.com> wrote in message
news:OY**************@tk2msftngp13.phx.gbl...
HI,

I create a custom transparent control, set the style is
ControlStyles.DoubleBuffer, It display black background. How
to create a double buffer transparent control?


Nov 16 '05 #3
Hi °Ë´óɽÈË,

On my second thought you can't use double buffering with transparent
controls unless you don't do your own double buffering..
--

Stoitcho Goutsev (100) [C# MVP]
"°Ë´óɽÈË" <zh**********@hotmail.com> wrote in message
news:Ok****************@TK2MSFTNGP12.phx.gbl...
Thank you! The code is:

public class TransControl : System.Windows.Forms.Control {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public TransControl() {
// This call is required by the Windows.Forms Form Designer.
base.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.StandardClick | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);

}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing ) {
if( disposing ) {
}
base.Dispose( disposing );
}

protected override void OnPaint(PaintEventArgs e) {
base.OnPaint (e);
}

protected override void OnPaintBackground(PaintEventArgs pevent) {
//do not allow the background to be painted
}
}

"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:ON*************@tk2msftngp13.phx.gbl...
Hi,

To create a double buffered control the styles that you need to turned on are

SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint, true);

All those styles are necesery for double buffering to work and it works

for
transparent controls as well.

If you still have ptoblems I'd suggest to post some code(preffered) or
explain how you create that transparent conrol. The problem could be

there.

--

Stoitcho Goutsev (100) [C# MVP]
"°Ë´óɽÈË" <zh**********@hotmail.com> wrote in message
news:OY**************@tk2msftngp13.phx.gbl...
HI,

I create a custom transparent control, set the style is
ControlStyles.DoubleBuffer, It display black background. How
to create a double buffer transparent control?



Nov 16 '05 #4

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

Similar topics

5
by: 2003et | last post by:
How To Create Transparent Windows Controls? Thanks
0
by: °Ë´óɽÈË | last post by:
HI, I create a custom transparent control, set the style is ControlStyles.DoubleBuffer, It display black background. How to create a double buffer transparent control? The ralative code is:...
1
by: Efkas | last post by:
My application have some level : 1. MyButton class with Label inheritance 2. MyComponent as User Control loading and positionning some of MyButtons 3. MyApp loading and positionning MyComponent ...
3
by: Steve Koon | last post by:
Any thoughts on getting this project to work or suggesting another method would be appreciated. Steve ========================================== Project: A Windows Form which acts as a...
4
by: jcrouse | last post by:
I am using the following code to move a label on a form at runtime: If myMousedown = lblP1JoyRight.Name Then If lblP1JoyRight.BackColor.Equals(Color.Transparent) Then bTransCk = True ...
4
by: ray well | last post by:
in my app i need to make a RichTextbox control transparent. i need it to be a like a pane of glass lying on a sheet of paper, where u can see everything on the sheet of paper not covered by text...
3
by: Ananas | last post by:
Hi, I have created a custom control. It's a rectangle with transparent background. It's possible to see the container through the control. But when controls intersect one another then it's not...
3
by: 100grand | last post by:
Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price...
9
by: pek | last post by:
Here is what I want: I have an image, let's say a JPEG 800x600... I want to create a transparent 128x128 PNG image and then resize the 800x600 to fit in the center of my transparent 128x128 PNG.....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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:
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
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...

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.