예제 #1
0
        public AcadWindow2(Autodesk.AutoCAD.Windows.Window win, Dock dockPos)
        {
            _win         = win;
            DockPosition = dockPos;

            var helper = new System.Windows.Interop.WindowInteropHelper(this);

            helper.Owner = win.Handle;

            this.SizeChanged += OnSizeChanged;
        }
예제 #2
0
        private static void ScreenShotToFile(
            Autodesk.AutoCAD.Windows.Window wd,
            int top, int bottom, int left, int right,
            string filename,
            bool clipboard
            )
        {
            Point pt = wd.Location;
            Size  sz = wd.Size;

            pt.X      += left;
            pt.Y      += top;
            sz.Height -= top + bottom;
            sz.Width  -= left + right;

            SaveScreenPortion(pt, sz, filename, clipboard);
        }
예제 #3
0
        /// <summary>
        /// 从当前的编辑区截取图片
        /// </summary>
        /// <param name="wd">cadWindow</param>
        /// <param name="filename">fileName</param>
        /// <param name="top">Top</param>
        /// <param name="bottom">Bottom</param>
        /// <param name="left">Left</param>
        /// <param name="right">Right</param>
        public static void ScreenShotToFile(
            Autodesk.AutoCAD.Windows.Window wd,
            string filename,
            int top,
            int bottom,
            int left,
            int right)
        {
            System.Drawing.Point pt = wd.Location;
            System.Drawing.Size  sz = wd.Size;
            pt.X      += left;
            pt.Y      += top;
            sz.Height -= top + bottom;
            sz.Width  -= left + right;

            // Set the bitmap object to the size of the screen

            Bitmap bmp =
                new Bitmap(sz.Width, sz.Height,
                           PixelFormat.Format32bppArgb);

            using (bmp)
            {
                // Create a graphics object from the bitmap
                using (Graphics gfx = Graphics.FromImage(bmp))
                {
                    // Take a screenshot of our window

                    //MessageBox.Show("x:" + pt.X + "y:" + pt.Y);
                    gfx.CopyFromScreen(
                        pt.X, pt.Y, 0, 0, sz,
                        CopyPixelOperation.SourceCopy
                        );

                    // Save the screenshot to the specified location

                    bmp.Save(filename, ImageFormat.Png);
                }
            }
        }
예제 #4
0
 public KeywordWindow(Autodesk.AutoCAD.Windows.Window win, AcadWindow.Dock dock)
     : base(win, dock)
 {
 }
예제 #5
0
 /// <summary>
 /// 修改图标
 /// </summary>
 /// <param name="fileName">图标路径</param>
 public static void SetIcon(string fileName)
 {
     Autodesk.AutoCAD.Windows.Window MainWindow = Autodesk.AutoCAD.ApplicationServices.Application.MainWindow; MainWindow.Icon = new Icon(fileName);
 }
예제 #6
0
 /// <summary>
 /// 修改标题
 /// </summary>
 /// <param name="title">标题</param>
 public static void SetTitle(string title)
 {
     Autodesk.AutoCAD.Windows.Window MainWindow = Autodesk.AutoCAD.ApplicationServices.Application.MainWindow;
     MainWindow.Text = title;
 }