• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.DrawItemEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms.DrawItemEventArgs的典型用法代码示例。如果您正苦于以下问题:C# DrawItemEventArgs类的具体用法?C# DrawItemEventArgs怎么用?C# DrawItemEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DrawItemEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了DrawItemEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnDrawItem

        /// <summary>Override for the drawing of the control to include a Close Tab button</summary>
        /// <param name="e"></param>
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            RectangleF tabTextArea = RectangleF.Empty;
            for(int nIndex = 0 ; nIndex < this.TabCount ; nIndex++)
            {
                tabTextArea = (RectangleF)this.GetTabRect(nIndex);

                using(SolidBrush brush = new SolidBrush(this.TabPages[nIndex].BackColor))
                {
                    //Clear the tab
                    e.Graphics.FillRectangle(brush, tabTextArea);
                }

                Bitmap bmp = nIndex == this.SelectedIndex ? Resources.activeClose : Resources.inactiveClose;
                e.Graphics.DrawImage(bmp, tabTextArea.X + tabTextArea.Width - (CLOSE_ICON_PADDING + CLOSE_ICON_SIZE), tabTextArea.Y + CLOSE_ICON_PADDING, CLOSE_ICON_SIZE, CLOSE_ICON_SIZE);
                bmp.Dispose();

                string str = this.TabPages[nIndex].Text;
                StringFormat stringFormat = new StringFormat();
                stringFormat.Alignment = StringAlignment.Center;
                stringFormat.LineAlignment = StringAlignment.Center;
                using(SolidBrush brush = new SolidBrush(this.TabPages[nIndex].ForeColor))
                {
                    //Draw the tab header text
                    e.Graphics.DrawString(str, this.Font, brush, tabTextArea,stringFormat);
                }
            }
        }
开发者ID:meandthewallaby,项目名称:Edrych,代码行数:30,代码来源:TabControlExt.cs


示例2: OnDrawItem

        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (e.Index < 0 || e.Index >= this.Items.Count)
                return;

            //e.DrawBackground();

            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                LinearGradientBrush brush = new LinearGradientBrush(new Point(e.Bounds.X, e.Bounds.Y), new Point(e.Bounds.X, e.Bounds.Bottom),
                    Color.AliceBlue, Color.LightSkyBlue);

                e.Graphics.FillRectangle(brush, e.Bounds);
            }
            else
                e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds);

            e.DrawFocusRectangle();

            ClipboardItem ci = (ClipboardItem)this.Items[e.Index];

            /*e.Graphics.DrawString(ci.Name, this.Font, Brushes.Black, new PointF(2 + e.Bounds.X, 2 + e.Bounds.Y));
            e.Graphics.DrawString(ci.AddtionalInfo, this.AddtionalInfoFont, Brushes.Gray, new PointF(2 + e.Bounds.X, 15 + e.Bounds.Y));*/
            TextRenderer.DrawText(e.Graphics, ci.Name, this.Font, e.Bounds, Color.Black, Color.Transparent,
                TextFormatFlags.Top | TextFormatFlags.Left | TextFormatFlags.EndEllipsis | TextFormatFlags.SingleLine);
            TextRenderer.DrawText(e.Graphics, ci.AddtionalInfo, this.AddtionalInfoFont, e.Bounds, Color.Gray, Color.Transparent,
                TextFormatFlags.Bottom | TextFormatFlags.Left);

            base.OnDrawItem(e);
        }
开发者ID:cborrow,项目名称:Clips,代码行数:30,代码来源:ClipsListBox.cs


示例3: OnDrawItem

 protected override void OnDrawItem(DrawItemEventArgs e)
 {
     Graphics g = e.Graphics;
     Color BlockColor = Color.Empty;
     int left = RECTCOLOR_LEFT;
     if (e.State == DrawItemState.Selected || e.State == DrawItemState.None)
         e.DrawBackground();
     if (e.Index == -1)
     {
         BlockColor = SelectedIndex < 0 ? BackColor : DesignerUtility.ColorFromHtml(this.Text, Color.Empty);
     }
     else
         BlockColor = DesignerUtility.ColorFromHtml((string)this.Items[e.Index], Color.Empty);
     // Fill rectangle
     if (BlockColor.IsEmpty && this.Text.StartsWith("="))
     {
         g.DrawString("fx", this.Font, Brushes.Black, e.Bounds);
     }
     else
     {
         g.FillRectangle(new SolidBrush(BlockColor), left, e.Bounds.Top + RECTCOLOR_TOP, RECTCOLOR_WIDTH,
             ItemHeight - 2 * RECTCOLOR_TOP);
     }
     base.OnDrawItem(e);
 }
