예제 #1
0
        protected override void DrawItemBackgroundOn(Gdi gMem, NativeItemData nativeItem, Rectangle rItem, int nItem, bool isSelected)
        {
            //var item = (NativeItemDataNew)nativeItem;

            Color baseColor;

            //if (item.ItemHighlight)
            //{
            //baseColor = Color.FromArgb(230, 230, 230);
            //}
            //else
            {
                baseColor = Color.FromArgb(255, 255, 255);
            }

            //if (isSelected)
            //{
            //gMem.GradientFill(rItem, Color.FromArgb(214, 220, 236), baseColor, FillDirection.TopToBottom);
            //}
            //else
            //{
            BrushGdi backGround = Gdi.CreateSolidBrush(baseColor);

            if (backGround != BrushGdi.Empty)
            {
                gMem.FillRect(rItem, backGround);
            }
            //}
        }
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            if (rItem.Height > Settings.ListItemPixSize)
            {
                rItem = new Rectangle(rItem.Left,
                                      rItem.Top + rItem.Height - Settings.ListItemPixSize,
                                      rItem.Width,
                                      Settings.ListItemPixSize);
            }

            DrawItemBackgroundOn(g, nativeItem, rItem, nItem, /*nItem == SelectedIndex*/ false);

            var rSep = new Rectangle(rItem.Left, rItem.Bottom - 1, rItem.Width, 1);

            g.FillRect(rSep, Settings.ListItemSeparator);

            // write name
            if (!string.IsNullOrEmpty(nativeItem.PrimaryText))
            {
                g.Font      = Settings.PrimaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                g.TextColor = Settings.ListItemTextColor;
                g.ExtTextOut(rItem.Left + nativeItem.InfoLeftIndents[0],
                             rItem.Top + nativeItem.InfoTopIndents[0],
                             nativeItem.PrimaryText);
            }

            base.DrawItemOn(g, nativeItem, rItem, nItem);
        }
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            if (rItem.Height > Settings.ListItemPixSize)
                rItem = new Rectangle(rItem.Left,
                                      rItem.Top + rItem.Height - Settings.ListItemPixSize,
                                      rItem.Width,
                                      Settings.ListItemPixSize);

            DrawItemBackgroundOn(g, nativeItem, rItem, nItem, /*nItem == SelectedIndex*/ false);

            var rSep = new Rectangle(rItem.Left, rItem.Bottom - 1, rItem.Width, 1);
            g.FillRect(rSep, Settings.ListItemSeparator);

            // write name
            if (!string.IsNullOrEmpty(nativeItem.PrimaryText))
            {
                g.Font = Settings.PrimaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                g.TextColor = Settings.ListItemTextColor;
                g.ExtTextOut(rItem.Left + nativeItem.InfoLeftIndents[0],
                    rItem.Top + nativeItem.InfoTopIndents[0],
                    nativeItem.PrimaryText);
            }

            base.DrawItemOn(g, nativeItem, rItem, nItem);
        }
예제 #4
0
        protected override void CalculateTextWidthsCustom(NativeItemData nativeItem, Graphics g, int textareaWidth, out int maxTextLines)
        {
            maxTextLines = 1;

            nativeItem.InfoLeftIndents[0] = UISettings.CalcPix(30);
            nativeItem.InfoTopIndents[0]  = UISettings.CalcPix(14);
        }
예제 #5
0
        protected override void DrawItemOn(GDI.Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            ExNativeItemData item     = (ExNativeItemData)nativeItem;
            Rectangle        itemrect = new Rectangle(rItem.Right - item.WorkAreaWidth, rItem.Top, item.WorkAreaWidth, rItem.Height);

            item.DrawItemOn(g, itemrect);
        }
예제 #6
0
        protected override void DrawItemBackgroundOn(Gdi gMem, NativeItemData item, Rectangle rItem, int nItem, bool isSelected)
        {
            gMem.FillRect(rItem, Color.White);

            if (nItem == 0)
            {
                rItem = new Rectangle(rItem.Left, rItem.Top + UISettings.CalcPix(5), rItem.Width, rItem.Height - UISettings.CalcPix(10));
            }
            else
            {
                rItem = new Rectangle(rItem.Left, rItem.Top, rItem.Width, rItem.Height - UISettings.CalcPix(5));
            }

            if (_paintedButton == null || isSelected || item.PrimaryText == Resources.ExtraView_ExitButtonTitle)
            {
                if (item.PrimaryText == Resources.ExtraView_ExitButtonTitle)
                {
                    if (isSelected)
                    {
                        DrawWideButton(rItem, gMem, MasterForm.SkinManager.GetImage("PhotoUpload1Pressed"),
                                       MasterForm.SkinManager.GetImage("PhotoUpload3Pressed"),
                                       MasterForm.SkinManager.GetImage("PhotoUpload2Pressed"));
                    }
                    else
                    {
                        DrawWideButton(rItem, gMem, MasterForm.SkinManager.GetImage("PhotoUpload1"),
                                       MasterForm.SkinManager.GetImage("PhotoUpload3"),
                                       MasterForm.SkinManager.GetImage("PhotoUpload2"));
                    }
                }
                else
                {
                    if (isSelected)
                    {
                        DrawWideButton(rItem, gMem, MasterForm.SkinManager.GetImage("EventList1Pressed"),
                                       MasterForm.SkinManager.GetImage("EventList3Pressed"),
                                       MasterForm.SkinManager.GetImage("EventList2Pressed"));
                    }
                    else
                    {
                        DrawWideButton(rItem, gMem, MasterForm.SkinManager.GetImage("EventList1"),
                                       MasterForm.SkinManager.GetImage("EventList3"),
                                       MasterForm.SkinManager.GetImage("EventList2"));
                    }
                }

                if (_paintedButton == null & !isSelected & rItem.Top > 0)
                {
                    _paintedButton = new Bitmap(rItem.Width, rItem.Height);
                    gMem.CopyImageTo(_paintedButton, 0, 0, rItem.Width, rItem.Height,
                                     rItem.Left, rItem.Top);
                }
            }
            else
            {
                gMem.DrawImage(_paintedButton, rItem.Left, rItem.Top);
            }
        }
