示例#1
0
        // 当文档尺寸和文档原点改变后,更新卷滚条等等设施状态,以便文档可见
        void AfterDocumentChanged(ScrollBarMember member)
        {
            if (member == ScrollBarMember.Both ||
                member == ScrollBarMember.Horz)
            {
                this.m_lContentWidth = this.m_nCellWidth * 16 + (long)this.m_nLineTitleWidth + (long)this.m_nCommentWidth;
            }

            if (member == ScrollBarMember.Both ||
                member == ScrollBarMember.Vert)
            {
                this.m_lContentHeight = this.m_nLineHeight * this.LineCount;
            }

            SetScrollBars(member);
        }
示例#2
0
		// 当文档尺寸和文档原点改变后,
		// 更新卷滚条,小edit控件 等设施状态,和使文档某区域失效以便文档可见
		// parameters:
		//		scrollBarMember	卷滚条枚举值
		//		iRect	失效区域 当为null,则不失效,如bAll等于true则全部区域
		internal void AfterDocumentChanged(ScrollBarMember scrollBarMember,
			InvalidateRect iRect)
		{
			// 设小edit控件
			this.SetEditPos(false); // 2008/11/26 changed 单纯改变文档尺寸,不应变动小edit的focus特性。也就是说,原来如果没有focus,现在也应没有

			// 设卷滚条信息
			this.SetScrollBars(scrollBarMember);

			// 失效区域
			if (iRect != null)
			{
				if (iRect.bAll == true)
					this.Invalidate();
				else
					this.Invalidate(iRect.rect);
			}
		}
示例#3
0
		// 设卷滚条
		// parameter:
		//		member	
		private void SetScrollBars(ScrollBarMember member)
		{
			if (member == ScrollBarMember.Horz
				|| member == ScrollBarMember.Both) 
			{

				// 水平方向
				API.ScrollInfoStruct si = new API.ScrollInfoStruct();

				si.cbSize = Marshal.SizeOf(si);
				si.fMask = API.SIF_RANGE | API.SIF_POS | API.SIF_PAGE;
				si.nMin = 0;
				si.nMax = this.DocumentWidth;
				si.nPage = this.ClientWidth;
				si.nPos = - this.DocumentOrgX;
				API.SetScrollInfo(this.Handle, API.SB_HORZ, ref si, true);
			}


			if (member == ScrollBarMember.Vert
				|| member == ScrollBarMember.Both) 
			{
				// 垂直方向
				API.ScrollInfoStruct si = new API.ScrollInfoStruct();

				si.cbSize = Marshal.SizeOf(si);
				si.fMask = API.SIF_RANGE | API.SIF_POS | API.SIF_PAGE;
				si.nMin = 0;
				si.nMax = this.DocumentHeight;
				si.nPage = this.ClientHeight;
				si.nPos = -this.DocumentOrgY;
				API.SetScrollInfo(this.Handle, API.SB_VERT, ref si, true);
			}
		}
示例#4
0
        void SetScrollBars(ScrollBarMember member)
        {
            nNestedSetScrollBars++;


            try
            {
                int nClientWidth  = this.ClientSize.Width;
                int nClientHeight = this.ClientSize.Height;

                // 文档尺寸
                long lDocumentWidth  = DocumentWidth;
                long lDocumentHeight = DocumentHeight;

                long lWindowOrgX = this.m_lWindowOrgX;
                long lWindowOrgY = this.m_lWindowOrgY;

                if (member == ScrollBarMember.Horz ||
                    member == ScrollBarMember.Both)
                {
                    if (TooLarge(lDocumentWidth) == true)
                    {
                        this.m_h_ratio = (double)(Int16.MaxValue - 1) / (double)lDocumentWidth;

                        lDocumentWidth = (long)((double)lDocumentWidth * m_h_ratio);
                        nClientWidth   = (int)((double)nClientWidth * m_h_ratio);
                        lWindowOrgX    = (long)((double)lWindowOrgX * m_h_ratio);
                    }
                    else
                    {
                        this.m_h_ratio = 1.0F;
                    }

                    // 水平方向
                    API.ScrollInfoStruct si = new API.ScrollInfoStruct();

                    si.cbSize = Marshal.SizeOf(si);
                    si.fMask  = API.SIF_RANGE | API.SIF_POS | API.SIF_PAGE;
                    si.nMin   = 0;
                    si.nMax   = (int)lDocumentWidth;
                    si.nPage  = nClientWidth;
                    si.nPos   = -(int)lWindowOrgX;
                    API.SetScrollInfo(this.Handle, API.SB_HORZ, ref si, true);
                }


                if (member == ScrollBarMember.Vert ||
                    member == ScrollBarMember.Both)
                {
                    if (TooLarge(lDocumentHeight) == true)
                    {
                        this.m_v_ratio = (double)(Int16.MaxValue - 1) / (double)lDocumentHeight;

                        lDocumentHeight = (long)((double)lDocumentHeight * m_v_ratio);
                        nClientHeight   = (int)((double)nClientHeight * m_v_ratio);
                        lWindowOrgY     = (long)((double)lWindowOrgY * m_v_ratio);
                    }
                    else
                    {
                        this.m_v_ratio = 1.0F;
                    }

                    // 垂直方向
                    API.ScrollInfoStruct si = new API.ScrollInfoStruct();

                    si.cbSize = Marshal.SizeOf(si);
                    si.fMask  = API.SIF_RANGE | API.SIF_POS | API.SIF_PAGE;
                    si.nMin   = 0;
                    si.nMax   = (int)lDocumentHeight;
                    si.nPage  = nClientHeight;
                    si.nPos   = -(int)lWindowOrgY;
                    // Debug.Assert(si.nPos != 0, "");
                    API.SetScrollInfo(this.Handle, API.SB_VERT, ref si, true);
                }
            }
            finally
            {
                nNestedSetScrollBars--;
            }
        }
