I would like to draw an opaque line on a control in c#.
I tried this with visual basic powerpacks shapecontrol.. but I couldn't find any properties that set opacity.
How do I draw an opaque line ?
Thanks,
I would like to draw an opaque line on a control in c#.
I tried this with visual basic powerpacks shapecontrol.. but I couldn't find any properties that set opacity.
How do I draw an opaque line ?
Thanks,
This code will draw a cross of two half-transparent white lines.
WPF
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300" Background="LightGray">
<Grid>
<Line X1="0" Y1="0" X2="100" Y2="100" Stroke="White" Opacity=".5" StrokeThickness="10" />
<Line X1="0" Y1="100" X2="100" Y2="0" Stroke="White" Opacity=".5" StrokeThickness="10" />
</Grid>
</Window>
Windows.Forms
var pen = new Pen(Color.FromArgb(128, 255, 255, 255), 10);
using (var g = CreateGraphics())
{
g.DrawLine(pen, 0, 0, 100, 100);
g.DrawLine(pen, 0, 100, 100, 0);
}
Thanks for your help, I found another way without using WPF.
C# wnidows form has Opacity property, so