Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

adorning problems

Closed Thread
 
Thread Tools Display Modes
Old 02-28-2006   #1 (permalink)
damien morton
Guest


 

adorning problems

Hi All,

Im trying to build an Adorner that incorporates a Viewport3D. I seem to
be having a lot of trouble getting the Viewport3D to appear, or even to
acquire a non-zero size.

Once I get the Viewport3D to appear, Im going to want to move it around
following the mouse.

Can anyone point out what I am doing wrong?


public partial class Window1 : Window
{
private Lens _lens;

public Window1()
{
InitializeComponent();
}

private void OnLoaded(object sender, RoutedEventArgs e)
{
Console.WriteLine("OnLoaded");

ScrollContentPresenter scp = VisualUtilities.GetVisualChild(this, 0,
0, 0, 0, 0, 0, 0, 0) as ScrollContentPresenter;

this._lens = new Lens(100, 20, scp);
AdornerLayer layer = AdornerLayer.GetAdornerLayer(scp);
layer.Add(this._lens);

e.Handled = true;
}
}
public class Lens : Adorner
{
private Viewport3D _viewport;

public Lens(double radius, int points, UIElement element) :
base(element)
{
this._element = element;

this._viewport = new Viewport3D();
this._viewport.Camera = new OrthographicCamera(new Point3D(0, 0, 1),
new Vector3D(0, 0, -1), new Vector3D(0, 1, 0),
element.RenderSize.Width);
this._viewport.I****TestVisible = false;
this._viewport.Width = element.RenderSize.Width;
this._viewport.Height = element.RenderSize.Height;

this._viewport.Children.Add(this.CreateLensModel3D(radius, points));

// not sure what exactly is _necessary_ here, but trying everything

this.AddVisualChild(this._viewport);
this.AddLogicalChild(this._viewport); // AddLogicalChild seems to
ensure that _viewport has a Parent

}

protected override int VisualChildrenCount
{
get { return 1; }
}

protected override Visual GetVisualChild(int index)
{
Console.WriteLine("GetVisualChild " + index);
if (index == 0)
return this._viewport;
else
throw new IndexOutOfRangeException();
}
}

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VPC problems over AMD. Internet problems: bad request, error 400 Jay Virtual PC 6 3 Weeks Ago 07:21 PM
2 different vista problems. Memory dump crash and startup repair cannot fix problems Hiera Vista General 4 06-28-2008 02:36 AM
Shrink problems/partition problems HELP TedT Vista performance & maintenance 0 06-21-2008 02:46 AM
Downgrading from 64bit Vista to 32bit, Media Center problems, web page printing problems Chris Lane Vista installation & setup 1 10-13-2007 05:58 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50