当前位置: 首页>>代码示例>>C#>>正文


C# Cell.GetDisplayText方法代码示例

本文整理汇总了C#中Cell.GetDisplayText方法的典型用法代码示例。如果您正苦于以下问题:C# Cell.GetDisplayText方法的具体用法?C# Cell.GetDisplayText怎么用?C# Cell.GetDisplayText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cell的用法示例。


在下文中一共展示了Cell.GetDisplayText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckCellValue

        private bool CheckCellValue(Cell cell)
        {
            if (!cell.Visible)
            {
                return false;
            }

            if (cell.Value != null)
            {
                string s = cell.GetDisplayText();
                if (ckbCaseSensitive.Checked)
                {
                    if (s.IndexOf(txtContent.Text, StringComparison.CurrentCulture) != -1)
                    {
                        return true;
                    }
                }
                else
                {
                    if (s.IndexOf(txtContent.Text, StringComparison.CurrentCultureIgnoreCase) != -1)
                    {
                        return true;
                    }
                }
            }
            return false;
        }
开发者ID:urmilaNominate,项目名称:mERP-framework,代码行数:27,代码来源:FindForm.cs

示例2: AddToFilterList

 /// <summary>
 /// Add the cell's value to the filter list.
 /// </summary>
 /// <param name="cell"></param>
 internal void AddToFilterList(Cell cell)
 {
     // The SingleOccurancyList will take care of making sure that the value is only present once in the list.
     if ((cell.Value == null)
         || (cell.Value == DBNull.Value))
     {
         m_filterItems[s_nullText] = new ComparisonFilter(ComparisonType.Eq, null);
     }
     else
     {
         if (cell.CellViewerManager is INameValueControl)
         {
             m_filterItems[cell.GetDisplayText()] = new ComparisonFilter(ComparisonType.Eq, cell.GetDisplayText());
         }
         else if (cell.Value is IComparable)
         {
             m_filterItems[cell.GetDisplayText()] = new ComparisonFilter(ComparisonType.Eq, cell.Value);
         }
         else
         {
             m_filterItems[cell.GetDisplayText()] = new ComparisonFilter(ComparisonType.Eq, "None");
         }
     }
 }
开发者ID:urmilaNominate,项目名称:mERP-framework,代码行数:28,代码来源:FilterCell.cs

示例3: PaintCellForeground

        protected override void PaintCellForeground(Cell cell, GridPaintEventArgs e, ref bool handled)
        {
            string value = cell.GetDisplayText();
            if (string.IsNullOrEmpty(value))
                return;

            handled = true;
            Graphics g = e.Graphics;
            Font font = cell.Font;
            PointF origin = new PointF(0, 0);

            string[] ss = value.Split(new char[] { '-'});
            string[] texts = new string[ss.Length];
            Color[] paintColors = new Color[ss.Length];
            float allLength = 0;
            for (int i = 0; i < ss.Length; ++i)
            {
                string s = ss[i];

                string[] ss2 = s.Split(new char[] { '/' });
                if (ss2.Length == 1)
                {
                    texts[i] = s;
                    paintColors[i] = m_colors[i % m_colors.Length];
                }
                else
                {
                    texts[i] = ss2[1];
                    paintColors[i] = m_colors[Convert.ToInt32(ss2[0])];
                }

                SizeF sizeTxt = g.MeasureString(texts[i], font, origin, sFormat);
                allLength += sizeTxt.Width;
            }

            Rectangle r = e.DisplayRectangle;
            r.Inflate(-1, -1);
            float nowOffset = 0;

            switch (e.DisplayVisualStyle.HorizontalAlignment)
            {
                case HorizontalAlignment.Left:
                    break;
                case HorizontalAlignment.Center:
                    nowOffset = (e.DisplayRectangle.Width - allLength) / 2;
                    break;
                case HorizontalAlignment.Right:
                    nowOffset = e.DisplayRectangle.Width - allLength;
                    break;
            }

            for(int i=0; i<ss.Length; ++i)
            {

                // http://weblogs.asp.net/israelio/archive/2006/07/30/DrawString-_2F00_-MeasureString-Offset-Problem-Solved-_2100_.aspx
                origin = new PointF(nowOffset, 0);
                SizeF sizeTxt = g.MeasureString(texts[i], font, origin, sFormat);

                using (SolidBrush brush = new SolidBrush(paintColors[i]))
                {
                    RectangleF rectangleTxt = (RectangleF)r;
                    rectangleTxt.Width = sizeTxt.Width;
                    rectangleTxt.Offset(nowOffset, 0f);
                    nowOffset += sizeTxt.Width;
                    g.DrawString(texts[i], font, brush, rectangleTxt, sFormat);
                }
            }
        }
开发者ID:urmilaNominate,项目名称:mERP-framework,代码行数:68,代码来源:MultiColorTextViewer.cs


注:本文中的Cell.GetDisplayText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。