예제 #7
0
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            NativeItemDataNew item = (NativeItemDataNew)nativeItem;

            //выделение
            DrawItemBackgroundOn(g, item, rItem, nItem, SelectedIndex == nItem);

            //полоска
            var rSep = new Rectangle(rItem.Left, rItem.Top, rItem.Width, 1);

            g.FillRect(rSep, Gdi.CreateSolidBrush(Color.FromArgb(205, 205, 205)));


            //Имя
            int topIndent  = rItem.Top + item.InfoTopIndents[0];
            int leftIndent = rItem.Left + UISettings.CalcPix(7); //rItem.Left + item.InfoLeftIndents[0];

            if (!string.IsNullOrEmpty(item.PrimaryText))
            {
                g.Font      = Settings.PrimaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                g.TextColor = Settings.ListItemTextColor;

                g.ExtTextOut(leftIndent, topIndent, item.PrimaryText);
            }

            //Дата
            topIndent  = rItem.Top + item.InfoTopIndents[0] + UISettings.CalcPix(1); //из-за разных шрифтов
            leftIndent = rItem.Right - item.InfoLeftIndents[2];
            if (!string.IsNullOrEmpty(item.TertiaryText))
            {
                g.Font      = Settings.ThirdTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_RIGHT;
                g.TextColor = Color.FromArgb(51, 153, 255);

                g.ExtTextOut(leftIndent, topIndent, item.TertiaryText);
            }

            //Текст сообщения
            leftIndent = rItem.Left + UISettings.CalcPix(7); //rItem.Left + item.InfoLeftIndents[0];
            topIndent  = rItem.Top + item.InfoTopIndents[1];
            if (item.SecondaryTextLines.Count > 0)
            {
                g.Font      = Settings.SecondaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                g.TextColor = Color.FromArgb(102, 102, 102);

                foreach (string line in item.SecondaryTextLines)
                {
                    g.ExtTextOut(leftIndent, topIndent, line);

                    topIndent += UISettings.CalcPix(11);
                }
            }
        }
        protected override void CalculateTextWidthsCustom(NativeItemData nativeItem, Graphics g, int textareaWidth, out int maxTextLines)
        {
            maxTextLines = 2;

            nativeItem.InfoLeftIndents[0] = UISettings.CalcPix(6);  //Картинка
            nativeItem.InfoLeftIndents[1] = UISettings.CalcPix(60); //Имя и Комментарий
            nativeItem.InfoLeftIndents[2] = UISettings.CalcPix(10); //Дата, отступ справа

            nativeItem.InfoTopIndents[0] = UISettings.CalcPix(5);   //Картинка, дата и имя
            nativeItem.InfoTopIndents[1] = UISettings.CalcPix(20);  //Комментарий
        }
        protected override void CalculateTextWidthsCustom(NativeItemData nativeItem, Graphics g, int textareaWidth, out int maxTextLines)
        {
            maxTextLines = 2;

            nativeItem.InfoLeftIndents[0] = UISettings.CalcPix(6);  //иконка
            nativeItem.InfoLeftIndents[1] = UISettings.CalcPix(19); //Имя и статус
            nativeItem.InfoLeftIndents[2] = UISettings.CalcPix(10); //Дата, отступ справа

            nativeItem.InfoTopIndents[0] = UISettings.CalcPix(4);   //иконка, дата и имя
            nativeItem.InfoTopIndents[1] = UISettings.CalcPix(15);  //статус
        }
예제 #10
0
        protected override void CalculateTextWidthsCustom(NativeItemData nativeItemData, Graphics groupHeaderGraphics, int textareaWidth, out int maxTextLines)
        {
            maxTextLines = Int32.MaxValue;
            //maxTextLines = 100;
            nativeItemData.InfoLeftIndents[0] = UISettings.CalcPix(5);  //от левого края
            nativeItemData.InfoLeftIndents[1] = UISettings.CalcPix(5);  //блок текста (с аватаркой)
            nativeItemData.InfoLeftIndents[2] = UISettings.CalcPix(10); //Дата, выравнивание по правому краю

            nativeItemData.InfoTopIndents[0] = UISettings.CalcPix(5);   //от верх. края
            nativeItemData.InfoTopIndents[1] = UISettings.CalcPix(18);  //2 строка текста
            nativeItemData.InfoTopIndents[2] = UISettings.CalcPix(35);  //3 строка текста
        }
예제 #11
0
        protected override void CalculateTextWidthsCustom(NativeItemData nativeItem, Graphics g, int textareaWidth, out int maxTextLines)
        {
            maxTextLines = 2;

            nativeItem.InfoLeftIndents[0] = UISettings.CalcPix(0);     //Аватарка
            nativeItem.InfoLeftIndents[1] = UISettings.CalcPix(60);    //Имя
            nativeItem.InfoLeftIndents[2] = UISettings.CalcPix(60);    //online

            nativeItem.InfoTopIndents[0] = UISettings.CalcPix(0);      //Автарка
            nativeItem.InfoTopIndents[1] = UISettings.CalcPix(15);     //Имя
            nativeItem.InfoTopIndents[2] = UISettings.CalcPix(25 + 3); //online
        }
        protected override void CalculateTextWidthsCustom(NativeItemData nativeItem, Graphics g, int textareaWidth, out int maxTextLines)
        {
            maxTextLines = 2;

            nativeItem.InfoLeftIndents[0] = UISettings.CalcPix(5);  //до иконки
            nativeItem.InfoLeftIndents[1] = UISettings.CalcPix(18); //блок текста (без "Я: ")
            nativeItem.InfoLeftIndents[2] = UISettings.CalcPix(30); //блок текста (с "Я: ")
            nativeItem.InfoLeftIndents[3] = UISettings.CalcPix(26); //Дата, выравнивание по правому краю
            nativeItem.InfoLeftIndents[4] = UISettings.CalcPix(18); //Arrow, выравнивание по правому краю

            nativeItem.InfoTopIndents[0] = UISettings.CalcPix(4);   //ФИО, иконка и дата
            nativeItem.InfoTopIndents[1] = UISettings.CalcPix(18);  //Текст сообщения
            nativeItem.InfoTopIndents[2] = UISettings.CalcPix(15);  //Arrow
        }
예제 #13
0
        protected override List <NativeItemData> BuildNativeControlItems()
        {
            var newListData = new List <NativeItemData>(Items.Count);

            if (Items != null)
            {
                for (int i = 0; i < Items.Count; i++)
                {
                    string photo = string.Empty;

                    if (!string.IsNullOrEmpty(Items[i].Photo))
                    {
                        if (Items[i].IsPhotoLoaded)
                        {
                            photo = Items[i].Photo;
                        }
                        else
                        {
                            photo = "clear";
                        }
                    }

                    //bool groupHeaderIsSet = false;

                    //if (IsItemNewGroup(i) && !string.IsNullOrEmpty(Items[i].Group))
                    //{
                    //    groupHeaderIsSet = true;
                    //}

                    NativeItemData data = new NativeItemData
                    {
                        PrimaryImageURL = photo,
                        PrimaryText     = Items[i].UserName,
                        SecondaryText   = Items[i].UserComment,
                        TertiaryText    = Items[i].CommentWroteDateString,
                        Group           = Items[i].Group,
                        //Tag = groupHeaderIsSet,

                        InfoLeftIndents = new int[3],
                        InfoTopIndents  = new int[5]
                    };

                    newListData.Add(data);
                }
            }

            return(newListData);
        }
예제 #14
0
        /// <summary>
        /// Draw background
        /// </summary>
        /// <param name="gMem">Graphics</param>
        /// <param name="item">Prepeared native item</param>
        /// <param name="rItem">Area to draw</param>
        /// <param name="nItem">Index of the item in the native items list</param>
        /// <param name="isSelected">Is item selected</param>
        protected override void DrawItemBackgroundOn(Gdi gMem, NativeItemData item, Rectangle rItem, int nItem, bool isSelected)
        {
            if (isSelected)
            {
                gMem.GradientFill(rItem, Color.FromArgb(69, 137, 219), Color.FromArgb(50, 106, 173),
                                  FillDirection.TopToBottom);
            }

            /*
             * else
             * {
             * BrushGdi backGround = nItem % 2 == 0 ? Settings.ListItemBackgroundEven : Settings.ListItemBackgroundOdd;
             * if (backGround != BrushGdi.Empty)
             *  gMem.FillRect(rItem, backGround);
             * }
             * */
        }
        protected override void DrawItemBackgroundOn(Gdi gMem, NativeItemData nativeItem, Rectangle rItem, int nItem, bool isSelected)
        {
            Color baseColor;

            baseColor = Color.FromArgb(255, 255, 255);

            if (isSelected)
            {
                gMem.GradientFill(rItem, Color.FromArgb(69, 137, 219), Color.FromArgb(50, 106, 173), FillDirection.TopToBottom);
            }
            else
            {
                BrushGdi backGround = Gdi.CreateSolidBrush(baseColor);

                if (backGround != BrushGdi.Empty)
                {
                    gMem.FillRect(rItem, backGround);
                }
            }
        }
