Windows Vista Beta | WinVistaBeta.com - Message | WCF - Simple rendering doesn't work

July 04, 2008  
Subject: WCF - Simple rendering doesn't work
Group: microsoft.public.windows.developer.winfx.sdk
Date: 11/27/2006 9:32:58 AM
From: "Pradeep" [Email Address Protection]

Hi,

I just created a simple WCF application and tried to override OnRender
method:

protected override void OnRender(DrawingContext drawingContext) {

base.OnRender(drawingContext);

FormattedText ft = new FormattedText("Hello World",

System.Globalization.CultureInfo.CurrentUICulture,
FlowDirection.LeftToRight,

new Typeface("Arial"), 10.0, Brushes.Black);

drawingContext.DrawText(ft, new Point(10, 10));

}

However, I don't see anything being drawn on the screen.

Am I missing something?

Thank you in advance for your help.

Pradeep


Back
Subject: Re: WCF - Simple rendering doesn't work
Group: microsoft.public.windows.developer.winfx.sdk
Date: 12/17/2006 10:19:12 AM
From: "J" [Email Address Protection]

Hello,

If you're trying to OnRender a Window, wel... this is a little
different than a FrameworkElement (from wich the OnRender is inherited)
and elements in WPF are more than different from the Winforms approach
( I think you are trying to make an analogy with OnPaint). This is
because of WPF architecture. You should check out this MSDN article
http://msdn2.microsoft.com/en-us/library/ms748373.aspx
it's very detailed about the differences between immediate mode graphic
systems (Win32) and retained mode graphic systems (WPF).

If you're making a custom control, then I've just implemented it and it
works fine.

Pradeep wrote:
> Hi,
>
> I just created a simple WCF application and tried to override OnRender
> method:
>
> protected override void OnRender(DrawingContext drawingContext) {
>
> base.OnRender(drawingContext);
>
> FormattedText ft = new FormattedText("Hello World",
>
> System.Globalization.CultureInfo.CurrentUICulture,
> FlowDirection.LeftToRight,
>
> new Typeface("Arial"), 10.0, Brushes.Black);
>
> drawingContext.DrawText(ft, new Point(10, 10));
>
> }
>
> However, I don't see anything being drawn on the screen.
>
> Am I missing something?
>
> Thank you in advance for your help.
>
> Pradeep


Back