ChangeItemFontAndColor() public method

public ChangeItemFontAndColor ( int index, Color foreColor, Font fnt ) : void
index int
foreColor Color
fnt System.Drawing.Font
return void
Exemplo n.º 1
0
        private void ChangeItemStyleRead(bool Read, ListViewItem Item, PostClass Post, DetailsListView DList)
        {
            Font fnt;
            //フォント
            if (Read)
            {
                fnt = _fntReaded;
                Item.SubItems[5].Text = "";
            }
            else
            {
                fnt = _fntUnread;
                Item.SubItems[5].Text = "★";
            }
            //文字色
            Color cl;
            if (Post.IsFav)
                cl = _clFav;
            else if (Post.RetweetedId > 0)
                cl = _clRetweet;
            else if (Post.IsOwl && (Post.IsDm || SettingDialog.OneWayLove))
                cl = _clOWL;
            else if (Read || !SettingDialog.UseUnreadStyle)
                cl = _clReaded;
            else
                cl = _clUnread;

            if (DList == null || Item.Index == -1)
            {
                Item.ForeColor = cl;
                if (SettingDialog.UseUnreadStyle)
                    Item.Font = fnt;
            }
            else
            {
                DList.Update();
                if (SettingDialog.UseUnreadStyle)
                    DList.ChangeItemFontAndColor(Item.Index, cl, fnt);
                else
                    DList.ChangeItemForeColor(Item.Index, cl);
                //if (_itemCache != null) DList.RedrawItems(_itemCacheIndex, _itemCacheIndex + _itemCache.Length - 1, false);
            }
        }
Exemplo n.º 2
0
        private void ChangeItemStyleRead(bool Read, ListViewItem Item, PostClass Post, DetailsListView DList)
        {
            Font fnt;
            //フォント
            if (Read)
            {
                fnt = _fntReaded;
                Item.SubItems[5].Text = "";
            }
            else
            {
                fnt = _fntUnread;
                Item.SubItems[5].Text = "★";
            }
            //文字色
            Color cl;
            if (Post.IsFav)
                cl = _clFav;
            else if (Post.RetweetedId > 0)
                cl = _clRetweet;
            else if (Post.IsOwl && (Post.IsDm || SettingDialog.OneWayLove))
                cl = _clOWL;
            else if (Read || !SettingDialog.UseUnreadStyle)
                cl = _clReaded;
            else
                cl = _clUnread;

            var conv = new Func<string, string>(str => Regex.Replace(str, @"[  \r\n\t]", ""));
            var newp = conv(Post.TextFromApi);

            if (_cfgCommon.ShowStolenTweetWithColor && !(Post.RetweetedId > 0) && _statuses._statuses.Any(_ => conv(_.Value.TextFromApi) == newp && _.Value.CreatedAt.CompareTo(Post.CreatedAt) < 0))
            {
                cl = _clStolen;
            }

            if (DList == null || Item.Index == -1)
            {
                Item.ForeColor = cl;
                if (SettingDialog.UseUnreadStyle)
                    Item.Font = fnt;
            }
            else
            {
                DList.Update();
                if (SettingDialog.UseUnreadStyle)
                    DList.ChangeItemFontAndColor(Item.Index, cl, fnt);
                else
                    DList.ChangeItemForeColor(Item.Index, cl);
                //if (_itemCache != null) DList.RedrawItems(_itemCacheIndex, _itemCacheIndex + _itemCache.Length - 1, false);
            }
        }