コード例 #1
0
ファイル: MyCircle.cs プロジェクト: zhimaqiao51/docs
            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);
            }
コード例 #2
0
ファイル: MyShape.cs プロジェクト: liuwenye2010/prj_vs2019
            internal MyCircle(MyShape parent, Point pt, double radius)
            {
                Pt      = pt;
                _radius = radius;
                Render();

                // Add the circle as a child to the shape parent.
                parent.Children.Add(this);
            }
コード例 #3
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);
        }
コード例 #4
0
        //<Snippet100>
        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);
            }
        }
コード例 #5
0
ファイル: MyWindow.cs プロジェクト: ClemensT/WPF-Samples
        public static void CreateShape(IntPtr parentHwnd)
        {
            // Create an instance of the shape.
            var 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);
            }
        }
コード例 #6
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 WmLbuttonup:
            case WmRbuttonup:
                var pt = new Point
                {
                    X = (uint)lParam & 0x0000ffff,
                    Y = (uint)lParam >> 16
                };
                // LOWORD = x
                // HIWORD = y
                MyShape.OnHitTest(pt, message);
                break;
            }

            return(IntPtr.Zero);
        }
コード例 #7
0
ファイル: MyShape.cs プロジェクト: ClemensT/WPF-Samples
            internal MyCircle(MyShape parent, Point pt, double radius)
            {
                Pt = pt;
                _radius = radius;
                Render();

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