示例#1
0
 private void listBox_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     if ((sender as CheckedListBoxControl).GetItemCheckState(e.Index) == CheckState.Checked)
     {
         e.Appearance.BackColor = Color.FromArgb(163, 224, 148);
     }
 }
示例#2
0
        private void CustomDrawItem(ListBoxDrawItemEventArgs e)
        {
            double h = _customDrawingPosition / Convert.ToDouble(CustomDrawingPositionMaximum);

            if (e.IsItemSelected)
            {
                h = Math.Abs(1.0 - h);
            }

            HSL backColor = new HSL(h,
                                    1,
                                    e.ItemIndex % 2 == 0 ? 0.5 : 0.6);

            using (SolidBrush sb = new SolidBrush(backColor.ToRgb()))
            {
                e.Graphics.FillRectangle(sb, e.DrawingBounds);
            }

            HSL foreColor = new HSL(Math.Abs(1.0 - h),
                                    1,
                                    0.5);

            using (SolidBrush sb = new SolidBrush(foreColor.ToRgb()))
                e.Graphics.DrawString(DemoListBox.GetItemText(e.ItemIndex), DemoListBox.Font, sb, e.DrawingBounds);
        }
 private void repCities_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     if (e.State == DrawItemState.None)
     {
         e.Appearance.BackColor = e.Index % 2 == 0 ? Color.Green : Color.Red;
     }
 }
        private static void DrawDescription(ListBoxDrawItemEventArgs e, ImageComboBoxItem imageComboBoxItem)
        {
            var textRectangle = e.Bounds;

            textRectangle.X += _imageSize.Width + 3;
            e.Appearance.DrawString(e.Cache, imageComboBoxItem.Description, textRectangle);
        }
