![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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(); } } |
![]() |
| 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 |