 |
|
 |
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
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!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
 |
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.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hi,
TransparentControl.dll does not support background image because it doesn't paint the background to get the full transparency. When you need a control with background image I sugest to use the normal UserControl component.
Nildo
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I used to do PLC and all that controls systems stuff, then I found C#, and that as that, bye bye PLC ladder logic/PID/ integral what? Proportional Huh, what the...Loss in weight, who.
Sacha Barber- Microsoft Visual C# MVP 2008
- Codeproject MVP 2008
Your best friend is you. I'm my best friend too. We share the same views, and hardly ever argue My Blog : sachabarber.net
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Thanks.
Sacha Barber- Microsoft Visual C# MVP 2008
- Codeproject MVP 2008
Your best friend is you. I'm my best friend too. We share the same views, and hardly ever argue My Blog : sachabarber.net
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
Your title seems to suggest this is only possible with .NET 3.5, but I think it would also work on earlier versions of .NET, correct?
Thanks!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi Jean-Paul,
The code complies to .NET 2.0 as well. Circle.dll not tested with .NET 1.0. TranspControl.dll was written for the fisrt time in .NET 1.0 and it would need additional code.
Regards.
Nildo Soares de Araujo
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi, Seems very good. Its working fine. One more thing here is how we can make a whole window 50% transparent and all the controls on this window nontransparent. Please take a try on this and lemme know any results.
Will appreciate your efforts.
regards Vikas Maan
Vikas Maan Tektronix India
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi Vikas,
I guess there is an article published in this site that refers to your question. I am not sure if it will satisfy your needs. By changing the windows Form.Opacity to semi transparent, everything inside will be semi-transparent. Programming in C# is a hobby for me, for while. I will take this as a challenge for myself and if you do not find a solution in the next few days, please let me know.
Nildo Soares de Araujo
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
 |