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); } }
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); } }
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 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);*/ }
protected override void DrawItemOn(Gdi g, NativeItemData nativeitem, Rectangle rItem, int nItem) { var item = (NativeItemDataMm)nativeitem; bool isSelected = ShowSelectedItem ? nItem == _SelectedIndex : false; //var primaryRect = new Rectangle(rItem.Left, rItem.Top, rItem.Width, rItem.Height - UISettings.CalcPix(5)); rItem = new Rectangle(rItem.Left, rItem.Top, rItem.Width, rItem.Height - UISettings.CalcPix(5)); DrawItemBackgroundOn(g, item, rItem, nItem, isSelected); 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)) { if (item.Tag.ToString() == "New") { g.Font = FontCache.CreateFont("Tahoma", 16, FontStyle.Bold, true); if (isSelected) { g.TextColor = Color.FromArgb(255, 255, 255); } else { g.TextColor = Color.FromArgb(245, 36, 43); } } else { 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(iconX + Settings.PrimaryIconPixWidth + UISettings.CalcPix(10), rItem.Top + (rItem.Height - textSize.Height) / 2, item.PrimaryText); } }
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); } } }