开发者ID:bittercoder,项目名称:reportingcloud,代码行数:25,代码来源:ColorPicker.cs


示例4: cmb_Connection_DrawItem

        private void cmb_Connection_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index < 0)
                return;

            ComboBox combo = sender as ComboBox;
            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
                e.Graphics.FillRectangle(new SolidBrush(SystemColors.Highlight),
                    e.Bounds);
            else
                e.Graphics.FillRectangle(new SolidBrush(combo.BackColor),
                    e.Bounds);

            string text = combo.Items[e.Index].ToString();
            if (!MainV2.MONO)
            {
                text = text + " " + SerialPort.GetNiceName(text);
            }

            e.Graphics.DrawString(text, e.Font,
                new SolidBrush(combo.ForeColor),
                new Point(e.Bounds.X, e.Bounds.Y));

            e.DrawFocusRectangle();
        }
开发者ID:duyisu,项目名称:MissionPlanner,代码行数:25,代码来源:ConnectionControl.cs


示例5: OnDrawItem

        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            base.OnDrawItem(e);

            //Draw play button
            e.Graphics.DrawImage(PlayButtonImage, e.Bounds.GetPlayButtonRectangleFromItemRectangle());
        }
开发者ID:RiceTea,项目名称:HardwareMonitor,代码行数:7,代码来源:SoundResourcesRadioListBox.cs


示例6: CustomItemDrawData

        /// <summary>
        /// Creates a new instance of the <see>CustomItemDrawData</see> object.
        /// </summary>
        /// <param name="args">The <see>DrawItemEventArgs</see> on which this instance is based.</param>
        /// <param name="itemToDraw">The object to render.</param>
        public CustomItemDrawData(DrawItemEventArgs args, object itemToDraw)
            : base(args.Graphics, args.Font, args.Bounds, args.Index, args.State, args.ForeColor, args.BackColor)
        {
            Debug.Assert(!object.ReferenceEquals(null, itemToDraw));

            m_item = itemToDraw;
        }
开发者ID:Mofsy,项目名称:jinxbot,代码行数:12,代码来源:CustomItemDrawData.cs


示例7: OnDrawItem

 /// <summary>
 /// Raises the <see cref="E:System.Windows.Forms.ListBox.DrawItem"/> event.
 /// </summary>
 /// <param name="e">A <see cref="T:System.Windows.Forms.DrawItemEventArgs"/> that contains the event data.</param>
 protected override void OnDrawItem(DrawItemEventArgs e)
 {
     if (DesignMode ||
         !ControlHelper.DrawListItem<KeyValuePair<GameMessage, string>>(Items, e,
             x => new KeyValuePair<string, string>(x.Key.ToString(), x.Value)))
         base.OnDrawItem(e);
 }
开发者ID:wtfcolt,项目名称:game,代码行数:11,代码来源:GameMessageValueListBox.cs


