Example #1
0
            internal MyCircle(MyShape parent, System.Windows.Point pt, double radius)
            {
                _pt     = pt;
                _radius = radius;
                this.Render();

                // Add the circle as a child to the shape parent.
                parent.Children.Add(this);
            }
Example #2
0
        internal static IntPtr ApplicationMessageFilter(
            IntPtr hwnd, int message, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            // Handle messages passed to the visual.
            switch (message)
            {
            // Handle the left and right mouse button up messages.
            case WM_LBUTTONUP:
            case WM_RBUTTONUP:
                System.Windows.Point pt = new System.Windows.Point();
                pt.X = (uint)lParam & (uint)0x0000ffff;      // LOWORD = x
                pt.Y = (uint)lParam >> 16;                   // HIWORD = y
                MyShape.OnHitTest(pt, message);
                break;
            }

            return(IntPtr.Zero);
        }
Example #3
0
        public static void CreateShape(IntPtr parentHwnd)
        {
            // Create an instance of the shape.
            MyShape myShape = new MyShape();

            // Determine whether the host container window has been created.
            if (myHwndSource == null)
            {
                // Create the host container window for the visual objects.
                CreateHostHwnd(parentHwnd);

                // Associate the shape with the host container window.
                myHwndSource.RootVisual = myShape;
            }
            else
            {
                // Assign the shape as a child of the root visual.
                ((ContainerVisual)myHwndSource.RootVisual).Children.Add(myShape);
            }
        }
Example #4
0
        public static void CreateShape(IntPtr parentHwnd)
        {
            // Create an instance of the shape.
            MyShape myShape = new MyShape();

            // Determine whether the host container window has been created.
            if (myHwndSource == null)
            {
                // Create the host container window for the visual objects.
                CreateHostHwnd(parentHwnd);

                // Associate the shape with the host container window.
                myHwndSource.RootVisual = myShape;
            }
            else
            {
                // Assign the shape as a child of the root visual.
                ((ContainerVisual)myHwndSource.RootVisual).Children.Add(myShape);
            }
        }
Example #5
0
            internal MyCircle(MyShape parent, System.Windows.Point pt, double radius)
            {
                _pt = pt;
                _radius = radius;
                this.Render();

                // Add the circle as a child to the shape parent.
                parent.Children.Add(this);
            }