Beispiel #1
0
        private bool ImageMouseUp(MouseEventArgs e)
        {
            if (PtInImageToolBar(e.X, e.Y))
            {
                MouseEventArgs vEvent = new MouseEventArgs(e.Button, e.Clicks, e.X - FImageToolBar.Left, e.Y - FImageToolBar.Top, e.Delta);
                FImageToolBar.MouseUp(vEvent);
                return(true);
            }
            else
            //if FImageToolBar.ActiveIndex > 0 then  // 第一个是指针
            {
                HCImageItem vImageItem = FActiveItem as HCImageItem;
                if (HC.PtInRect(HC.Bounds(FActiveItemRect.Left, FActiveItemRect.Top, vImageItem.Width, vImageItem.Height),
                                new POINT(FMouseViewPt.X, FMouseViewPt.Y)))
                {
                    MouseEventArgs vEvent = new MouseEventArgs(e.Button, e.Clicks, FMouseViewPt.X - FActiveItemRect.Left, FMouseViewPt.Y - FActiveItemRect.Top, e.Delta);
                    if (vImageItem.ShapeManager.MouseUp(vEvent))
                    {
                        return(true);
                    }
                }
                else
                {
                    DoImageShapeStructOver(null, e);
                }
            }

            return(false);
        }
Beispiel #2
0
        //
        private bool ImageMouseDown(MouseEventArgs e)
        {
            if (PtInImageToolBar(e.X, e.Y))
            {
                MouseEventArgs vEvent = new MouseEventArgs(e.Button, e.Clicks, e.X - FImageToolBar.Left, e.Y - FImageToolBar.Top, e.Delta);
                FImageToolBar.MouseDown(vEvent);
                if (FImageToolBar.ActiveIndex >= 0)
                {
                    (FActiveItem as HCImageItem).ShapeManager.OperStyle = (HCShapeStyle)FImageToolBar.ActiveControl().Tag;
                }

                return(true);
            }
            else
            {
                HCImageItem vImageItem = FActiveItem as HCImageItem;
                if (HC.PtInRect(HC.Bounds(FActiveItemRect.Left, FActiveItemRect.Top, vImageItem.Width, vImageItem.Height),
                                new POINT(FMouseViewPt.X, FMouseViewPt.Y)))
                {
                    MouseEventArgs vEvent = new MouseEventArgs(e.Button, e.Clicks, FMouseViewPt.X - FActiveItemRect.Left, FMouseViewPt.Y - FActiveItemRect.Top, e.Delta);
                    if (vImageItem.ShapeManager.MouseDown(vEvent))
                    {
                        this.UpdateView(new RECT(FActiveItemRect.Left, FActiveItemRect.Top - FImageToolBar.Height, FActiveItemRect.Right, FActiveItemRect.Bottom));

                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #3
0
        private bool ImageKeyDown(KeyEventArgs e)
        {
            HCImageItem vImageItem = FActiveItem as HCImageItem;

            if (vImageItem.ShapeManager.KeyDown(e))
            {
                this.UpdateView(new RECT(FActiveItemRect.Left, FActiveItemRect.Top - FImageToolBar.Height, FActiveItemRect.Right, FActiveItemRect.Bottom));
                return(true);
            }

            return(false);
        }
Beispiel #4
0
        protected void Paste()
        {
            IDataObject vIData = Clipboard.GetDataObject();

            if (vIData.GetDataPresent(HC.HC_EXT))
            {
                MemoryStream vStream = (MemoryStream)vIData.GetData(HC.HC_EXT);
                try
                {
                    vStream.Position = 0;
                    if (!DoPasteFormatStream(vStream))
                    {
                        return;
                    }

                    InsertLiteStream(vStream);
                }
                finally
                {
                    vStream.Close();
                    vStream.Dispose();
                }
            }
            else
            if (vIData.GetDataPresent(DataFormats.Text))
            {
                FData.InsertText(Clipboard.GetText());
            }
            else
            if (vIData.GetDataPresent(DataFormats.Bitmap))
            {
                Image vImage = (Image)vIData.GetData(typeof(Bitmap));

                HCRichData  vTopData   = FData.GetTopLevelData() as HCRichData;
                HCImageItem vImageItem = new HCImageItem(vTopData);

                vImageItem.Image = new Bitmap(vImage);

                vImageItem.Width  = vImageItem.Image.Width;
                vImageItem.Height = vImageItem.Image.Height;


                vImageItem.RestrainSize(vTopData.Width, vImageItem.Height);

                FData.InsertItem(vImageItem);
            }
        }
Beispiel #5
0
        private bool ImageMouseMove(MouseEventArgs e)
        {
            if (PtInImageToolBar(e.X, e.Y))
            {
                if (FHotToolBar != FImageToolBar)
                {
                    if (FHotToolBar != null)
                    {
                        FHotToolBar.MouseLeave();
                    }

                    FHotToolBar = FImageToolBar;
                    FHotToolBar.MouseEnter();
                    this.Cursor = Cursors.Default;
                }
            }
            else
            if (FHotToolBar == FImageToolBar)
            {
                FImageToolBar.MouseLeave();
                FHotToolBar = null;
            }
            else
            //if FImageToolBar.ActiveIndex > 0 then  // 有效的样式、第一个是指针
            {
                HCImageItem vImageItem = FActiveItem as HCImageItem;
                if (HC.PtInRect(HC.Bounds(FActiveItemRect.Left, FActiveItemRect.Top, vImageItem.Width, vImageItem.Height),
                                new POINT(FMouseViewPt.X, FMouseViewPt.Y)))
                {
                    MouseEventArgs vEvent = new MouseEventArgs(e.Button, e.Clicks, FMouseViewPt.X - FActiveItemRect.Left, FMouseViewPt.Y - FActiveItemRect.Top, e.Delta);
                    if (vImageItem.ShapeManager.MouseMove(vEvent))
                    {
                        this.UpdateView(new RECT(FActiveItemRect.Left, FActiveItemRect.Top - FImageToolBar.Height, FActiveItemRect.Right, FActiveItemRect.Bottom));

                        if (vImageItem.ShapeManager.HotIndex >= 0)
                        {
                            Cursor = vImageItem.ShapeManager[vImageItem.ShapeManager.HotIndex].Cursor;
                        }

                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #6
0
        protected void Paste()
        {
            IDataObject vIData = Clipboard.GetDataObject();

            if (vIData.GetDataPresent(HC.HC_EXT))
            {
                MemoryStream vStream = (MemoryStream)vIData.GetData(HC.HC_EXT);
                try
                {
                    string vFileFormat  = "";
                    ushort vFileVersion = 0;
                    byte   vLan         = 0;

                    vStream.Position = 0;
                    HC._LoadFileFormatAndVersion(vStream, ref vFileFormat, ref vFileVersion, ref vLan);  // 文件格式和版本
                    HCStyle vStyle = new HCStyle();
                    try
                    {
                        vStyle.LoadFromStream(vStream, vFileVersion);
                        this.BeginUpdate();
                        try
                        {
                            FData.InsertStream(vStream, vStyle, vFileVersion);
                        }
                        finally
                        {
                            this.EndUpdate();
                        }
                    }
                    finally
                    {
                        vStyle.Dispose();
                    }
                }
                finally
                {
                    vStream.Close();
                    vStream.Dispose();
                }
            }
            else
            if (vIData.GetDataPresent(DataFormats.Text))
            {
                FData.InsertText(Clipboard.GetText());
            }
            else
            if (vIData.GetDataPresent(DataFormats.Bitmap))
            {
                Image vImage = (Image)vIData.GetData(typeof(Bitmap));

                HCRichData  vTopData   = FData.GetTopLevelData() as HCRichData;
                HCImageItem vImageItem = new HCImageItem(vTopData);

                vImageItem.Image = new Bitmap(vImage);

                vImageItem.Width  = vImageItem.Image.Width;
                vImageItem.Height = vImageItem.Image.Height;


                vImageItem.RestrainSize(vTopData.Width, vImageItem.Height);

                FData.InsertItem(vImageItem);
            }
        }