示例#1
0
        protected override void RefreshScaleTransform()
        {
            MultiPageTransform trans = (MultiPageTransform)this.myTransform;

            intGraphicsUnit = myPages.GraphicsUnit;
            trans.Rate      = GraphicsUnitConvert.GetRate(intGraphicsUnit, System.Drawing.GraphicsUnit.Pixel);

            //float rate = ( float )( 1.0 / this.ClientToViewXRate );
            //trans.Pages = myPages ;
            //trans.Refresh( rate , this.intPageSpacing );
            System.Drawing.Point sp = this.AutoScrollPosition;
            trans.ClearSourceOffset();
            trans.OffsetSource(sp.X, sp.Y, true);


            //			myClientMargins = new System.Drawing.Printing.Margins(
            //				( int ) ( myPages.LeftMargin * rate ),
            //				( int ) ( myPages.RightMargin * rate ) ,
            //				( int ) ( myPages.TopMargin * rate ),
            //				( int ) ( myPages.BottomMargin * rate ));
            //
            //			myClientPageSize = new System.Drawing.Size(
            //				( int) ( myPages.PaperWidth * rate ) ,
            //				( int ) ( myPages.PaperHeight * rate ));
        }
示例#2
0
        /// <summary>
        /// 移动光标到新的光标区域
        /// </summary>
        /// <param name="vLeft">在视图中光标区域的左端位置</param>
        /// <param name="vTop">在视图中光标区域的顶端位置</param>
        /// <param name="vWidth">光标区域宽度</param>
        /// <param name="vHeight">光标区域高度</param>
        /// <returns>移动光标是否造成滚动</returns>
        public bool MoveCaretTo(int vLeft, int vTop, int vWidth, int vHeight)
        {
            if (this.Updating)
            {
                return(false);
            }

            if (ForceShowCaret == false && this.Focused == false)
            {
                if (bolCaretCreated)
                {
                    myCaret.Hide();
                }
                return(false);
            }

            int height = GraphicsUnitConvert.Convert(vHeight, this.GraphicsUnit, System.Drawing.GraphicsUnit.Pixel);

            if (vWidth > 0 && vHeight > 0)
            {
                bolCaretCreated = myCaret.Create(0, vWidth, height);
                if (bolCaretCreated)
                {
                    if (bolMoveCaretWithScroll)
                    {
                        //Modified by wwj 2011-11-24 移除自动判断的滚动条的逻辑 不知道为什么要移除,现在打开看有什么问题 edit by Ukey zhang 2017-11-11-15
                        //this.ScrollToView(vLeft, vTop, vWidth, vHeight);
                    }
                    System.Drawing.Point p = this.ViewPointToClient(vLeft, vTop);
                    myCaret.SetPos(p.X, p.Y);
                    myCaret.Show();
                    if (Imm32.isImmOpen(this.Handle.ToInt32()))
                    {
                        Imm32.SetImmPos(this.Handle.ToInt32(), p.X, p.Y);
                    }
                    myCaretBounds = new System.Drawing.Rectangle(p.X, p.Y, vWidth, height);
                    if (bolMoveCaretWithScroll)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }