Пример #1
0
        private void RenderImage()
        {
            if (m_Image != null)
            {
                m_Image.Dispose();
                m_Image = null;
            }

            int iWidth  = ClientSize.Width;
            int iHeight = ClientSize.Height;

            if (iWidth > 0 && iHeight > 0 && m_View != null && m_View.Lines != null)
            {
                //Draw a bitmap in memory that we can render from
                m_Image = new Bitmap(iWidth, iHeight);
                Graphics G = Graphics.FromImage(m_Image);

                SolidBrush B = new SolidBrush(BackColor);
                G.FillRectangle(B, 0, 0, iWidth, iHeight);

                const float c_fGutter = 2.0F;
                //Make sure each line is at least 1 pixel high
                float         fLineHeight = (float)Math.Max(1.0, GetPixelLineHeightF(1));
                DiffViewLines Lines       = m_View.Lines;
                int           iNumLines   = Lines.Count;
                for (int i = 0; i < iNumLines; i++)
                {
                    DiffViewLine L = Lines[i];
                    if (L.Edited)
                    {
                        B.Color = DiffOptions.GetColorForEditType(L.EditType);
                        float fY = GetPixelLineHeightF(i);
                        G.FillRectangle(B, c_fGutter, fY, iWidth - 2 * c_fGutter, fLineHeight);
                    }
                }

                B.Dispose();
                G.Dispose();
            }
        }
Пример #2
0
 public void SetData(DiffViewLine LineOne, DiffViewLine LineTwo)
 {
     m_StringList = null;
     m_Lines = new DiffViewLines(LineOne, LineTwo);
     UpdateAfterSetData();
 }
Пример #3
0
 public void SetData(IList<string> StringList, EditScript Script, bool bUseA)
 {
     m_StringList = StringList;
     m_Lines = new DiffViewLines(m_StringList, Script, bUseA);
     UpdateAfterSetData();
 }