示例8: QuickSearchComboBox_DrawItem

        /// <summary>
        /// drawns the icon and the name of the element in the dropdown list
        /// </summary>
        /// <param name="sender">the sender</param>
        /// <param name="e">the params</param>
        private void QuickSearchComboBox_DrawItem(object sender, DrawItemEventArgs e)
        {
            //get the selected element and its associated image
            if (0 <= e.Index && e.Index  < this.Items.Count)
            {
                UML.Extended.UMLItem selectedElement = this.Items[e.Index] as UML.Extended.UMLItem;
                if (selectedElement != null)
                {
                    Image elementImage = this.navigatorVisuals.getImage(selectedElement);
                    //draw standard background and focusrectangle
                    e.DrawBackground();
                    e.DrawFocusRectangle();

                    //draw the name of the element
                    e.Graphics.DrawString(this.navigatorVisuals.getNodeName(selectedElement), e.Font, new SolidBrush(e.ForeColor),
                                          new Point(elementImage.Width + 2,e.Bounds.Y));
                    // draw the icon
                    e.Graphics.DrawImage(elementImage, new Point(e.Bounds.X, e.Bounds.Y));

                    // draw tooltip
                    if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
                    {
                         this.itemTooltip.Show(selectedElement.fqn,
                            this, e.Bounds.Right, e.Bounds.Bottom);
                    }
                    else
                    {
                        this.itemTooltip.Hide(this);
                    }
                }
            }
        }
开发者ID:GeertBellekens,项目名称:Enterprise-Architect-Toolpack,代码行数:37,代码来源:QuickSearchComboBox.cs


示例9: comboBox2_DrawItem

 private void comboBox2_DrawItem(object sender, DrawItemEventArgs e)
 {
     Rectangle listBound = e.Bounds;
     Font listFond = null;
     switch (e.Index)
     {
         case 0:
             listFond = new Font(e.Font, FontStyle.Regular);
             break;
         case 2:
             listFond = new Font(e.Font, FontStyle.Bold);
             break;
         case 1:
             listFond = new Font(e.Font, FontStyle.Italic);
             break;
         case 3:
             listFond = new Font(e.Font, FontStyle.Bold|FontStyle.Italic);
             break;
     }
     string str = comboBox2.Items[e.Index].ToString();
     Brush bru = new SolidBrush(Color.Black);
     Graphics g = e.Graphics;
     if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
     {
         g.FillRectangle(new SolidBrush(Color.FromArgb(0xFF,0x33,0x99,0xFF)), listBound);
         g.DrawString(str, listFond, new SolidBrush(Color.White), listBound);
     }
     else
     {
         g.FillRectangle(new SolidBrush(Color.White), listBound);
         g.DrawString(str, listFond, bru, listBound);
     }
 }
开发者ID:WolfForMoon,项目名称:Local-C-Sharp-Code,代码行数:33,代码来源:Form2.cs


示例10: Drawitem

		public void Drawitem(object sender, DrawItemEventArgs e)
		{
			if (e.Index < 0)
				return;
			e.DrawBackground();
			e.DrawFocusRectangle();

			e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
			e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
			e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
			e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

			//-- if selected
			if (e.State.ToString().IndexOf("Selected,") >= 0)
			{
				//-- Base
				e.Graphics.FillRectangle(new SolidBrush(_SelectedColor), new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));

				//-- Text
				e.Graphics.DrawString(" " + ListBx.Items[e.Index].ToString(), new Font("Segoe UI", 8), Brushes.White, e.Bounds.X, e.Bounds.Y + 2);
			}
			else
			{
				//-- Base
				e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(51, 53, 55)), new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));

				//-- Text 
				e.Graphics.DrawString(" " + ListBx.Items[e.Index].ToString(), new Font("Segoe UI", 8), Brushes.White, e.Bounds.X, e.Bounds.Y + 2);
			}

			e.Graphics.Dispose();
		}
开发者ID:CookieYT,项目名称:FlatUI,代码行数:32,代码来源:FlatListBox.cs


示例11: SecurityCB_DrawItem

        private void SecurityCB_DrawItem(object sender, DrawItemEventArgs e)
        {
            // If the index is invalid then simply exit.
            if (e.Index == -1 || e.Index >= SecurityCB.Items.Count)
            {
                return;
            }

            // Draw the background of the item.
            e.DrawBackground();

            // Should we draw the focus rectangle?
            if ((e.State & DrawItemState.Focus) != 0)
            {
                e.DrawFocusRectangle();
            }

            Font f = new Font(e.Font, FontStyle.Regular);
            // Create a new background brush.
            Brush b = new SolidBrush(e.ForeColor);
            // Draw the item.
            Security security = (Security)SecurityCB.Items[e.Index];
            string name = security.ToString();
            SizeF s = e.Graphics.MeasureString(name, f);
            e.Graphics.DrawString(name, f, b, e.Bounds);
        }