示例#5
0
 private void Listbox_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
     {
         e.Appearance.ForeColor = Color.DarkRed;
     }
 }
 /// <summary>
 ///     Перегружаемый метод прорисовки
 /// </summary>
 protected override void DrawItemCore(ControlGraphicsInfoArgs info, BaseListBoxViewInfo.ItemInfo itemInfo, ListBoxDrawItemEventArgs e)
 {
     base.DrawItemCore(info, itemInfo, e);
     var customInfo = itemInfo as CustomCheckedListBoxViewInfo.CustomCheckedItemInfo;
     if (customInfo == null)
     {
         return;
     }
     var rec = new Rectangle(itemInfo.Bounds.Location, new Size(itemInfo.Bounds.Width, LineWidth));
     var lineColor = ((CustomCheckedListBoxViewInfo) info.ViewInfo).DragDropLineColor;
     if (itemInfo.Index == 0)
     {
         var font = new Font(itemInfo.PaintAppearance.Font.FontFamily, itemInfo.PaintAppearance.Font.Size, FontStyle.Bold);
         info.Graphics.FillRectangle(Brushes.Lavender, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
         e.Graphics.DrawString(itemInfo.Text, font, Brushes.Black, e.Bounds.X, e.Bounds.Y + 2);
     }
     if (customInfo.IsOverLine)
     {
         if (customInfo.Index == 0)
         {
             rec.Height++;
         }
         info.Graphics.FillRectangle(info.Cache.GetSolidBrush(lineColor), rec);
     }
     if (!customInfo.IsUnderLine)
     {
         return;
     }
     rec.Offset(0, itemInfo.Bounds.Height - LineWidth);
     if (customInfo.Index == ((CustomCheckedListBoxViewInfo) info.ViewInfo).ItemCountAccessMethod() - 1)
     {
         rec.Height++;
     }
     info.Graphics.FillRectangle(info.Cache.GetSolidBrush(lineColor), rec);
 }
示例#7
0
        /// <summary>
        /// رنگ بندی ردیف CheckedComboBoxEdit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        public static void cmbAnbarName_DrawListBoxItem(object sender, ListBoxDrawItemEventArgs e)
        {
            if (e.Index == 0)
            {
                return;
            }
            int ItemId = Convert.ToInt32(e.Item);

            //_SalId = Convert.ToInt32(lblSalId.Text);

            using (var db = new MyContext())
            {
                try
                {
                    // var _Isactive = db.EpListAnbarhas.FirstOrDefault(s => s.SalId == _SalId && s.Id == ItemId).IsActive;
                    //if (_Isactive == false)
                    //    e.Appearance.ForeColor = Color.Red;
                    //else
                    //    e.Appearance.ForeColor = Color.Black;
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show("عملیات با خطا مواجه شد" + "\n" + ex.Message,
                                        "پیغام", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void DrawDescription(ListBoxDrawItemEventArgs e, ImageComboBoxItem iItem)
        {
            Rectangle textRect = e.Bounds;

            textRect.X += imageSize.Width + 3;
            e.Appearance.DrawString(e.Cache, iItem.Description, textRect);
        }
 private void DrawCheckedItem(ListBoxDrawItemEventArgs e, CheckedListBoxViewInfo viewInfo, Image image)
 {
     CheckedListBoxViewInfo.CheckedItemInfo itInfo = viewInfo.GetItemByIndex(e.Index);
     FillRectangle(e.Appearance, e.Cache, e.Bounds);
     DrawCheckBox(itInfo.CheckArgs, e.Graphics, viewInfo);
     DrawImage(itInfo.CheckArgs.GlyphRect, e.Graphics, image);
     DrawString(itInfo, e.Appearance, e.Cache);
 }
示例#10
0
 private void lstOp_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     if (lstOp.GetItemChecked(e.Index))
     {
         return;
     }
     e.Appearance.Font = new Font(e.Appearance.Font, FontStyle.Strikeout);
 }
示例#11
0
        private void listBoxControl1_DrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            ListBoxControl control = (ListBoxControl)sender;

            e.Appearance.DrawBackground(e.Cache, e.Bounds);
            TextUtils.DrawString(e.Graphics, control.GetItemText(e.Index), control.Appearance.Font,
                                 control.Appearance.ForeColor, e.Bounds);
            e.Handled = true;
        }
        private void generalPrimaryVariableListBoxControl_DrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            ListBoxControl listBox = sender as ListBoxControl;

            if (listBox.Enabled && e.State != (DrawItemState.Focus & DrawItemState.Selected))
            {
                e.Appearance.BackColor = Color.SlateGray;
            }
        }
示例#13
0
 void checkedListBoxControl1_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     if (checkedListBoxControl1.GetItemChecked(e.Index))
     {
         e.Appearance.Font      = new Font(e.Appearance.Font, FontStyle.Bold);
         e.Appearance.ForeColor = Color.Green;
         return;
     }
     e.Appearance.Font = new Font(e.Appearance.Font, FontStyle.Strikeout);
 }
示例#14
0
        public static void DrawPathItem(ListBoxDrawItemEventArgs e, ImageList imageList1)
        {
            ImageComboBoxItem imageComboBoxItem = e.Item as ImageComboBoxItem;

            if (imageComboBoxItem != null)
            {
                int    num  = 0;
                string text = imageComboBoxItem.Value.ToString();
                if (text == ConstDef.PATH_DESKTOP)
                {
                    num = 0;
                }
                else
                {
                    if (text.StartsWith(ConstDef.PATH_DESKTOP))
                    {
                        text = text.Substring(ConstDef.PATH_DESKTOP.Length);
                    }
                    string[] array = text.Split(new char[]
                    {
                        '\\'
                    });
                    for (int i = 0; i < array.Length; i++)
                    {
                        if (array[i] == imageComboBoxItem.Description)
                        {
                            num = i;
                            break;
                        }
                    }
                }
                SolidBrush brush = new SolidBrush(e.Appearance.BackColor);
                e.Graphics.FillRectangle(brush, e.Bounds);
                e.Graphics.DrawImage(imageList1.Images[imageComboBoxItem.ImageIndex], new System.Drawing.Point(e.Bounds.Left + num * 10, e.Bounds.Top));
                string description = imageComboBoxItem.Description;
                int    num2        = (e.Bounds.Top + e.Bounds.Bottom) / 2 - 5;
                if (e.State == DrawItemState.Selected)
                {
                    int        top    = e.Bounds.Top;
                    int        x      = 25 + num * 10;
                    int        height = e.Bounds.Height;
                    int        width  = (int)e.Graphics.MeasureString(description, e.Appearance.Font).Width;
                    SolidBrush brush2 = new SolidBrush(Color.LightGray);
                    Rectangle  rect   = new Rectangle(x, top, width, height);
                    e.Graphics.FillRectangle(brush2, rect);
                    e.Graphics.DrawString(description, e.Appearance.Font, SystemBrushes.HighlightText, new PointF((float)(25 + num * 10), (float)num2));
                }
                else
                {
                    e.Graphics.DrawString(description, e.Appearance.Font, new SolidBrush(e.Appearance.ForeColor), new PointF((float)(25 + num * 10), (float)num2));
                }
                e.Handled = true;
            }
        }
示例#15
0
        private void lbGenres_DrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            // TODO : Create SQL Version

            /*IEnumerable<KeyValuePair<string, string>> matches = MainEditor._titleCollection.GenreMap.Where(kvp => kvp.Value == (string)e.Item);
             * if (matches.Count() > 0)
             * {
             *  AppearanceObject appearance = (AppearanceObject)e.Appearance.Clone();
             *  appearance.Font = new Font(appearance.Font, FontStyle.Bold);
             *  e.Appearance.Combine(appearance);
             * }*/
        }
        private void RepositoryTreeviewComboxEx_DrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            Brush brush = null;
            ImageComboBoxItemEx item            = e.Item as ImageComboBoxItemEx;
            RectangleF          layoutRectangle = RectangleF.Inflate(e.Bounds, -2f, -1f);

            layoutRectangle.X += item.Degree * this.int_0;
            Font font = new Font("宋体", 8f);

            e.Graphics.DrawString(e.Item.ToString() + "_MyTest", font, brush, layoutRectangle);
            e.Handled = true;
        }
        private void DrawImage(ListBoxDrawItemEventArgs e, ImageComboBoxItem iItem)
        {
            Image img = GetImage(iItem);

            if (img == null)
            {
                return;
            }
            Rectangle imgRect = new Rectangle(e.Bounds.X + 2, e.Bounds.Y, imageSize.Width, imageSize.Height);

            e.Cache.Paint.DrawImage(e.Cache.Graphics, img, imgRect);
        }