예제 #16
0
        protected override void DrawItemBackgroundOn(Gdi gMem, NativeItemData nativeItem, Rectangle rItem, int nItem, bool isSelected)
        {
            NativeItemData item = nativeItem;

            if (nItem == 0) // картинка
            {
                Color    baseColor  = Color.FromArgb(51, 51, 51);
                BrushGdi backGround = Gdi.CreateSolidBrush(baseColor);
                gMem.FillRect(rItem, backGround);
            }
            else if (!isSelected || nItem == 1)
            {
                Color    baseColor  = Color.White;
                BrushGdi backGround = Gdi.CreateSolidBrush(baseColor);
                gMem.FillRect(rItem, backGround);
            }
            else
            {
                gMem.GradientFill(rItem, Color.FromArgb(69, 137, 219), Color.FromArgb(50, 106, 173), FillDirection.TopToBottom);
            }
        }
예제 #17
0
        protected override void DrawItemBackgroundOn(Gdi gMem, NativeItemData item, Rectangle rItem, int nItem, bool isSelected)
        {
            gMem.FillRect(rItem, Color.White);

            if (nItem == 0)
            {
                rItem = new Rectangle(rItem.Left, rItem.Top + UISettings.CalcPix(5), rItem.Width, rItem.Height - UISettings.CalcPix(10));
            }
            else
            {
                rItem = new Rectangle(rItem.Left, rItem.Top, rItem.Width, rItem.Height - UISettings.CalcPix(5));
            }

            if (_paintedButton == null || isSelected)
            {
                if (isSelected)
                {
                    DrawWideButton(rItem, gMem, MasterForm.SkinManager.GetImage("WideButton1Pressed"),
                                   MasterForm.SkinManager.GetImage("WideButton3Pressed"),
                                   MasterForm.SkinManager.GetImage("WideButton2Pressed"));
                }
                else
                {
                    DrawWideButton(rItem, gMem, MasterForm.SkinManager.GetImage("WideButton1"),
                                   MasterForm.SkinManager.GetImage("WideButton3"),
                                   MasterForm.SkinManager.GetImage("WideButton2"));
                }

                if (_paintedButton == null & !isSelected & rItem.Top > 0)
                {
                    _paintedButton = new Bitmap(rItem.Width, rItem.Height);
                    gMem.CopyImageTo(_paintedButton, 0, 0, rItem.Width, rItem.Height,
                                     rItem.Left, rItem.Top);
                }
            }
            else
            {
                gMem.DrawImage(_paintedButton, rItem.Left, rItem.Top);
            }
        }
