Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - adorning problems

 
 
Old 02-28-2006   #1 (permalink)
damien morton


 
 

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();
}
}


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Big vista problems need help icon/background/graphics/personalise problems Vista performance & maintenance
laptop start up problems and problems in general General Discussion
Problems starting command prompt on cygwin on vista ultimate, problems not had on Win2k3SP2 Vista General
2 different vista problems. Memory dump crash and startup repair cannot fix problems Vista General
Downgrading from 64bit Vista to 32bit, Media Center problems, web page printing problems Vista installation & setup


Vista Forums 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 Ltd

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