示例#18
0
        protected override void RaiseDropDownCustomDrawItem(ListBoxDrawItemEventArgs e)
        {
            ImageComboBoxItem item = e.Item as ImageComboBoxItem;

            if (item.Images is ImageCollection)
            {
                Image image = (item.Images as ImageCollection).Images[e.Index];
                image.SelectActiveFrame(new FrameDimension(image.FrameDimensionsList[0]), 0);
            }

            base.RaiseDropDownCustomDrawItem(e);
        }
示例#19
0
 private void listBoxControl1_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     //Image image = Resource.web_icon_009;
     //Graphics graphics = e.Graphics;
     //this.listBoxControl1.PointToClient(Control.MousePosition);
     //if (e.State.ToString().Contains("Selected"))
     //{
     //    graphics.FillRectangle(new SolidBrush(SystemColors.GradientActiveCaption), e.Bounds);
     //    graphics.DrawImage(image, new RectangleF((float) (e.Bounds.Right - 20), (float) e.Bounds.Y, (float) e.Bounds.Height, (float) e.Bounds.Height), new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
     //}
     //graphics.DrawString(e.Item.ToString(), this.Font, Brushes.Black, (PointF) e.Bounds.Location);
     //e.Handled = true;
 }
        private static void DrawImage(ListBoxDrawItemEventArgs e, ImageComboBoxItem imageComboBoxItem)
        {
            var image = GetImage(imageComboBoxItem);

            if (image == null)
            {
                return;
            }

            var imageRectangle = new Rectangle(e.Bounds.X + 2, e.Bounds.Y, _imageSize.Width, _imageSize.Height);

            e.Graphics.DrawImage(image, imageRectangle);
        }