예제 #18
0
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            //ImageNativeItemData item = (ImageNativeItemData) nativeItem;

            NativeItemData item = nativeItem;

            if (rItem.Height > Settings.ListItemPixSize)
            {
                rItem = new Rectangle(rItem.Left, rItem.Top + rItem.Height - Settings.ListItemPixSize, rItem.Width, Settings.ListItemPixSize);
            }

            //выделение
            DrawItemBackgroundOn(g, item, rItem, nItem, SelectedIndex == nItem);

            #region выводим изображения

            int index = -1;

            for (int i = 0; i < NativeItems.Count; i++)
            {
                var ni = NativeItems[i];

                if (ni.Uid == item.Uid)
                {
                    index = i;

                    break;
                }
            }

            if (index > -1)
            {
                if (IsItemVisible(index))
                {
                    if (!string.IsNullOrEmpty(item.PrimaryImageURL))
                    {
                        if (!item.PrimaryImageURL.Equals("clear"))
                        {
                            IImage newIImage = null;

                            if (File.Exists(item.PrimaryImageURL))
                            {
                                ImageHelper.LoadImageFromFile(item.PrimaryImageURL, out newIImage);

                                item.PrimaryImage = newIImage;
                            }
                            else
                            {
                                item.PrimaryImage = MasterForm.SkinManager.GetImage("ImageNull");
                            }
                        }
                        else
                        {
                            item.PrimaryImage = MasterForm.SkinManager.GetImage("ImageNull");
                        }

                        item.PrimaryImageURL = string.Empty;
                    }

                    int imageMarginLeft = 0;
                    int imageMarginTop  = 0;

                    ImageInfo newImageInfo;

                    item.PrimaryImage.GetImageInfo(out newImageInfo);

                    imageMarginLeft = (rItem.Width - (int)newImageInfo.Width) / 2;
                    imageMarginTop  = (rItem.Height - (int)newImageInfo.Height) / 2;

                    g.DrawImageAlphaChannel(item.PrimaryImage, rItem.Left + imageMarginLeft, rItem.Top + imageMarginTop);
                }
            }

            #endregion

            ////изображение
            //IImage img = item.SecondaryImage ?? item.PrimaryImage;

            //if (img != null)
            //{
            //    g.DrawImageAlphaChannel(img, rItem.Left + _imageMargin, rItem.Top + _imageMargin);
            //}
        }
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            int topIndent;
            int leftIndent;

            NativeItemData item       = nativeItem;
            bool           isSelected = ShowSelectedItem ? nItem == _SelectedIndex : false;

            /*if (rItem.Height > Settings.ListItemPixSize)
             * {
             *  rItem = new Rectangle(rItem.Left,
             *                          rItem.Top + rItem.Height - Settings.ListItemPixSize,
             *                          rItem.Width,
             *                          Settings.ListItemPixSize);
             * }*/

            //фон
            DrawItemBackgroundOn(g, item, rItem, nItem, isSelected);

            //полоска
            var rSep = new Rectangle(rItem.Left, rItem.Top, rItem.Width, 1);

            g.FillRect(rSep, Settings.ListItemSeparator);

            //иконка + кэширование
            topIndent  = rItem.Top + item.InfoTopIndents[0];
            leftIndent = rItem.Left + item.InfoLeftIndents[0];

            if (IsItemNewGroup(nItem))
            {
                topIndent += Settings.GroupPixHeight;
            }

            if (item.PrimaryImage != null)
            {
                ImageInfo iinfo;
                item.PrimaryImage.GetImageInfo(out iinfo);
                if (item.Icon == null || isSelected)
                {
                    g.DrawImageAlphaChannel(item.PrimaryImage, leftIndent, topIndent);

                    if (item.Icon == null & topIndent > 0)
                    {
                        item.Icon = new Bitmap((int)iinfo.Width, (int)iinfo.Height);
                        g.CopyImageTo(item.Icon, 0, 0, Settings.PrimaryIconPixWidth, Settings.PrimaryIconPixHeight, leftIndent, topIndent);
                    }
                }
                else
                {
                    g.DrawImage(item.Icon, leftIndent, topIndent);
                }
            }

            //Имя
            topIndent  = rItem.Top + item.InfoTopIndents[0] - UISettings.CalcPix(2);
            leftIndent = rItem.Left + item.InfoLeftIndents[1];

            if (IsItemNewGroup(nItem))
            {
                topIndent += Settings.GroupPixHeight;
            }

            if (!string.IsNullOrEmpty(item.PrimaryText))
            {
                g.Font      = Settings.PrimaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                if (isSelected)
                {
                    g.TextColor = Color.White;
                }
                else
                {
                    g.TextColor = Settings.ListItemTextColor;
                }
                g.ExtTextOut(leftIndent, topIndent, item.PrimaryText);
            }

            //Дата
            topIndent  = rItem.Top + item.InfoTopIndents[0];
            leftIndent = rItem.Right - item.InfoLeftIndents[2];

            if (IsItemNewGroup(nItem))
            {
                topIndent += Settings.GroupPixHeight;
            }

            if (!string.IsNullOrEmpty(item.TertiaryText))
            {
                g.Font      = Settings.ThirdTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_RIGHT;
                if (isSelected)
                {
                    g.TextColor = Color.White;
                }
                else
                {
                    g.TextColor = Color.FromArgb(51, 153, 255);
                }
                g.ExtTextOut(leftIndent, topIndent, item.TertiaryText);
            }

            ////Статус
            //topIndent = rItem.Top + item.InfoTopIndents[1];
            //leftIndent = rItem.Left + item.InfoLeftIndents[1];
            //if (!string.IsNullOrEmpty(item.SecondaryText))
            //{
            //    g.Font = Settings.SecondaryTextFontGdi;
            //    g.TextAlign = Win32.TextAlign.TA_LEFT;
            //    if (isSelected) g.TextColor = Color.White;
            //    else g.TextColor = Color.FromArgb(102, 102, 102);

            //    int colPrev = 0;
            //    int line = Settings.SecondaryTextLinesCount;

            //    do
            //    {
            //        int col = item.SecondaryText.IndexOf('\n', colPrev);

            //        string text;

            //        if (col > -1)
            //        {
            //            text = item.SecondaryText.Substring(colPrev, col - colPrev);
            //        }
            //        else
            //        {
            //            text = item.SecondaryText.Substring(colPrev);
            //        }

            //        g.ExtTextOut(leftIndent, topIndent, text);

            //        colPrev = col + 1;

            //        line--;

            //        topIndent += UISettings.CalcPix(11);
            //    }
            //    while (colPrev > 0 && line > 0);
            //}

            //if (item.SecondaryTextLines != null && item.SecondaryTextLines.Count > 0)
            //{
            //    g.Font = _secFont;
            //    g.TextAlign = Win32.TextAlign.TA_LEFT;
            //    g.TextColor = Color.FromArgb(102, 102, 102);

            //    foreach (string line in item.SecondaryTextLines)
            //    {
            //        g.ExtTextOut(leftIndent, topIndent, line);

            //        topIndent += UISettings.CalcPix(11);
            //    }
            //}

            // текст сообщения
            leftIndent = rItem.Left + item.InfoLeftIndents[1];
            topIndent  = rItem.Top + item.InfoTopIndents[1];

            if (IsItemNewGroup(nItem))
            {
                topIndent += Settings.GroupPixHeight;
            }

            if (item.SecondaryTextLines.Count > 0)
            {
                g.Font      = Settings.SecondaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                g.TextColor = Color.FromArgb(102, 102, 102);

                if (isSelected)
                {
                    g.TextColor = Color.White;
                }

                foreach (string line in item.SecondaryTextLines)
                {
                    g.ExtTextOut(leftIndent, topIndent, line);

                    topIndent += UISettings.CalcPix(11);
                }
            }
        }
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            NativeItemDataNew item = (NativeItemDataNew)nativeItem;

            bool isSelected = ShowSelectedItem ? nItem == _SelectedIndex : false;

            //Подложка айтема
            DrawItemBackgroundOn(g, item, rItem, nItem, isSelected);

            //полоска
            var rSep = new Rectangle(rItem.Left, rItem.Top, rItem.Width, 1);

            g.FillRect(rSep, Gdi.CreateSolidBrush(Color.FromArgb(219, 219, 219)));

            //IsItemHighlight icon + кэширование
            int leftIndent = rItem.Left + item.InfoLeftIndents[0] + UISettings.CalcPix(1);
            int topIndent  = rItem.Top + item.InfoTopIndents[0] + UISettings.CalcPix(3);

            if (item.IsItemHighlight && item.PrimaryImage != null)
            {
                ImageInfo iinfo;
                item.PrimaryImage.GetImageInfo(out iinfo);

                if (item.OutboxIcon == null || isSelected)
                {
                    //g.DrawImageAlphaChannel(item.PrimaryImage, leftIndent, topIndent);

                    if (item.OutboxIcon == null & topIndent > 0)
                    {
                        item.OutboxIcon = new Bitmap((int)iinfo.Width, (int)iinfo.Height);
                        g.CopyImageTo(item.OutboxIcon, 0, 0, Settings.PrimaryIconPixWidth, Settings.PrimaryIconPixHeight, leftIndent, topIndent);
                    }
                }
                else
                {
                    g.DrawImage(item.OutboxIcon, leftIndent, topIndent);
                }
            }

            //Имя Фамилия
            topIndent  = rItem.Top + item.InfoTopIndents[0];
            leftIndent = rItem.Left + item.InfoLeftIndents[1];
            if (!string.IsNullOrEmpty(item.PrimaryText))
            {
                g.Font      = Settings.PrimaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                if (isSelected)
                {
                    g.TextColor = Color.White;
                }
                else
                {
                    g.TextColor = Settings.ListItemTextColor;
                }
                g.ExtTextOut(/*leftIndent*/ UISettings.CalcPix(7), topIndent, item.PrimaryText);
            }

            //Дата
            topIndent  = rItem.Top + item.InfoTopIndents[0] + UISettings.CalcPix(1); //из-за разных шрифтов
            leftIndent = rItem.Right - item.InfoLeftIndents[3];
            if (!string.IsNullOrEmpty(item.TertiaryText))
            {
                g.Font      = Settings.ThirdTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_RIGHT;
                if (isSelected)
                {
                    g.TextColor = Color.White;
                }
                else
                {
                    g.TextColor = Color.FromArgb(51, 153, 255);
                }
                g.ExtTextOut(leftIndent, topIndent, item.TertiaryText);
            }

            //bool needTab = false;

            //Я:
            topIndent  = rItem.Top + item.InfoTopIndents[1];
            leftIndent = rItem.Left + UISettings.CalcPix(7); //rItem.Left + item.InfoLeftIndents[1];
            if (item.IsOutboxIconSet)
            {
                g.Font      = Settings.PrimaryText2FontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                if (isSelected)
                {
                    g.TextColor = Color.White;
                }
                else
                {
                    g.TextColor = Settings.ListItemTextColor;
                }
                g.ExtTextOut(leftIndent, topIndent, Resources.OutboxText);

                //Отступ для текста сообщения
                //leftIndent = rItem.Left + item.InfoLeftIndents[2];
                leftIndent = rItem.Left + UISettings.CalcPix(22);
            }



            //Текст сообщения
            if (item.SecondaryTextLines.Count > 0)
            {
                g.Font      = Settings.SecondaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                if (isSelected)
                {
                    g.TextColor = Color.White;
                }
                else
                {
                    g.TextColor = Color.FromArgb(102, 102, 102);
                }

                foreach (string line in item.SecondaryTextLines)
                {
                    g.ExtTextOut(leftIndent, topIndent, line);

                    topIndent += UISettings.CalcPix(11);
                }
            }

            //Arrow
            topIndent  = rItem.Top + item.InfoTopIndents[2];
            leftIndent = rItem.Right - item.InfoLeftIndents[4];

            //if (isSelected) g.DrawImageAlphaChannel(MasterForm.SkinManager.GetImage("MessagesArrowPressed"), leftIndent, topIndent);
            //else g.DrawImageAlphaChannel(MasterForm.SkinManager.GetImage("MessagesArrow"), leftIndent, topIndent);
            if (_cachedImages != null && _cachedImages.Count > 1)
            {
                if (isSelected)
                {
                    g.DrawImage(_cachedImages[1], leftIndent, topIndent);
                }
                else
                {
                    g.DrawImage(_cachedImages[0], leftIndent, topIndent);
                }
            }
        }
