![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| 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 | |||