473,406 Members | 2,404 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,406 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 7995
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: 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
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
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...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.