예제 #21
0
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            //Дефолтный цвет для Enabled элементов
            g.TextColor = Settings.ListItemTextColor;

            #region Отображение disabled элементов
            bool isNotifficationOff = false;
            foreach (var item in Items)
            {
                if (item.OptionName == nativeItem.PrimaryText)
                {
                    //Выясняем стоит ли BackgroundNotification в Off
                    foreach (var item2 in Items)
                    {
                        if (item2.OptionName == Resources.BackgroundNotification &&
                            (string)item2.OptionValue == Resources.Settings_Off)
                        {
                            isNotifficationOff = true;
                        }
                    }

                    if (item.OptionName == Resources.Settings_Messages)
                    {
                        //((CheckBoxNativeItemData) nativeItem).CheckBoxSelected = MasterForm.SkinManager.GetImage("SettingsUnavailable");
                        g.TextColor = Color.FromArgb(213, 213, 213);
                    }
                    if (item.OptionName == Resources.Settings_Comments && isNotifficationOff)
                    {
                        //((CheckBoxNativeItemData) nativeItem).CheckBoxSelected = MasterForm.SkinManager.GetImage("SettingsUnavailable");
                        g.TextColor = Color.FromArgb(213, 213, 213);
                    }
                    if (item.OptionName == Resources.Settings_Friends && isNotifficationOff)
                    {
                        //((CheckBoxNativeItemData) nativeItem).CheckBoxSelected = MasterForm.SkinManager.GetImage("SettingsUnavailable");
                        g.TextColor = Color.FromArgb(213, 213, 213);
                    }
                    if (item.OptionName == Resources.Settings_FriendsNews && isNotifficationOff)
                    {
                        //((CheckBoxNativeItemData) nativeItem).CheckBoxSelected = MasterForm.SkinManager.GetImage("SettingsUnavailable");
                        g.TextColor = Color.FromArgb(213, 213, 213);
                    }
                    if (item.OptionName == Resources.Settings_FriendsPhotos && isNotifficationOff)
                    {
                        //((CheckBoxNativeItemData) nativeItem).CheckBoxSelected = MasterForm.SkinManager.GetImage("SettingsUnavailable");
                        g.TextColor = Color.FromArgb(213, 213, 213);
                    }
                    if (item.OptionName == Resources.Settings_WallMessages && isNotifficationOff)
                    {
                        //((CheckBoxNativeItemData) nativeItem).CheckBoxSelected = MasterForm.SkinManager.GetImage("SettingsUnavailable");
                        g.TextColor = Color.FromArgb(213, 213, 213);
                    }
                }
            }
            #endregion

            if (rItem.Height > Settings.ListItemPixSize)
            {
                rItem = new Rectangle(rItem.Left,
                                      rItem.Top + rItem.Height - Settings.ListItemPixSize,
                                      rItem.Width,
                                      Settings.ListItemPixSize);
            }
            //Не надо делать выделение
            DrawItemBackgroundOn(g, nativeItem, rItem, nItem, /*nItem == SelectedIndex*/ false);

            var rSep = new Rectangle(rItem.Left, rItem.Bottom - 1, rItem.Width, 1);
            g.FillRect(rSep, Settings.ListItemSeparator);

            // write name
            if (!string.IsNullOrEmpty(nativeItem.PrimaryText))
            {
                g.Font      = Settings.PrimaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                g.ExtTextOut(rItem.Left + nativeItem.InfoLeftIndents[0],
                             rItem.Top + nativeItem.InfoTopIndents[0],
                             nativeItem.PrimaryText);
            }

            base.DrawItemOn(g, nativeItem, rItem, nItem);
        }
예제 #22
0
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            //Дефолтный цвет для Enabled элементов
            g.TextColor = Settings.ListItemTextColor;

            #region Отображение disabled элементов
            bool isNotifficationOff = false;
            foreach (var item in Items)
            {
                if (item.OptionName == nativeItem.PrimaryText)
                {
                    //Выясняем стоит ли BackgroundNotification в Off
                    foreach (var item2 in Items)
                    {
                        if (item2.OptionName == Resources.BackgroundNotification &&
                        (string)item2.OptionValue == Resources.Settings_Off)
                            isNotifficationOff = true;
                    }

                    if (item.OptionName == Resources.Settings_Messages)
                    {
                        //((CheckBoxNativeItemData) nativeItem).CheckBoxSelected = MasterForm.SkinManager.GetImage("SettingsUnavailable");
                        g.TextColor = Color.FromArgb(213, 213, 213);
                    }
                    if (item.OptionName == Resources.Settings_Comments && isNotifficationOff)
                    {
                        //((CheckBoxNativeItemData) nativeItem).CheckBoxSelected = MasterForm.SkinManager.GetImage("SettingsUnavailable");
                        g.TextColor = Color.FromArgb(213, 213, 213);
                    }
                    if (item.OptionName == Resources.Settings_Friends && isNotifficationOff)
                    {
                        //((CheckBoxNativeItemData) nativeItem).CheckBoxSelected = MasterForm.SkinManager.GetImage("SettingsUnavailable");
                        g.TextColor = Color.FromArgb(213, 213, 213);
                    }
                    if (item.OptionName == Resources.Settings_FriendsNews && isNotifficationOff)
                    {
                        //((CheckBoxNativeItemData) nativeItem).CheckBoxSelected = MasterForm.SkinManager.GetImage("SettingsUnavailable");
                        g.TextColor = Color.FromArgb(213, 213, 213);
                    }
                    if (item.OptionName == Resources.Settings_FriendsPhotos && isNotifficationOff)
                    {
                        //((CheckBoxNativeItemData) nativeItem).CheckBoxSelected = MasterForm.SkinManager.GetImage("SettingsUnavailable");
                        g.TextColor = Color.FromArgb(213, 213, 213);
                    }
                    if (item.OptionName == Resources.Settings_WallMessages && isNotifficationOff)
                    {
                        //((CheckBoxNativeItemData) nativeItem).CheckBoxSelected = MasterForm.SkinManager.GetImage("SettingsUnavailable");
                        g.TextColor = Color.FromArgb(213, 213, 213);
                    }
                }
            }
            #endregion

            if (rItem.Height > Settings.ListItemPixSize)
                rItem = new Rectangle(rItem.Left,
                                      rItem.Top + rItem.Height - Settings.ListItemPixSize,
                                      rItem.Width,
                                      Settings.ListItemPixSize);
            //Не надо делать выделение
            DrawItemBackgroundOn(g, nativeItem, rItem, nItem, /*nItem == SelectedIndex*/ false);

            var rSep = new Rectangle(rItem.Left, rItem.Bottom - 1, rItem.Width, 1);
            g.FillRect(rSep, Settings.ListItemSeparator);

            // write name
            if (!string.IsNullOrEmpty(nativeItem.PrimaryText))
            {
                g.Font = Settings.PrimaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                g.ExtTextOut(rItem.Left + nativeItem.InfoLeftIndents[0],
                             rItem.Top + nativeItem.InfoTopIndents[0],
                             nativeItem.PrimaryText);
            }

            base.DrawItemOn(g, nativeItem, rItem, nItem);
        }
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            NativeItemData item       = nativeItem;
            bool           isSelected = ShowSelectedItem ? nItem == _SelectedIndex : false;

            if (rItem.Height > Settings.ListItemPixSize)
            {
                rItem = new Rectangle(rItem.Left,
                                      rItem.Top + rItem.Height - Settings.ListItemPixSize,
                                      rItem.Width,
                                      Settings.ListItemPixSize);
            }

            //фон
            DrawItemBackgroundOn(g, item, rItem, nItem, isSelected);

            //Картинка
            int topIndent  = rItem.Top;
            int leftIndent = rItem.Left;

            #region выводим изображения
            int index = -1;

            for (int i = 0; i < NativeItems.Count; i++)
            {
                var ni = NativeItems[i];

                if (ni.Uid == item.Uid)
                {
                    index = i;

                    break;
                }
            }

            if (index > -1)
            {
                if (IsItemVisible(index))
                {
                    if (!string.IsNullOrEmpty(item.PrimaryImageURL))
                    {
                        if (!item.PrimaryImageURL.Equals("clear"))
                        {
                            IImage newIImage = null;

                            //ImageHelper.LoadImageFromFile(item.PrimaryImageURL, out newIImage);

                            //item.PrimaryImage = newIImage;

                            if (File.Exists(item.PrimaryImageURL))
                            {
                                ImageHelper.LoadImageFromFile(item.PrimaryImageURL, out newIImage);

                                item.PrimaryImage = newIImage;
                            }
                            else
                            {
                                item.PrimaryImage = MasterForm.SkinManager.GetImage("ImageNull");
                            }
                        }
                        else
                        {
                            item.PrimaryImage = MasterForm.SkinManager.GetImage("ImageNull");
                        }

                        item.PrimaryImageURL = string.Empty;
                    }

                    int imageMarginLeft = 0;
                    int imageMarginTop  = 0;

                    ImageInfo newImageInfo;

                    item.PrimaryImage.GetImageInfo(out newImageInfo);

                    imageMarginLeft = 0;
                    imageMarginTop  = 0;

                    g.DrawImageAlphaChannel(item.PrimaryImage, leftIndent + imageMarginLeft, topIndent + imageMarginTop);
                }
            }
            #endregion

            //полоска
            var rSep = new Rectangle(rItem.Left, rItem.Top, rItem.Width, 1);
            g.FillRect(rSep, Settings.ListItemSeparator);

            //имя
            topIndent  = rItem.Top + item.InfoTopIndents[0];
            leftIndent = rItem.Left + item.InfoLeftIndents[1];
            if (!string.IsNullOrEmpty(item.PrimaryText))
            {
                g.Font      = Settings.PrimaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                if (isSelected)
                {
                    g.TextColor = Color.White;
                }
                else
                {
                    g.TextColor = Settings.ListItemTextColor;
                }
                g.ExtTextOut(leftIndent, topIndent, item.PrimaryText);
            }

            //дата
            topIndent  = rItem.Top + item.InfoTopIndents[0];
            leftIndent = rItem.Right - item.InfoLeftIndents[2];
            if (!string.IsNullOrEmpty(item.TertiaryText))
            {
                g.Font      = Settings.ThirdTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_RIGHT;
                if (isSelected)
                {
                    g.TextColor = Color.White;
                }
                else
                {
                    g.TextColor = Color.FromArgb(51, 153, 255);
                }
                g.ExtTextOut(leftIndent, topIndent, item.TertiaryText);
            }

            //Комментарий
            topIndent  = rItem.Top + item.InfoTopIndents[1];
            leftIndent = rItem.Left + item.InfoLeftIndents[1];
            if (!string.IsNullOrEmpty(item.SecondaryText))
            {
                //g.Font = Settings.SecondaryTextFontGdi;
                //g.TextAlign = Win32.TextAlign.TA_LEFT;
                //if (isSelected) g.TextColor = Color.White;
                //else g.TextColor = Color.FromArgb(102, 102, 102);

                //int colPrev = 0;
                //int line = Settings.SecondaryTextLinesCount;

                //do
                //{
                //    int col = item.SecondaryText.IndexOf('\n', colPrev);

                //    string text;

                //    if (col > -1)
                //    {
                //        text = item.SecondaryText.Substring(colPrev, col - colPrev);
                //    }
                //    else
                //    {
                //        text = item.SecondaryText.Substring(colPrev);
                //    }

                //    g.ExtTextOut(leftIndent, topIndent, text);

                //    colPrev = col + 1;

                //    line--;

                //    topIndent += UISettings.CalcPix(11);
                //}
                //while (colPrev > 0 && line > 0);

                if (item.SecondaryTextLines.Count > 0)
                {
                    g.Font      = Settings.SecondaryTextFontGdi;
                    g.TextAlign = Win32.TextAlign.TA_LEFT;
                    g.TextColor = Color.FromArgb(102, 102, 102);

                    if (isSelected)
                    {
                        g.TextColor = Color.White;
                    }

                    foreach (string line in item.SecondaryTextLines)
                    {
                        g.ExtTextOut(leftIndent, topIndent, line);

                        topIndent += UISettings.CalcPix(11);
                    }
                }
            }
        }