示例#21
0
        private void comboStatus_DrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            e.Appearance.BackColor              = GetHashkeyColor(SEMPRA_RQMT + e.Item.ToString());
            e.Appearance.BorderColor            = Color.Black;
            e.Appearance.Options.UseBorderColor = true;
            if (e.State == DrawItemState.Selected)
            {
                e.Appearance.BackColor = Color.Blue;
            }

            //e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Black)),
            //   new Point(e.Bounds.Left, e.Bounds.Top),
            //   new Point(e.Bounds.Right, e.Bounds.Top));
        }
示例#22
0
 void CustomCheckedComboBoxEdit_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     if (listBoxControl != null && Properties.CheckStyle != DevExpress.XtraEditors.Controls.CheckStyles.Standard)
     {
         CheckedListBoxControl  lbControl = sender as CheckedListBoxControl;
         CheckedListBoxViewInfo vi        = lbControl.GetViewInfo() as CheckedListBoxViewInfo;
         CheckedListBoxViewInfo.CheckedItemInfo checkItemInfo = vi.GetItemByIndex(e.Index) as CheckedListBoxViewInfo.CheckedItemInfo;
         checkItemInfo.CheckArgs.CheckStyle = Properties.CheckStyle;
         if (Properties.CheckStyle == DevExpress.XtraEditors.Controls.CheckStyles.Radio)
         {
             return;
         }
         SetProperties(checkItemInfo);
     }
 }
        private void settingSecondaryItemListBoxControl_DrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            CheckedListBoxControl listBox = sender as CheckedListBoxControl;

            if (listBox.Enabled && e.State != (DrawItemState.Focus & DrawItemState.Selected))
            {
                e.Appearance.BackColor = Color.SlateGray;
            }

            if (e.Index == listBox.ItemCount - 1)
            {
                Font font = new Font(e.Appearance.Font, FontStyle.Bold);
                e.Appearance.Font = font;
            }
        }
        internal static void DrawFontBoxItem(ListBoxDrawItemEventArgs e, RepositoryItemCustomFontEdit item, bool IsDrawStyle, string sCurrentFontName)
        {
            if (sCurrentFontName == string.Empty)
            {
                return;
            }
            using (SolidBrush foreBrush = new SolidBrush(e.Appearance.ForeColor), backBrush = new SolidBrush(e.Appearance.BackColor))
            {
                if (!FontItemPaintHelper.DrawItemBar(e, item as RepositoryItemComboBox))
                {
                    e.Graphics.FillRectangle(backBrush, e.Bounds);
                }
                using (FontFamily family = new FontFamily(sCurrentFontName))
                {
                    FontStyle currentStyle = FontStyle.Regular;
                    if (IsDrawStyle)
                    {
                        switch (e.Item.ToString())
                        {
                        case "Regular":
                            currentStyle = FontStyle.Regular;
                            break;

                        case "Italic":
                            currentStyle = FontStyle.Italic;
                            break;

                        case "Bold":
                            currentStyle = FontStyle.Bold;
                            break;

                        case "Bold Italic":
                            currentStyle = FontStyle.Bold | FontStyle.Italic;
                            break;

                        default:
                            break;
                        }
                    }
                    using (Font font = new Font(family, e.Appearance.Font.Size, currentStyle))
                    {
                        RepositoryItemCustomFontEdit.DrawFontName(e.Graphics, e.Item.ToString(), font, e.Appearance.Font, foreBrush, e.Bounds, true);
                        e.Handled = true;
                    }
                }
            }
        }
        void OnDrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            if (e.Index == 0)
            {
                return;
            }
            listBox = sender as CheckedListBoxControl;
            CheckedListBoxViewInfo viewInfo = listBox.GetViewInfo() as CheckedListBoxViewInfo;
            Image image = Properties.GetItemImage(e.Index - 1);

            if (image == null)
            {
                return;
            }
            DrawCheckedItem(e, viewInfo, image);
            e.Handled = true;
        }