开发者ID:tomasfrizu,项目名称:GXDLMSDirector,代码行数:26,代码来源:AuthenticationGmacForm.cs


示例12: lstFunnel_DrawItem

 private void lstFunnel_DrawItem(object sender, DrawItemEventArgs e)
 {
     dontRefresh = true;
     e.DrawBackground();
     FontStyle fs = FontStyle.Regular;
     Brush b = Brushes.Black;
     if (unselectableFunnelLines.Contains(e.Index))
     {
         b = Brushes.Gray;
         fs = FontStyle.Italic;
         if (e.State.HasFlag(DrawItemState.Selected))
         {
             //b = Brushes.White;
             lstFunnel.SelectedIndex = -1;
             lstFunnel.Invalidate();
         }
         e.Graphics.DrawString(lstFunnel.Items[e.Index].ToString(), new Font("Microsoft Sans Serif", 8, fs), b, e.Bounds);
     }
     else
     {
         if (e.State.HasFlag(DrawItemState.Selected)) b = Brushes.White;
         e.Graphics.DrawString(lstFunnel.Items[e.Index].ToString(), new Font("Microsoft Sans Serif", 8, fs), b, e.Bounds);
         e.DrawFocusRectangle();
     }
     dontRefresh = false;
 }
开发者ID:emote-project,项目名称:Scenario1,代码行数:26,代码来源:frmConflictResolution.cs


示例13: OnDrawItem

        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (e.Index < 0 || e.Index >= Items.Count) return;

            var item = (Item)this.Items[e.Index];

            var image = item.Title;

            var drawWidth = (int)(image.Width * scalingFactor);
            var drawHeight = (int)(image.Height * scalingFactor);

            var destRect = new Rectangle(e.Bounds.Location,
                new Size(drawWidth, drawHeight));

            // we need to manually add xMargin to the offset again, as it's
            // already subtracted from the actual list width in GetListWidth
            destRect.Offset((GetListWidth() - drawWidth + xMargin) / 2, yMargin);

            // background
            e.Graphics.FillRectangle(Brushes.Black, e.Bounds);

            // separator
            if (e.Index > 0)
            {
                e.Graphics.DrawLine(Pens.DimGray,
                    e.Bounds.Left + 5, e.Bounds.Top + 1,
                    e.Bounds.Right - 5, e.Bounds.Top + 1);

                destRect.Offset(0, 3);
            }

            // title
            e.Graphics.DrawImage(image, destRect,
                new Rectangle(new Point(), image.Size), GraphicsUnit.Pixel);
        }
开发者ID:Ventero,项目名称:Diablo3ItemCollage,代码行数:35,代码来源:ItemListBox.cs


示例14: OnDrawItem

 /// <summary>
 /// Custom Draw Item Handler.
 /// It fires when painting each item in dropdown list. We use item value (text) to create the path to picture in resource and paint it in the list.
 /// </summary>
 /// <param name="e">Arguments from DrawItem Event</param>
 protected override void OnDrawItem(DrawItemEventArgs e)
 {
     // Draw background and focus rectangle, if necessary.
     e.DrawBackground();
     e.DrawFocusRectangle();
     // If something is selected, paint it
     if (e.Index > -1)
     {
         // Get text from current item
         var text     = (string)Items[e.Index];
         // Get resource path to picture
         var resource = string.Format("HSCardGenerator.Resources.Images.Flags.{0}.png", text.ToLower());
         // Read it as stream
         using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource))
         {
             // And paint it
             e.Graphics.DrawImage(Image.FromStream(stream), new PointF(e.Bounds.X, e.Bounds.Y));
         }
         // Draw text if necessary
         if (showLabels)
         {
             // Same as for OnPaint event
             var txt    = Config.localesFull[(int)Methods.General.getLocaleFromString(text)];
             var limits = e.Graphics.MeasureString(txt, e.Font);
             var top    = (24 - limits.Height) / 2;
             e.Graphics.DrawString(txt, e.Font, new SolidBrush(e.ForeColor), e.Bounds.Left + 24, e.Bounds.Top + top);
         }
         // We need to do this, no wonder why :/
         if ((e.Index == SelectedIndex) && (DroppedDown == false))
         {
             e.DrawFocusRectangle();
         }
     }
 }