예제 #24
0
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            NativeItemData item       = nativeItem;
            bool           isSelected = ShowSelectedItem ? nItem == _SelectedIndex : false;

            if (rItem.Height > Settings.ListItemPixSize)
            {
                rItem = new Rectangle(rItem.Left, rItem.Top + rItem.Height - Settings.ListItemPixSize, rItem.Width, Settings.ListItemPixSize);
            }

            //Фон
            DrawItemBackgroundOn(g, item, rItem, nItem, isSelected);

            //Аватарка
            int leftIndent = rItem.Left + item.InfoLeftIndents[0];
            int topIndent  = rItem.Top + item.InfoTopIndents[0];

            #region выводим изображение

            int index = -1;

            for (int i = 0; i < NativeItems.Count; i++)
            {
                var ni = NativeItems[i];

                if (ni.Uid == item.Uid)
                {
                    index = i;

                    break;
                }
            }

            if (index > -1)
            {
                if (IsItemVisible(index))
                {
                    if (!string.IsNullOrEmpty(item.PrimaryImageURL))
                    {
                        if (!item.PrimaryImageURL.Equals("clear"))
                        {
                            IImage newIImage = null;

                            if (File.Exists(item.PrimaryImageURL))
                            {
                                ImageHelper.LoadImageFromFile(item.PrimaryImageURL, out newIImage);

                                item.PrimaryImage = newIImage;
                            }
                            else
                            {
                                item.PrimaryImage = MasterForm.SkinManager.GetImage("ImageNull");
                            }
                        }
                        else
                        {
                            item.PrimaryImage = MasterForm.SkinManager.GetImage("ImageNull");
                        }

                        item.PrimaryImageURL = string.Empty;
                    }

                    int imageMarginLeft = 0;
                    int imageMarginTop  = 0;

                    ImageInfo newImageInfo;

                    item.PrimaryImage.GetImageInfo(out newImageInfo);

                    imageMarginLeft = 0;
                    imageMarginTop  = 0;

                    g.DrawImageAlphaChannel(item.PrimaryImage, leftIndent + imageMarginLeft, topIndent + imageMarginTop);
                }
            }

            #endregion

            //полоска
            var rSep = new Rectangle(rItem.Left, rItem.Top, rItem.Width, 1);
            g.FillRect(rSep, Settings.ListItemSeparator);

            //Имя
            leftIndent = rItem.Left + item.InfoLeftIndents[1];
            topIndent  = rItem.Top + item.InfoTopIndents[1];
            if (!string.IsNullOrEmpty(item.PrimaryText) && !string.IsNullOrEmpty(item.SecondaryText))
            {
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                if (isSelected)
                {
                    g.TextColor = Color.White;
                }
                else
                {
                    g.TextColor = Settings.ListItemTextColor;
                }
                g.Font = Settings.PrimaryTextFontGdi;
                Size size = g.GetTextExtent(item.PrimaryText);
                g.ExtTextOut(leftIndent, topIndent, item.PrimaryText);
                leftIndent += size.Width;

                g.Font = Settings.SecondaryTextFontGdi;
                g.ExtTextOut(leftIndent, topIndent, item.SecondaryText);
            }

            //Online
            leftIndent = rItem.Left + item.InfoLeftIndents[2];
            topIndent  = rItem.Top + item.InfoTopIndents[2];
            if (!string.IsNullOrEmpty(item.TertiaryText))
            {
                g.Font      = Settings.ThirdTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                if (isSelected)
                {
                    g.TextColor = Color.White;
                }
                else
                {
                    g.TextColor = Color.FromArgb(150, 150, 150);
                }
                g.ExtTextOut(leftIndent, topIndent, item.TertiaryText);
            }
        }