示例#5
0
        void SetScrollBars(ScrollBarMember member)
        {

            nNestedSetScrollBars++;


            try
            {
                int nClientWidth = this.ClientSize.Width;
                int nClientHeight = this.ClientSize.Height;

                // 文档尺寸
                long lDocumentWidth = DocumentWidth;
                long lDocumentHeight = DocumentHeight;

                long lWindowOrgX = this.m_lWindowOrgX;
                long lWindowOrgY = this.m_lWindowOrgY;

                if (member == ScrollBarMember.Horz
                    || member == ScrollBarMember.Both)
                {

                    if (TooLarge(lDocumentWidth) == true)
                    {
                        this.m_h_ratio = (double)(Int16.MaxValue - 1) / (double)lDocumentWidth;

                        lDocumentWidth = (long)((double)lDocumentWidth * m_h_ratio);
                        nClientWidth = (int)((double)nClientWidth * m_h_ratio);
                        lWindowOrgX = (long)((double)lWindowOrgX * m_h_ratio);
                    }
                    else
                        this.m_h_ratio = 1.0F;

                    // 水平方向
                    API.ScrollInfoStruct si = new API.ScrollInfoStruct();

                    si.cbSize = Marshal.SizeOf(si);
                    si.fMask = API.SIF_RANGE | API.SIF_POS | API.SIF_PAGE;
                    si.nMin = 0;
                    si.nMax = (int)lDocumentWidth;
                    si.nPage = nClientWidth;
                    si.nPos = -(int)lWindowOrgX;
                    API.SetScrollInfo(this.Handle, API.SB_HORZ, ref si, true);
                }


                if (member == ScrollBarMember.Vert
                    || member == ScrollBarMember.Both)
                {
                    if (TooLarge(lDocumentHeight) == true)
                    {
                        this.m_v_ratio = (double)(Int16.MaxValue - 1) / (double)lDocumentHeight;

                        lDocumentHeight = (long)((double)lDocumentHeight * m_v_ratio);
                        nClientHeight = (int)((double)nClientHeight * m_v_ratio);
                        lWindowOrgY = (long)((double)lWindowOrgY * m_v_ratio);

                    }
                    else
                        this.m_v_ratio = 1.0F;

                    // 垂直方向
                    API.ScrollInfoStruct si = new API.ScrollInfoStruct();

                    si.cbSize = Marshal.SizeOf(si);
                    si.fMask = API.SIF_RANGE | API.SIF_POS | API.SIF_PAGE;
                    si.nMin = 0;
                    si.nMax = (int)lDocumentHeight;
                    si.nPage = nClientHeight;
                    si.nPos = -(int)lWindowOrgY;
                    // Debug.Assert(si.nPos != 0, "");
                    API.SetScrollInfo(this.Handle, API.SB_VERT, ref si, true);
                }

            }
            finally
            {
                nNestedSetScrollBars--;
            }
        }
示例#6
0
        // 当文档尺寸和文档原点改变后,更新卷滚条等等设施状态,以便文档可见
        void AfterDocumentChanged(ScrollBarMember member)
        {
            if (member == ScrollBarMember.Both
                || member == ScrollBarMember.Horz)
                this.m_lContentWidth = this.m_nCellWidth * 16 + (long)this.m_nLineTitleWidth + (long)this.m_nCommentWidth;

            if (member == ScrollBarMember.Both
               || member == ScrollBarMember.Vert)
                this.m_lContentHeight = this.m_nLineHeight * this.LineCount; 

            SetScrollBars(member);
        }
示例#7
0
		// 设卷滚条
		void SetScrollBars(ScrollBarMember member)
		{
			if (bAutoSize == true) 
			{
				API.ShowScrollBar(this.Handle,
					API.SB_HORZ,
					false);
				API.ShowScrollBar(this.Handle,
					API.SB_VERT,
					false);
				return;
			}

			nClientWidth = this.ClientSize.Width;
			nClientHeight = this.ClientSize.Height;

			if (member == ScrollBarMember.Horz
				|| member == ScrollBarMember.Both) 
			{
				// 水平方向
				API.ScrollInfoStruct si = new API.ScrollInfoStruct();
				si.cbSize = Marshal.SizeOf(si);
				si.fMask = API.SIF_RANGE | API.SIF_POS | API.SIF_PAGE;
				si.nMin = 0;
				si.nMax = DocumentWidth ;
				si.nPage = nClientWidth;
				si.nPos = -nDocumentOrgX;
				API.SetScrollInfo(this.Handle, API.SB_HORZ, ref si, true);
			}


			if (member == ScrollBarMember.Vert
				|| member == ScrollBarMember.Both) 
			{
				// 垂直方向
				API.ScrollInfoStruct si = new API.ScrollInfoStruct();
				si.cbSize = Marshal.SizeOf(si);
				si.fMask = API.SIF_RANGE | API.SIF_POS | API.SIF_PAGE;
				si.nMin = 0;
				si.nMax = DocumentHeight ;
				si.nPage = nClientHeight;
				si.nPos = -nDocumentOrgY;
				API.SetScrollInfo(this.Handle, API.SB_VERT, ref si, true);
			}
		}
示例#8
0
		// 文档尺寸发生变化
		internal void AfterDocumentChanged(ScrollBarMember member)
		{
			if (bAutoSize == true) 
			{
				this.ClientSize = new Size(this.DocumentWidth, this.DocumentHeight);
			}
			else 
			{
				SetScrollBars(member);
			}
		}