• <legend id='LwDgt'><style id='LwDgt'><dir id='LwDgt'><q id='LwDgt'></q></dir></style></legend>

    <small id='LwDgt'></small><noframes id='LwDgt'>

      <i id='LwDgt'><tr id='LwDgt'><dt id='LwDgt'><q id='LwDgt'><span id='LwDgt'><b id='LwDgt'><form id='LwDgt'><ins id='LwDgt'></ins><ul id='LwDgt'></ul><sub id='LwDgt'></sub></form><legend id='LwDgt'></legend><bdo id='LwDgt'><pre id='LwDgt'><center id='LwDgt'></center></pre></bdo></b><th id='LwDgt'></th></span></q></dt></tr></i><div id='LwDgt'><tfoot id='LwDgt'></tfoot><dl id='LwDgt'><fieldset id='LwDgt'></fieldset></dl></div>

    1. <tfoot id='LwDgt'></tfoot>
          <bdo id='LwDgt'></bdo><ul id='LwDgt'></ul>

        如何使 ListBox 中的某些项目变为粗体?

        时间:2023-10-07
          <tbody id='9AuhI'></tbody>
        • <bdo id='9AuhI'></bdo><ul id='9AuhI'></ul>
            <i id='9AuhI'><tr id='9AuhI'><dt id='9AuhI'><q id='9AuhI'><span id='9AuhI'><b id='9AuhI'><form id='9AuhI'><ins id='9AuhI'></ins><ul id='9AuhI'></ul><sub id='9AuhI'></sub></form><legend id='9AuhI'></legend><bdo id='9AuhI'><pre id='9AuhI'><center id='9AuhI'></center></pre></bdo></b><th id='9AuhI'></th></span></q></dt></tr></i><div id='9AuhI'><tfoot id='9AuhI'></tfoot><dl id='9AuhI'><fieldset id='9AuhI'></fieldset></dl></div>

              <legend id='9AuhI'><style id='9AuhI'><dir id='9AuhI'><q id='9AuhI'></q></dir></style></legend>

                • <small id='9AuhI'></small><noframes id='9AuhI'>

                  <tfoot id='9AuhI'></tfoot>

                • 本文介绍了如何使 ListBox 中的某些项目变为粗体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 Visual c# Express Edition 中,是否可以将 ListBox 中的某些(但不是全部)项目设为粗体?我在 API 中找不到任何类型的选项.

                  In Visual c# Express Edition, is it possible to make some (but not all) items in a ListBox bold? I can't find any sort of option for this in the API.

                  推荐答案

                  需要将listbox的DrawMode改为DrawMode.OwnerDrawFixed.查看 msdn 上的这些文章:
                  DrawMode 枚举
                  ListBox.DrawItem 事件
                  Graphics.DrawString 方法

                  You need to change listbox's DrawMode to DrawMode.OwnerDrawFixed. Check out these articles on msdn:
                  DrawMode Enumeration
                  ListBox.DrawItem Event
                  Graphics.DrawString Method

                  在msdn论坛上也看看这个问题:
                  关于列表框项目的问题

                  Also look at this question on msdn forums:
                  Question on ListBox items

                  一个简单的例子(两个项目 - Black-Arial-10-Bold):

                  A simple example (both items - Black-Arial-10-Bold):

                   public partial class Form1 : Form
                   {
                      public Form1()
                      {
                          InitializeComponent();
                  
                          ListBox1.Items.AddRange(new Object[] { "First Item", "Second Item"});
                          ListBox1.DrawMode = DrawMode.OwnerDrawFixed;
                      }
                  
                      private void ListBox1_DrawItem(object sender, DrawItemEventArgs e)
                      {
                          e.DrawBackground();
                          e.Graphics.DrawString(ListBox1.Items[e.Index].ToString(), new Font("Arial", 10, FontStyle.Bold), Brushes.Black, e.Bounds);
                          e.DrawFocusRectangle();
                      }
                   }
                  

                  这篇关于如何使 ListBox 中的某些项目变为粗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:C#中的列表框刷新() 下一篇:在列表框中设置所选项目而不循环

                  相关文章

                • <small id='c8f9a'></small><noframes id='c8f9a'>

                  1. <legend id='c8f9a'><style id='c8f9a'><dir id='c8f9a'><q id='c8f9a'></q></dir></style></legend>
                    <tfoot id='c8f9a'></tfoot>

                      <bdo id='c8f9a'></bdo><ul id='c8f9a'></ul>
                      <i id='c8f9a'><tr id='c8f9a'><dt id='c8f9a'><q id='c8f9a'><span id='c8f9a'><b id='c8f9a'><form id='c8f9a'><ins id='c8f9a'></ins><ul id='c8f9a'></ul><sub id='c8f9a'></sub></form><legend id='c8f9a'></legend><bdo id='c8f9a'><pre id='c8f9a'><center id='c8f9a'></center></pre></bdo></b><th id='c8f9a'></th></span></q></dt></tr></i><div id='c8f9a'><tfoot id='c8f9a'></tfoot><dl id='c8f9a'><fieldset id='c8f9a'></fieldset></dl></div>