 |
|
 |
God bless u
|
|
|
|
 |
|
|
 |
|
 |
Hi,
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.Opaque, true);
this.BackColor = Color.Transparent;
protected override void OnPaintBackground(PaintEventArgs pevent)
{
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x20;
return cp;
}
}
i used above code and in my user control inherited from Picture box.
if i place this user control on my form, except image area remaing area of picturebox is displaying Black color
any one please help me.
Thanks in advance
Vinaya
|
|
|
|
 |
|
 |
hi
tnx for your greate article
now i have tow picturebox and i want to show the first with a low transparency on top of the another one. its mean i want to transparent above picturebox and show every thing that behind of it like the other picturebox .how can i do this?
و این منم زنی تنها در آستانه فصلی سرد...
|
|
|
|
 |
|
 |
Hi Mahboobeh,
Please allow me a few days to check your inquiry.
Regards,
Nildo
|
|
|
|
 |
|
|
 |
|
 |
Dear Goor,
I sent 2 e-mails to you and got no success. I would like to have a little more information about your needs.
Kind Regards,
Nildo
Nildo
modified on Wednesday, April 21, 2010 2:28 PM
|
|
|
|
 |
|
 |
Hi all,
Add the following code to the TranspControl.dll:
protected override void OnMove(EventArgs e)
{
if (this.Parent != null) Parent.Invalidate(this.Bounds, true);
}
At runtime, this made the control be refreshed during a moving.
Nildo
|
|
|
|
 |
|
 |
Hi Nildo,
This control is amazing, but the approach you have shown dosen't seems to work with animated control with opaque background or foreground. I have tried by doing some changes but there is too much of flickering and it dosen't work with double buffering at all.
Please help.
Vaibhav
|
|
|
|
 |
|
 |
Hi, Vaibhav
As mentioned in the article, do not use TranspControl in application that require animated control, unless you are drawing only lines or frames. Filled background or shapes will flick in TranspControl because of the background refreshing (clear and draw). About double buffering, remember you are not painting directly on the control background (it is transparent). For opaque shapes with transparent background try the Circle.dll aproach.
Unfornunately, for a while, TranspControl is dependent of the property CreateParams to get full background transparency.
Nildo
|
|
|
|
 |
|
 |
I need a control whose background should be 20% opaque and not completly transparent. My application has complex UserControl structure which are placed in one panel. Each UserControl can have n-number of child controls/usercontrols inside it and each child can also have child's which is again up to any level. I have kept transparent control on main panel and this is working so far. But if location of any underlying control changes it messes up the UI and I can't afford to draw every control when only one or couple of controls change their location. If I invalidate only transparent control it becomes darker on the control which are not moved.
Is there any solution?
Vaibhav
|
|
|
|
 |
|
 |
Have you added a new Control Style to TranspControl?
Nildo
|
|
|
|
 |
|
 |
Olá,
Estou usando o seu componente sobre um WebBrowser, mas ele nunca fica sobre o WebBrowser, mesmo quando eu chamo o BringToFront(). Você tem alguma idéia do porquê disto?
Componente fantástico, parabéns!
----> For those who do not speak Portuguese --->
Hi,
I am putting your control over a WebBrowser but it never gets on top of it, even when I call TransparentControl.BringToFront(). Do you have any idea of why this is happening?
Great control, congratulations!
|
|
|
|
 |
|
 |
Unfortunately I have no expertise in WebBrowser. It seems you are having the same problem experienced by member 788570. This hapens when use the property CreateParams to make the background transparent. Please see the questions posted by member 788570.
When I have a litlle more time I will investigate this bug. Sorry have not helped you this time.
Nildo
|
|
|
|
 |
|
 |
After executing the application if video is running then transparent control is not display on form.
|
|
|
|
 |
|
 |
Please give details. I'd like to see what is going on.
Nildo
|
|
|
|
 |
|
 |
Hello.
I have the same problem. have a control that received a video preview from a webcam. I have it transparent control on control with black borders, but this control does not appear.
|
|
|
|
 |
|
 |
Hi Federico,
Unfortunately this results if we get transparency by changing the control style with CreateParams. TranspControl is not intended to use in dynamic applications, use the Circle solution instead. Since TranspControl has no background you should repaint your control each cycle your image changes and even so you will get an undesirable result.
If you need to place a semitransparent image over your video image I sugest you to use Photoshop or a video editor.
Hope this can explain your doubt.
Best wishes,
Nildo
|
|
|
|
 |
|
|
 |
|
 |
Yes. It is.
Cheers,
Nildo
Nildo
|
|
|
|
 |
|
 |
I am developing software in c#.net 2008 and displaying video in picture box control. I have pasted transparent control on picturebox. After executing video, transparent control is not display on screen. And also, i have tried to BringToFront() method but no luck.
|
|
|
|
 |
|
 |
Using the property CreateParams in dynamic applications results some inconveniences during runtime. In your example it seems the picture box control runs always over the TranspControl, even you force the z-order. Try with the Circle.dll. I recommend do not use TranspControl for dynamic applications. Thank you for your report.
Nildo
|
|
|
|
 |
|
 |
Thanks Nildo,
How to draw lines in Circle.dll?
|
|
|
|
 |
|
 |
There is a sample:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
namespace Line
{
public class Line : Control
{
private Color brushColor = Color.Transparent;
private Color fillColor = Color.Transparent;
private int xPrev = 0;
private int yPrev = 0;
private float lineThick = 1.0f;
private float rd = 50.0f;
public Line()
{
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
//Set style for double buffering
SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint, true);
//Set the default backcolor
this.BackColor = Color.Transparent;
}
public Color FillColor
{
get
{
return this.fillColor;
}
set
{
this.fillColor = value;
this.Invalidate();
}
}
public float LineThick
{
get
{
return this.lineThick;
}
set
{
this.lineThick = value;
this.Invalidate();
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
RectangleF r = new RectangleF(0.0f, 0.0f, (float)this.Width, (float)this.Height);
float cx = r.Width;
float cy = r.Height;
Pen pen = new Pen(new SolidBrush(this.ForeColor), lineThick);
SolidBrush brush = new SolidBrush(fillColor);
// Creates a path to draw graphics
GraphicsPath path = new GraphicsPath();
// Paint the control
// Add the AddLine method to the path.
PointF[] lineShape = {new PointF(lineThick/2.0f, 0.0f),
new PointF(cx, cy-lineThick/2.0f),
new PointF(cx-lineThick/2.0f, cy),
new PointF(0.0f, lineThick/2.0f),
new PointF(lineThick/2.0f, 0.0f)};
path.AddLines(lineShape);
// Creates the region area for the control painting
this.Region = new Region(path);
//Draw the shape over the region
g.FillRegion(brush, this.Region);
pen.Dispose();
brush.Dispose();
this.Region.Dispose();
path.Dispose();
}
}
}
Nildo
|
|
|
|
 |
|
 |
what about inserting background_image???
Awesome
|
|
|
|
 |