Exemple #1
0
		void GDEF_INIT(GDEF pdef, int bitLBL, Control pWnd, ref Rectangle poff)
		{
			RECT rt = new RECT(pWnd.Bounds);

			//pWnd.GetWindowRect(&rt);

			rt.Offset(-rt.Left, -rt.Top);//(0,0)基準にする
			pdef.rt_cl = rt;
			//---
			rt.Top    += 5;
			rt.Bottom -= 7;
			rt.Left   += 5;
			rt.Right  -= 5;	
			if ((bitLBL & 1) != 0) {
				//X軸にラベル表示
				rt.Bottom -= 8;
				rt.Right  -= 7;
			}
			if ((bitLBL & 2) != 0) {
				//Y軸にラベル表示
				rt.Left += 16;//+7:符号があるとき
				rt.Top  += 1;
			}
			if (poff != null) {
				rt.Top    += poff.Top;
				rt.Bottom += poff.Bottom;
				rt.Left   += poff.Left;
				rt.Right  += poff.Right;
			}
			//---
			pdef.rt_gr = rt;
			//---
			pdef.rt_wid = rt.Width();
			pdef.rt_hei = rt.Height();
			//---
			pdef.bitLBL = bitLBL;
		}
Exemple #2
0
        private void timer_Tick(object sender, EventArgs e)
        {
            PointAPI p;

            GetCursorPos(out p);
            Point pc = new Point(p.X, p.Y);
            //p1 = PointToScreen(p1);
            //Point pc = PointToScreen(p1);
            RECT   rect   = new RECT();
            IntPtr Handle = (WindowFromPoint((IntPtr)pc.X, (IntPtr)pc.Y));

            GetWindowRect(Handle, ref rect);
            curRect = new Rectangle(rect.left, rect.top, rect.Width(), rect.Height());

            timer.Enabled = false;
            // 画一根红线
            ControlPaint.DrawReversibleFrame(curRect, LineColor, FrameStyle.Thick);
            System.Threading.Thread.Sleep(timer.Interval);
            // 擦除刚才所绘制的边框
            ControlPaint.DrawReversibleFrame(curRect, LineColor, FrameStyle.Thick);
            timer.Enabled = true;

            //System.Diagnostics.Debug.Print(curRect.Left.ToString() + "-" + curRect.Right);
        }
Exemple #3
0
        int IShellView.CreateViewWindow([In, MarshalAs(UnmanagedType.Interface)] IShellView psvPrevious,
                                        [In] ref FOLDERSETTINGS pfs, [In, MarshalAs(UnmanagedType.Interface)] IShellBrowser psb, [In]  ref RECT prcView, [In, Out] ref IntPtr phWnd)
        {
            //  Store the shell browser.
            shellBrowser = psb;

            //  Resize the custom view.
            customView.Bounds  = new Rectangle(prcView.left, prcView.top, prcView.Width(), prcView.Height());
            customView.Visible = true;

            //  Set the handle to the handle of the custom view.
            phWnd = customView.Handle;

            //  Set the custom view to be a child of the shell browser.
            IntPtr parentWindowHandle;

            psb.GetWindow(out parentWindowHandle);
            User32.SetParent(phWnd, parentWindowHandle);

            //  TODO: finish this function off.
            return(WinError.S_OK);
        }