示例#26
0
 private void listBoxControl1_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     //Brush FontBrush = null;
     //ListBox listBox = sender as ListBox;
     ////listBox.DrawMode = DrawMode.OwnerDrawFixed;
     //if (e.Index > -1)
     //{
     //    if (listBox.Items[e.Index].ToString().Contains("你好"))
     //    {
     //        FontBrush = Brushes.Red;
     //    }
     //    else
     //    {
     //        FontBrush = Brushes.Black;
     //    }
     //    e.Graphics.DrawString(listBox.Items[e.Index].ToString(), e.f, FontBrush, e.Bounds);
     //}
 }
示例#27
0
 /// <summary>
 ///     Handles the draw event for individual cue items in the listbox control.
 /// </summary>
 /// <remarks>
 ///     This allows to change the properties of items to draw.
 ///     Currently we use this to mark already played items.
 /// </remarks>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Cues_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     if ((e.Item is DisplayCue) && (Core.Model.Instance.SelectedCue != null)) //we are eligible to mark something
     {
         bool isPassed = (((e.Item as DisplayCue).Item.Time) < Core.Model.Instance.Player.Position.TotalSeconds);
         //this item is passed?
         bool isAfterSelectedCue = (((e.Item as DisplayCue).Item.Time) > Core.Model.Instance.SelectedCue.Time);
         //this item is after the current cue?
         if (
             isPassed &&
             isAfterSelectedCue &&
             (e.State == DrawItemState.None)
             ) //passed and done, but not selected
         {
             //shade that
             e.Appearance.BackColor = Color.FromArgb(64, Color.Gray);
         }
     }
 }
示例#28
0
        private void listBoxControlSusCoordinatesOutboard_DrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            List <string> _masterString = GetVehicleCornerASDataSource();

            if (_masterString != null)
            {
                for (int i = 0; i < _masterString.Count; i++)
                {
                    if ((string)e.Item == _masterString[i])
                    {
                        e.Appearance.BackColor = Color.Green;
                    }
                    //else
                    //{
                    //    e.Appearance.BackColor = Color.White;
                    //}
                }
            }
        }
        void OnDrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            ColumnFilterPopup.FilterComboBox fComboBox = sender as ColumnFilterPopup.FilterComboBox;
            FilterItem fItem = e.Item as FilterItem;

            if (fItem == null || fItem.Value is FilterItem)
            {
                return;
            }
            ImageComboBoxItem iItem = GetItem(fItem);

            if (iItem == null)
            {
                return;
            }
            FillBackground(e);
            DrawImage(e, iItem);
            DrawDescription(e, iItem);
            e.Handled = true;
        }
        private void listBoxControl1_DrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            var lst = (ListBoxControl) sender;

            e.Cache.FillRectangle(new SolidBrush(Color.Transparent), e.Bounds);
            if (e.Index == _hoveredIndex)
            {
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(89, 121, 189, 255)), e.Bounds);

                var imgRect = new Rectangle(0, 0, 16, 16);
                imgRect.Location = new Point(e.Bounds.Right - imgRect.Width, e.Bounds.Top + (e.Bounds.Height - imgRect.Height) / 2);
                e.Graphics.DrawImage(_image, imgRect);
            }
            if (e.Item is Notifications.ExpireWarn)
            {
                var warn = (Notifications.ExpireWarn) e.Item;
                if (warn.TimeRemaining.Days < 4)
                    _foreColor = Color.LightCoral;
                else if (warn.TimeRemaining.Days >= 4 && warn.TimeRemaining.Days < 7)
                    _foreColor = Color.PaleGoldenrod;
                else
                    _foreColor = Color.LightGreen;
            }
            else
            {
                _foreColor = Color.White;
            }

            var text = lst.GetItemText(e.Index);
            var topPadding = 0;
            var leftPadding = 12;
            if (e.Index == _clickedIndex)
            {
                topPadding = 2;
                leftPadding = 11;
            }
            e.Graphics.FillRectangle(new SolidBrush(_foreColor), e.Bounds.X + 5, e.Bounds.Y + 3, 5, e.Bounds.Height - 6);
            TextUtils.DrawString(e.Graphics, text, _font, Color.WhiteSmoke, new Rectangle(e.Bounds.X + leftPadding, e.Bounds.Y + topPadding, e.Bounds.Width - 24, e.Bounds.Height));
            e.Handled = true;
        }
示例#31
0
 private void tbName_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     try
     {
         if (e.State != DrawItemState.Selected)
         {
             e.Cache.FillRectangle(new SolidBrush(Color.Black), e.Bounds);
             e.Cache.DrawString(e.Item.ToString(), ft1, new SolidBrush(Color.FromArgb(255, 232, 166)), e.Bounds, e.Appearance.GetStringFormat());
         }
         else
         {
             e.Cache.FillRectangle(new SolidBrush(Color.Black), e.Bounds);
             //e.Cache.FillRectangle(new SolidBrush(Color.FromArgb(255, 232, 166)), e.Bounds);
             e.Cache.DrawString(e.Item.ToString(), ft1, new SolidBrush(Color.White), e.Bounds, e.Appearance.GetStringFormat());
         }
         e.Handled = true;
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
 }
        private void listBoxMessage_DrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            var lst = (ListBoxControl) sender;
            var message = (message) lst.GetItem(e.Index);
            if (message == null)
            {
                e.Handled = false;
                return;
            }
            e.Cache.FillRectangle(new SolidBrush(e.Appearance.BackColor), e.Bounds);
            if ((e.State & DrawItemState.Focus) != 0)
            {
                e.Cache.DrawRectangle(new Pen(Color.FromArgb(0x68, 0xB4, 0xFF)), e.Bounds);
                e.Cache.FillRectangle(new SolidBrush(Color.FromArgb(90, 71, 177, 255)), e.Bounds);
            }
            if ((e.State & DrawItemState.HotLight) != 0)
            {
                e.Cache.FillRectangle(new SolidBrush(Color.FromArgb(20, 0, 114, 198)), e.Bounds);
                e.Cache.DrawRectangle(new Pen(Color.FromArgb(164, 208, 251)), e.Bounds);
            }
            if (!message.is_viewed)
            {
                e.Cache.FillRectangle(new SolidBrush(Color.FromArgb(30, 59, 59, 59)), e.Bounds);
            }
            int subjectItemHeight = (int) e.Graphics.MeasureString(message.subject, SubjectFont, lst.Width).Height;
            int fromItemHeight = (int)e.Graphics.MeasureString(message.edu.sys_name, FromFont, lst.Width).Height;
            int dateItemHeight = (int)e.Graphics.MeasureString(message.send_date.ToString("G"), DateFont, lst.Width).Height;

            e.Graphics.DrawString(message.subject, SubjectFont, new SolidBrush(SubjectForecolor),
                new RectangleF(e.Bounds.X + 6, e.Bounds.Y + 8, e.Bounds.Width, subjectItemHeight));
            e.Graphics.DrawString(message.edu.number_sysname, FromFont, new SolidBrush(FromForecolor),
                new RectangleF(e.Bounds.X + 12, e.Bounds.Y + subjectItemHeight + 3 + 8, e.Bounds.Width, fromItemHeight));
            e.Graphics.DrawString(message.send_date.ToString("G"), DateFont, new SolidBrush(DateForecolor),
                new RectangleF(e.Bounds.X + 12, e.Bounds.Y + subjectItemHeight + fromItemHeight + 6 + 8, e.Bounds.Width, dateItemHeight));
            if ((e.State & DrawItemState.Focus) == 0)
                e.Graphics.DrawLine(new Pen(Color.FromArgb(30, 59, 59, 59), 1), e.Bounds.LeftBottom(), e.Bounds.RightBottom());
            e.Handled = true;
        }
示例#33
0
        private void checkedListBoxControlQuotes_DrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            var control = (CheckedListBoxControl)sender;

            if ((e.Index + 2) % 3 == 0)
            {
                using (Brush backBrush = new SolidBrush(control.BackColor))
                    using (Brush foreBrush = new SolidBrush(Color.Black))
                        using (var font = new Font(e.Appearance.Font.Name, e.Appearance.Font.Size, FontStyle.Regular))
                        {
                            e.Cache.FillRectangle(backBrush, e.Bounds);
                            e.Cache.DrawString("      " + ((Quote)e.Item).Author + "\"", font, foreBrush, e.Bounds, e.Appearance.TextOptions.GetStringFormat());
                        }
                e.Handled = true;
            }
            else if ((e.Index + 1) % 3 == 0)
            {
                using (Brush backBrush = new SolidBrush(control.BackColor))
                    using (Brush foreBrush = new SolidBrush(Color.Black))
                        using (var font = new Font(e.Appearance.Font.Name, e.Appearance.Font.Size, FontStyle.Regular))
                        {
                            e.Cache.FillRectangle(backBrush, e.Bounds);
                            e.Cache.DrawString(" ", font, foreBrush, e.Bounds, e.Appearance.TextOptions.GetStringFormat());
                        }
                e.Handled = true;
            }
            else if (checkedListBoxControlQuotes.GetItemChecked(e.Index))
            {
                e.Appearance.BackColor = control.BackColor;
                e.Appearance.ForeColor = Color.Red;
            }
            else
            {
                e.Appearance.BackColor = control.BackColor;
                e.Appearance.ForeColor = control.ForeColor;
            }
        }
示例#34
0
		private void checkedListBoxControlQuotes_DrawItem(object sender, ListBoxDrawItemEventArgs e)
		{
			var control = (CheckedListBoxControl)sender;
			if ((e.Index + 2) % 3 == 0)
			{
				using (Brush backBrush = new SolidBrush(control.BackColor))
				using (Brush foreBrush = new SolidBrush(Color.Black))
				using (var font = new Font(e.Appearance.Font.Name, e.Appearance.Font.Size, FontStyle.Regular))
				{
					e.Cache.FillRectangle(backBrush, e.Bounds);
					e.Cache.DrawString("      " + ((Quote)e.Item).Author + "\"", font, foreBrush, e.Bounds, e.Appearance.TextOptions.GetStringFormat());
				}
				e.Handled = true;
			}
			else if ((e.Index + 1) % 3 == 0)
			{
				using (Brush backBrush = new SolidBrush(control.BackColor))
				using (Brush foreBrush = new SolidBrush(Color.Black))
				using (var font = new Font(e.Appearance.Font.Name, e.Appearance.Font.Size, FontStyle.Regular))
				{
					e.Cache.FillRectangle(backBrush, e.Bounds);
					e.Cache.DrawString(" ", font, foreBrush, e.Bounds, e.Appearance.TextOptions.GetStringFormat());
				}
				e.Handled = true;
			}
			else if (checkedListBoxControlQuotes.GetItemChecked(e.Index))
			{
				e.Appearance.BackColor = control.BackColor;
				e.Appearance.ForeColor = Color.Red;
			}
			else
			{
				e.Appearance.BackColor = control.BackColor;
				e.Appearance.ForeColor = control.ForeColor;
			}
		}
示例#35
0
        private void CustomDrawItem(ListBoxDrawItemEventArgs e)
        {
            double h = _customDrawingPosition / Convert.ToDouble(CustomDrawingPositionMaximum);
            if(e.IsItemSelected)
            {
                h = Math.Abs(1.0 - h);
            }

            HSL backColor = new HSL(h,
                                    1,
                                    e.ItemIndex % 2 == 0 ? 0.5 : 0.6);
            using(SolidBrush sb = new SolidBrush(backColor.ToRgb()))
            {
                e.Graphics.FillRectangle(sb, e.DrawingBounds);
            }

            HSL foreColor = new HSL(Math.Abs(1.0 - h),
                                    1,
                                    0.5);
            using(SolidBrush sb = new SolidBrush(foreColor.ToRgb()))
                e.Graphics.DrawString(DemoListBox.GetItemText(e.ItemIndex), DemoListBox.Font, sb, e.DrawingBounds);
        }
示例#36
0
 private void listBoxControl1_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     timer1.Enabled = false;
     timer1.Enabled = true;
 }
