Click here to Skip to main content
16,005,125 members
Home / Discussions / C#
   

C#

 
AnswerRe: Partial opacity for C# forms - is it possible? Pin
PIEBALDconsult23-Aug-08 17:27
mvePIEBALDconsult23-Aug-08 17:27 
GeneralRe: Partial opacity for C# forms - is it possible? Pin
krukid26-Aug-08 12:01
krukid26-Aug-08 12:01 
AnswerRe: Partial opacity for C# forms - is it possible? Pin
Paul Conrad23-Aug-08 18:24
professionalPaul Conrad23-Aug-08 18:24 
GeneralRe: Partial opacity for C# forms - is it possible? Pin
krukid26-Aug-08 12:08
krukid26-Aug-08 12:08 
AnswerRe: Partial opacity for C# forms - is it possible? Pin
Jammer23-Aug-08 22:05
Jammer23-Aug-08 22:05 
GeneralRe: Partial opacity for C# forms - is it possible? Pin
krukid26-Aug-08 12:11
krukid26-Aug-08 12:11 
GeneralRe: Partial opacity for C# forms - is it possible? Pin
Jammer27-Aug-08 2:48
Jammer27-Aug-08 2:48 
GeneralRe: Partial opacity for C# forms - is it possible? [modified] Pin
krukid28-Aug-08 12:25
krukid28-Aug-08 12:25 
Neat. Looks like there's a whole lot of graphical capabilities - just what I need Smile | :)

Managed to combine semi-opaque and solid shapes on the form in no time, though the code isn't at its pretiest so far due to my hacking and chopping around.
I have to admit, WPF does seem rather confusing - even after a couple of hours.

Anyway, cutting out the essentials, looks something like that:

XAML:
<Window x:Class="WpfPartialOpacity.TestWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="Test Window" Height="300" Width="300"
        AllowsTransparency="True" Background="Transparent" WindowStyle="None">

    <Grid Opacity="0.3" Background="Gray">
    </Grid>

</Window>

C#
namespace WpfPartialOpacity
{
    /// <summary>
    /// Interaction logic for TestWindow.xaml
    /// </summary>
    public partial class TestWindow : Window
    {
        public TestWindow()
        {
            InitializeComponent();
        }

        protected override void OnRender(DrawingContext context)
        {
            base.OnRender(context);

            Rect rect = new Rect(0, 0, Width, Height);

            Pen pen = new Pen(Brushes.Black, 50d);
            context.DrawRectangle(Brushes.Transparent, pen, rect);
        }

    }
}

The run:
http://lh3.ggpht.com/krukid/SLcqJ82UVgI/AAAAAAAAABU/41HSDiQEHqs/opaq_gfx_real.PNG?imgmax=720[^]

Any guidelines for the WPF n00b are welcome Smile | :)

Huge thanks for the hints!

modified on Thursday, August 28, 2008 6:56 PM

GeneralRe: Partial opacity for C# forms - is it possible? Pin
Jammer28-Aug-08 12:53
Jammer28-Aug-08 12:53 
GeneralRe: Partial opacity for C# forms - is it possible? Pin
krukid28-Aug-08 13:01
krukid28-Aug-08 13:01 
GeneralRe: Partial opacity for C# forms - is it possible? Pin
Jammer28-Aug-08 14:05
Jammer28-Aug-08 14:05 
AnswerRe: Partial opacity for C# forms - is it possible? Pin
chaiguy133725-Aug-08 15:35
chaiguy133725-Aug-08 15:35 
GeneralRe: Partial opacity for C# forms - is it possible? Pin
krukid26-Aug-08 12:30
krukid26-Aug-08 12:30 
QuestionUsing files that are located under the project? Pin
tkrn23-Aug-08 12:24
tkrn23-Aug-08 12:24 
AnswerRe: Using files that are located under the project? Pin
Dr. Emmett Brown23-Aug-08 12:59
Dr. Emmett Brown23-Aug-08 12:59 
GeneralRe: Using files that are located under the project? [modified] Pin
#realJSOP25-Aug-08 2:54
professional#realJSOP25-Aug-08 2:54 
GeneralRe: Using files that are located under the project? Pin
chaiguy133725-Aug-08 15:39
chaiguy133725-Aug-08 15:39 
GeneralRe: Using files that are located under the project? Pin
#realJSOP26-Aug-08 2:51
professional#realJSOP26-Aug-08 2:51 
GeneralRe: Using files that are located under the project? Pin
chaiguy133726-Aug-08 4:39
chaiguy133726-Aug-08 4:39 
GeneralRe: Using files that are located under the project? Pin
chaiguy133725-Aug-08 15:40
chaiguy133725-Aug-08 15:40 
AnswerRe: Using files that are located under the project? Pin
#realJSOP25-Aug-08 2:55
professional#realJSOP25-Aug-08 2:55 
Question.net application without frame Pin
help as an alias23-Aug-08 10:55
help as an alias23-Aug-08 10:55 
AnswerRe: .net application without frame Pin
zafersavas23-Aug-08 11:10
zafersavas23-Aug-08 11:10 
AnswerRe: .net application without frame Pin
lisan_al_ghaib23-Aug-08 12:19
lisan_al_ghaib23-Aug-08 12:19 
AnswerRe: .net application without frame Pin
Bert delaVega23-Aug-08 12:46
Bert delaVega23-Aug-08 12:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.