예제 #25
0
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            NativeItemData item = nativeItem;

            if (rItem.Height > Settings.ListItemPixSize)
            {
                rItem = new Rectangle(rItem.Left,
                                      rItem.Top + rItem.Height - Settings.ListItemPixSize,
                                      rItem.Width,
                                      Settings.ListItemPixSize);
            }

            //Если выделен
            DrawItemBackgroundOn(g, item, rItem, nItem, SelectedIndex == nItem);

            var rSep = new Rectangle(rItem.Left, rItem.Bottom - 1, rItem.Width, 1);

            //полоска
            g.FillRect(rSep, Settings.ListItemSeparator);

            //
            int leftIndent = rItem.Left + Settings.TextPixMargin;
            int topIndent  = rItem.Bottom - rItem.Height + item.InfoTopIndents[0];

            // write name

            //Отрисовка изображения
            if (item.PrimaryImage != null)
            {
                g.DrawImageAlphaChannel(item.PrimaryImage, leftIndent, topIndent);
            }

            leftIndent += Settings.SecondaryIconPixWidth + Settings.TextPixMargin;

            //определение размеров текста g.GetTextExtent

            /*
             * Size textSize = g.GetTextExtent(vals[0] + " ");
             * g.ExtTextOut(rItem.Left + rItem.Width / 2 - textSize.Width,
             *           rItem.Bottom - item.InfoTopIndents[0],
             *           textSize.Width,
             *           vals[0]);
             */

            if (!string.IsNullOrEmpty(item.PrimaryText))
            {
                g.Font      = Settings.PrimaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                g.TextColor = Settings.ListItemTextColor;
                g.ExtTextOut(leftIndent, topIndent, item.PrimaryText);
            }

            if (!string.IsNullOrEmpty(item.SecondaryText))
            {
                g.Font      = Settings.SecondaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                g.TextColor = Settings.ListItemTextColor;
                g.ExtTextOut(leftIndent, topIndent + 10, item.SecondaryText);
            }

            if (!string.IsNullOrEmpty(item.SecondaryText))
            {
                g.Font      = Settings.SecondaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                g.TextColor = Settings.ListItemTextColor;
                g.ExtTextOut(leftIndent, topIndent + 20, item.TertiaryText);
            }

            /*
             * if(item.SecondaryImage != null)
             * {
             *  g.DrawImageAlphaChannel(item.SecondaryImage, rItem.Right - Settings.SecondaryIconPixWidth + Settings.TextPixMargin, topIndent);
             * }
             */
        }
예제 #26
0
        protected override void DrawItemBackgroundOn(Gdi gMem, NativeItemData item, Rectangle rItem, int nItem, bool isSelected)
        {
            //const int height = 36;

            /*if (_paintedButton == null)
             * {
             *  _paintedButton = new Bitmap(rItem.Width, rItem.Height-4);
             *
             *  Graphics graphics = null;
             *  IntPtr hdc = IntPtr.Zero;
             *  try
             *  {
             *      graphics = Graphics.FromImage(_paintedButton);
             *      hdc = graphics.GetHdc();
             *      Rectangle rect = new Rectangle(0, 0, rItem.Width, rItem.Height);
             *      //using (Gdi g = Gdi.FromHdc(hdc, rect))
             *      using (Gdi g = Gdi.FromHdc(hdc, rItem))
             *      {
             *          //Белый фон
             *          g.GradientFill(rItem, Color.White, Color.White, FillDirection.TopToBottom);
             *
             *          //DrawWideButton(new Rectangle(0, 0, rItem.Width, height), g, MasterForm.SkinManager.GetImage("EventList1"), MasterForm.SkinManager.GetImage("EventList3"), MasterForm.SkinManager.GetImage("EventList2"));
             *          DrawWideButton(rItem, g, MasterForm.SkinManager.GetImage("EventList1"), MasterForm.SkinManager.GetImage("EventList3"), MasterForm.SkinManager.GetImage("EventList2"));
             *      }
             *  }
             *  catch(Exception ex)
             *  {
             *      _paintedButton = null;
             *      MessageBox.Show(ex.ToString());
             *      throw;
             *  }
             *  finally
             *  {
             *      if (graphics != null)
             *      {
             *          graphics.ReleaseHdc(hdc);
             *          graphics.Dispose();
             *      }
             *  }
             * }*/

            if (_paintedButton == null || isSelected)
            {
                if (isSelected)
                {
                    DrawWideButton(rItem, gMem, MasterForm.SkinManager.GetImage("EventList1Pressed"),
                                   MasterForm.SkinManager.GetImage("EventList3Pressed"), MasterForm.SkinManager.GetImage("EventList2Pressed"));
                }
                else
                {
                    DrawWideButton(rItem, gMem, MasterForm.SkinManager.GetImage("EventList1"),
                                   MasterForm.SkinManager.GetImage("EventList3"), MasterForm.SkinManager.GetImage("EventList2"));
                }
                //gMem.DrawImageAlphaChannel(item.SecondaryImage, rItem.Left, rItem.Top);

                if (_paintedButton == null & !isSelected & rItem.Top > 0)
                {
                    _paintedButton = new Bitmap(rItem.Width, rItem.Height);
                    gMem.CopyImageTo(_paintedButton, 0, 0, rItem.Width, rItem.Height,
                                     rItem.Left, rItem.Top);
                }
            }
            else
            {
                gMem.DrawImage(_paintedButton, rItem.Left, rItem.Top);
            }

            /*if (isSelected)
             * {
             *  DrawWideButton(rItem, gMem, MasterForm.SkinManager.GetImage("EventList1"), MasterForm.SkinManager.GetImage("EventList3"), MasterForm.SkinManager.GetImage("EventList2"));
             * }
             * else
             *  gMem.DrawImage(_paintedButton, rItem.Left, rItem.Top);*/
        }
예제 #27
0
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            int topIndent;
            int leftIndent;

            NativeItemData item       = nativeItem;
            bool           isSelected = ShowSelectedItem ? nItem == _SelectedIndex : false;

            //фон
            DrawItemBackgroundOn(g, item, rItem, nItem, isSelected);

            //полоска
            var rSep = new Rectangle(rItem.Left, rItem.Top, rItem.Width, 1);

            g.FillRect(rSep, Settings.ListItemSeparator);

            // дата
            topIndent  = rItem.Top + item.InfoTopIndents[0];
            leftIndent = rItem.Right - item.InfoLeftIndents[1];

            if (IsItemNewGroup(nItem))
            {
                topIndent += Settings.GroupPixHeight;
            }

            if (!string.IsNullOrEmpty(item.TertiaryText))
            {
                g.Font      = Settings.ThirdTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_RIGHT;
                g.TextColor = Color.FromArgb(51, 153, 255);

                if (isSelected)
                {
                    g.TextColor = Color.White;
                }

                g.ExtTextOut(leftIndent, topIndent, item.TertiaryText);
            }

            // текст сообщения
            leftIndent = rItem.Left + item.InfoLeftIndents[0];
            topIndent  = rItem.Top + item.InfoTopIndents[0];

            if (IsItemNewGroup(nItem))
            {
                topIndent += Settings.GroupPixHeight;
            }

            if (item.SecondaryTextLines.Count > 0)
            {
                g.Font      = Settings.SecondaryTextFontGdi;
                g.TextAlign = Win32.TextAlign.TA_LEFT;
                g.TextColor = Color.FromArgb(102, 102, 102);

                if (isSelected)
                {
                    g.TextColor = Color.White;
                }

                foreach (string line in item.SecondaryTextLines)
                {
                    g.ExtTextOut(leftIndent, topIndent, line);

                    topIndent += UISettings.CalcPix(11);
                }
            }
        }