开发者ID:hugojcastro,项目名称:HSCardCreator,代码行数:39,代码来源:FlagComboBox.cs


示例15: DrawPanel

        public virtual void DrawPanel(DrawItemEventArgs e)
        {
            string text = base.Text;
            if ((text != null) && (text.Length != 0))
            {
                int num = 0;
                StringFormat format = new StringFormat(StringFormatFlags.NoWrap);
                format.LineAlignment = StringAlignment.Center;
                format.HotkeyPrefix = HotkeyPrefix.Hide;
                format.Trimming = StringTrimming.EllipsisCharacter;
                switch (base.Alignment)
                {
                    case HorizontalAlignment.Right:
                        format.Alignment = StringAlignment.Far;
                        break;

                    case HorizontalAlignment.Center:
                        format.Alignment = StringAlignment.Center;
                        break;

                    default:
                        format.Alignment = StringAlignment.Near;
                        num = 3;
                        break;
                }
                Rectangle layoutRectangle = new Rectangle((e.Bounds.X + 1) + num, e.Bounds.Y, (e.Bounds.Width - 2) - num, e.Bounds.Height);
                e.Graphics.DrawString(base.Text, base.Parent.Font, SystemBrushes.ControlText, layoutRectangle, format);
                format.Dispose();
            }
            this.DrawPanelBorder(e);
        }
开发者ID:ikvm,项目名称:webmatrix,代码行数:31,代码来源:MxStatusBarPanel.cs


示例16: xxcbDrawItem

        private void xxcbDrawItem(object sender, DrawItemEventArgs e)
        {
            //drawItems here
            if (sender == null)
                return;
            if (e.Index < 0)
                return;
            //Get the Combo from the sender object
            ComboBox cbo = (ComboBox)sender;
            //Get the FontFamily from put in constructor
            FontFamily ff = new FontFamily(cbo.Items[e.Index].ToString());
            //Set font style
            FontStyle fs = FontStyle.Regular;
            if (!ff.IsStyleAvailable(fs))
                fs = FontStyle.Italic;
            if (!ff.IsStyleAvailable(fs))
                fs = FontStyle.Bold;
            //Set font for drawing with (wich is the font itself)
            Font font = new Font(ff, 8, fs);

            //draw the background and focus rectangle
            e.DrawBackground();
            e.DrawFocusRectangle();
            //get graphics
            Graphics g = e.Graphics;
            //And draw with whatever font and brush we wish
            g.DrawString(font.Name, font, Brushes.ForestGreen, e.Bounds.X, e.Bounds.Y);

        }
开发者ID:dbbotkin,项目名称:PrimeComm,代码行数:29,代码来源:FontBrowser.cs


示例17: OnDrawItem

        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.ListBox.DrawItem"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.DrawItemEventArgs"/> that contains the event data.</param>
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (DesignMode)
            {
                base.OnDrawItem(e);
                return;
            }

            // Get the selected emitter to draw
            var emitter = (e.Index < 0 || e.Index >= Items.Count ? null : Items[e.Index]) as IParticleEmitter;

            // Let the base implementation handle an invalid item
            if (emitter == null)
            {
                base.OnDrawItem(e);
                return;
            }

            // Draw the item
            e.DrawBackground();

            var txt = string.Format(_displayTextFormat, emitter.GetType().Name, emitter.Name);
            using (var brush = new SolidBrush(e.ForeColor))
            {
                e.Graphics.DrawString(txt, e.Font, brush, e.Bounds);
            }

            e.DrawFocusRectangle();
        }
开发者ID:wtfcolt,项目名称:game,代码行数:33,代码来源:ParticleEmitterListBox.cs