示例#37
0
        private void lbTags_DrawItem(object sender, ListBoxDrawItemEventArgs e)
        {
            e.Handled = true;

            // Create the brushes
            if (_brushTreeViewSelected == null)
            {
                _brushTreeViewSelected = new LinearGradientBrush(new Point(0, 0), new Point(0, e.Bounds.Height), Color.LimeGreen, Color.PaleGreen);
            }

            int x = e.Bounds.X + 4;
            int y = e.Bounds.Y;
            int w = e.Bounds.Width;
            int h = e.Bounds.Height;
            int wt = (int)e.Graphics.MeasureString(e.Item.ToString(), new Font(FontFamily.GenericSansSerif, 8, FontStyle.Regular)).Width + 2;

            // Setup string formatting
            StringFormat stf = new StringFormat();
            stf.Trimming = StringTrimming.EllipsisCharacter;
            stf.FormatFlags = StringFormatFlags.NoWrap;

            e.Graphics.FillRectangle(new SolidBrush(Color.White), x, y, w, h);

            bool highlight = false;
            foreach (int selectedindex in lbTags.SelectedIndices)
            {
                if (lbTags.Items[selectedindex] == e.Item)
                {
                    highlight = true;
                }
            }

            if (highlight == true)
            //if (lbBioData.SelectedItem == e.Item)
            {
                e.Graphics.FillRectangle(_brushTreeViewSelected, x, y, wt, h);
                e.Graphics.DrawLine(new Pen(Color.Black), x + 1, y, x - 2 + wt, y);
                e.Graphics.DrawLine(new Pen(Color.Black), x + 1, y - 1 + h, x - 2 + wt, y - 1 + h);
                e.Graphics.DrawLine(new Pen(Color.Black), x, y + 1, x, y - 2 + h);
                e.Graphics.DrawLine(new Pen(Color.Black), x -1 + wt, y + 1, x -1 + wt, y - 2 + h);

            }

            e.Graphics.DrawString(e.Item.ToString(), new Font(FontFamily.GenericSansSerif, 8, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(x, y + 2, e.Bounds.Width, h), stf);
        }
示例#38
0
      private void comboStatus_DrawItem(object sender, ListBoxDrawItemEventArgs e)
      {
         e.Appearance.BackColor = GetHashkeyColor(SEMPRA_RQMT + e.Item.ToString());
         e.Appearance.BorderColor = Color.Black;
         e.Appearance.Options.UseBorderColor = true;
         if (e.State == DrawItemState.Selected)
            e.Appearance.BackColor = Color.Blue;

            //e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Black)),
            //   new Point(e.Bounds.Left, e.Bounds.Top),
            //   new Point(e.Bounds.Right, e.Bounds.Top)); 
      }
示例#39
0
文件: LookUp.cs 项目: fizikci/Cinar
 void lbc_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     if (DrawItem != null)
         DrawItem(e);
     else
         e.Appearance.ForeColor = (e.Item as BaseEntity).Deleted ? Color.Gray : Color.Black;
 }
 private void listBoxControlQueries_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     var listBox = (ListBoxControl)sender;
     var item = listBox.GetItem(e.Index);
     var query = (query)item;
     var s = query.title;
     if (_editedList.Contains(query))
         s += "*";
     e.Appearance.DrawBackground(e.Cache, e.Bounds);
     e.Graphics.DrawString(s, e.Appearance.Font, e.Cache.GetSolidBrush(e.Appearance.ForeColor), e.Bounds.Location);
     e.Handled = true;
 }
示例#41
0
 private void lbGenres_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     // TODO : Create SQL Version
     /*IEnumerable<KeyValuePair<string, string>> matches = MainEditor._titleCollection.GenreMap.Where(kvp => kvp.Value == (string)e.Item);
     if (matches.Count() > 0)
     {
         AppearanceObject appearance = (AppearanceObject)e.Appearance.Clone();
         appearance.Font = new Font(appearance.Font, FontStyle.Bold);
         e.Appearance.Combine(appearance);
     }*/
 }
示例#42
0
 private void listBoxControl1_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     e.Appearance.ForeColor = (e.Item as XYRelationData).SeriesColor;
 }
示例#43
0
 private void DemoListBox_DrawItem(object sender, ListBoxDrawItemEventArgs e)
 {
     CustomDrawItem(e);
 }