예제 #28
0
        protected override void DrawItemOn(Gdi g, NativeItemData nativeItem, Rectangle rItem, int nItem)
        {
            NativeItemData item = nativeItem;

            bool isSelected = ShowSelectedItem ? nItem == _SelectedIndex : false;

            if (!(nItem > 1))
            {
                isSelected = false;
            }

            //bool isSelected;

            //if (SelectedIndex == nItem)
            //{

            //}

            //if nItem

            //if (SelectedIndex == nItem)
            //{
            //    isSe
            //}

            //

            //if (rItem.Height > Settings.ListItemPixSize)
            //{
            //    rItem = new Rectangle(rItem.Left, rItem.Top + rItem.Height - Settings.ListItemPixSize, rItem.Width, Settings.ListItemPixSize);
            //}

            // выделение
            DrawItemBackgroundOn(g, item, rItem, nItem, SelectedIndex == nItem);

            //// полоска
            //var rSep = new Rectangle(rItem.Left, rItem.Top, rItem.Width, 1);
            //g.FillRect(rSep, Gdi.CreateSolidBrush(Color.FromArgb(205, 205, 205)));

            // загрузка изображения...
            if (!string.IsNullOrEmpty(item.PrimaryImageURL))
            {
                if (!item.PrimaryImageURL.Equals("clear"))
                {
                    IImage newIImage = null;

                    ImageHelper.LoadImageFromFile(item.PrimaryImageURL, out newIImage);

                    item.PrimaryImage = newIImage;
                }
                else
                {
                    item.PrimaryImage = MasterForm.SkinManager.GetImage("ImageNull");
                }

                if (item.PrimaryImage != null)
                {
                    ImageInfo ii;
                    item.PrimaryImage.GetImageInfo(out ii);
                    Size imageSize = new Size((int)ii.Width, (int)ii.Height);
                    item.Icon = new Bitmap(imageSize.Width, imageSize.Height);
                    //Create cached image
                    using (Graphics gr = Graphics.FromImage(item.Icon))
                    {
                        IntPtr    grPtr = gr.GetHdc();
                        Rectangle rect  = new Rectangle(0, 0, imageSize.Width, imageSize.Height);
                        item.PrimaryImage.Draw(grPtr, ref rect, IntPtr.Zero);
                        gr.ReleaseHdc(grPtr);
                    }
                }

                item.PrimaryImageURL = string.Empty;
            }

            if (item.Icon != null) // если есть изображение, то айтем первого типа
            {
                g.DrawImage(item.Icon, rItem.Left + (rItem.Width - item.Icon.Width) / 2, rItem.Top + (rItem.Height - item.Icon.Height) / 2);
                //g.DrawImageAlphaChannel(item.PrimaryImage, rItem.Left + (rItem.Width - item.ImageSize.Width) / 2, rItem.Top + (rItem.Height - item.ImageSize.Height) / 2);
            }
            else // 2 или 3
            {
                // полоска
                Rectangle rSep = new Rectangle(rItem.Left, rItem.Top, rItem.Width, 1);
                g.FillRect(rSep, Gdi.CreateSolidBrush(Color.FromArgb(205, 205, 205)));

                int topIndent  = rItem.Top + item.InfoTopIndents[0];
                int leftIndent = rItem.Left + item.InfoLeftIndents[0];

                if (nItem == 1 || nItem == 2)
                {
                    topIndent += Settings.GroupPixHeight;
                }

                if (!string.IsNullOrEmpty(item.PrimaryText))
                {
                    g.Font      = _priFont;
                    g.TextAlign = Win32.TextAlign.TA_LEFT;
                    g.TextColor = Color.Black;

                    if (isSelected)
                    {
                        g.TextColor = Color.White;
                    }

                    g.ExtTextOut(leftIndent, topIndent, item.PrimaryText);
                }

                leftIndent = rItem.Left + item.InfoLeftIndents[0];
                topIndent  = rItem.Top + item.InfoTopIndents[1];

                if (nItem == 2)
                {
                    topIndent += Settings.GroupPixHeight;
                }

                if (item.SecondaryTextLines != null && item.SecondaryTextLines.Count > 0)
                {
                    g.Font      = _secFont;
                    g.TextAlign = Win32.TextAlign.TA_LEFT;
                    g.TextColor = Color.FromArgb(102, 102, 102);

                    if (isSelected)
                    {
                        g.TextColor = Color.White;
                    }

                    foreach (string line in item.SecondaryTextLines)
                    {
                        g.ExtTextOut(leftIndent, topIndent, line);

                        topIndent += UISettings.CalcPix(11);
                    }
                }

                // дата
                topIndent  = rItem.Top + item.InfoTopIndents[0];
                leftIndent = rItem.Right - item.InfoLeftIndents[2];

                if (nItem == 2)
                {
                    topIndent += Settings.GroupPixHeight;
                }

                if (!string.IsNullOrEmpty(item.TertiaryText))
                {
                    g.Font      = _secFont;
                    g.TextAlign = Win32.TextAlign.TA_RIGHT;
                    g.TextColor = Color.FromArgb(51, 153, 255);

                    if (isSelected)
                    {
                        g.TextColor = Color.White;
                    }

                    g.ExtTextOut(leftIndent, topIndent, item.TertiaryText);
                }
            }
        }
예제 #29
0
        protected override void DrawItemOn(Gdi g, NativeItemData nativeitem, Rectangle rItem, int nItem)
        {
            var item = (NativeItemDataMm)nativeitem;

            bool isSelected = ShowSelectedItem ? nItem == _SelectedIndex : false;

            DrawItemBackgroundOn(g, item, rItem, nItem, isSelected);

            if (nItem == 0)
            {
                rItem = new Rectangle(rItem.Left, rItem.Top + UISettings.CalcPix(5), rItem.Width, rItem.Height - UISettings.CalcPix(10));
            }
            else
            {
                rItem = new Rectangle(rItem.Left, rItem.Top, rItem.Width, rItem.Height - UISettings.CalcPix(5));
            }

            int iconMargin = UISettings.CalcPix(15);
            int iconX      = rItem.Left + iconMargin;

            // draw icon

            /*
             * if (item.Icon != null)
             * {
             *  ImageInfo iinfo;
             *  item.Icon.GetImageInfo(out iinfo);
             *  int iconY = rItem.Top + (rItem.Height - (int) iinfo.Height)/2;
             *
             *  if (item.PrimaryImage == null || isSelected)
             *  {
             *      g.DrawImageAlphaChannel(item.Icon, iconX, iconY);
             *
             *      if (item.PrimaryImage == null & iconY > 0)
             *      {
             *          item.PrimaryImage = new Bitmap((int) iinfo.Width, (int) iinfo.Height);
             *          g.CopyImageTo(item.PrimaryImage, 0, 0, Settings.PrimaryIconPixWidth,
             *                        Settings.PrimaryIconPixHeight, iconX, iconY);
             *      }
             *  }
             *  else
             *  {
             *      g.DrawImage(item.PrimaryImage, iconX, iconY);
             *  }
             * }
             */

            if (!String.IsNullOrEmpty(item.PrimaryText))
            {
                g.Font = FontCache.CreateFont("Tahoma", 16, FontStyle.Regular, true);
                if (isSelected)
                {
                    g.TextColor = Color.FromArgb(255, 255, 255);
                }
                else
                {
                    g.TextColor = Color.FromArgb(119, 126, 93);
                }

                g.TextAlign = Win32.TextAlign.TA_LEFT;
                Size textSize = g.GetTextExtent(item.PrimaryText);

                g.ExtTextOut(rItem.Left + (rItem.Width - textSize.Width) / 2, rItem.Top + (rItem.Height - textSize.Height) / 2, item.PrimaryText);
            }
        }