示例18: OnDrawItem

        /// <summary>
        /// Owner drawing listview item.
        /// </summary>
        protected void OnDrawItem( DrawItemEventArgs e, PluginListItem item )
        {
            e.DrawBackground();

            // IsRunnning bitmap
            const int imageWidth = 16+3;
            if(imageList==null)
                imageList = ((PluginDialog)Parent).ImageList;
            if(imageList!=null)
            {
                int imageIndex = item.PluginInfo.IsCurrentlyLoaded ? 0 : 1;
                imageList.Draw(e.Graphics, e.Bounds.Left+2, e.Bounds.Top+1, imageIndex);
            }

            // Name
            Rectangle bounds = Rectangle.FromLTRB(e.Bounds.Left+imageWidth,
                e.Bounds.Top, e.Bounds.Left+Columns[0].Width, e.Bounds.Bottom);
            using(Brush brush = new SolidBrush(e.ForeColor))
                e.Graphics.DrawString(item.Name, e.Font, brush, bounds);

            // Check box (Load at startup)
            bounds = Rectangle.FromLTRB(bounds.Right+1,
                bounds.Top, bounds.Right+Columns[1].Width+1, bounds.Bottom-1);
            ButtonState state = item.PluginInfo.IsLoadedAtStartup ? ButtonState.Checked : ButtonState.Normal;
            ControlPaint.DrawCheckBox(e.Graphics, bounds, state);
        }
开发者ID:paladin74,项目名称:Dapple,代码行数:29,代码来源:PluginListView.cs


示例19: OnDrawItem

    protected override void OnDrawItem(DrawItemEventArgs e)
    {
      Graphics grfx = e.Graphics;
      Rectangle rectColor = new Rectangle(e.Bounds.Left, e.Bounds.Top, 2 * e.Bounds.Height, e.Bounds.Height);
      rectColor.Inflate(-1, -1);

      Rectangle rectText = new Rectangle(e.Bounds.Left + 2 * e.Bounds.Height,
        e.Bounds.Top,
        e.Bounds.Width - 2 * e.Bounds.Height,
        e.Bounds.Height);

      if (this.Enabled)
        e.DrawBackground();

      LinearGradientShape item = e.Index >= 0 ? (LinearGradientShape)Items[e.Index] : LinearGradientShape.Linear;

      Rectangle rectShape = new Rectangle(rectColor.X + rectColor.Width / 4, rectColor.Y, rectColor.Width / 2, rectColor.Height);
      using (LinearGradientBrush br = new LinearGradientBrush(rectShape, e.ForeColor, e.BackColor, LinearGradientMode.Horizontal))
      {
        if (item == LinearGradientShape.Triangular)
          br.SetBlendTriangularShape(0.5f);
        else if (item == LinearGradientShape.SigmaBell)
          br.SetSigmaBellShape(0.5f);

        grfx.FillRectangle(br, rectColor);
      }
      SolidBrush foreColorBrush = new SolidBrush(e.ForeColor);
      grfx.DrawString(item.ToString(), Font, foreColorBrush, rectText);
    }
开发者ID:Altaxo,项目名称:Altaxo,代码行数:29,代码来源:LinearGradientShapeComboBox.cs


示例20: OnDrawItem

        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            // base.OnDrawItem(e);

            Graphics g = e.Graphics;
            Rectangle rectBounds = e.Bounds;
            Rectangle rectFill = new Rectangle(rectBounds.Left + 2,
                rectBounds.Top + 2, rectBounds.Width - 4, rectBounds.Height - 4);

            bool bFocused = (((e.State & DrawItemState.Focus) != DrawItemState.None) ||
                ((e.State & DrawItemState.Selected) != DrawItemState.None));

            // e.DrawBackground();
            // e.DrawFocusRectangle();
            using(SolidBrush sbBack = new SolidBrush(bFocused ?
                SystemColors.Highlight : SystemColors.Menu))
            {
                g.FillRectangle(sbBack, rectBounds);
            }

            using(SolidBrush sb = new SolidBrush(m_clr))
            {
                g.FillRectangle(sb, rectFill);
            }
        }
开发者ID:rdealexb,项目名称:keepass,代码行数:25,代码来源:ColorMenuItem.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.DrawListViewColumnHeaderEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Forms.DragEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap