当前位置: 首页>>代码示例>>C#>>正文


C# DrawListViewSubItemEventArgs.DrawText方法代码示例

本文整理汇总了C#中System.Windows.Forms.DrawListViewSubItemEventArgs.DrawText方法的典型用法代码示例。如果您正苦于以下问题:C# DrawListViewSubItemEventArgs.DrawText方法的具体用法?C# DrawListViewSubItemEventArgs.DrawText怎么用?C# DrawListViewSubItemEventArgs.DrawText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.DrawListViewSubItemEventArgs的用法示例。


在下文中一共展示了DrawListViewSubItemEventArgs.DrawText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: listView_DrawSubItem

        private void listView_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            if (e.ColumnIndex == 1)
            {
                using (var ms = new MemoryStream())
                {
                    using (var sw = new StreamWriter(ms))
                    {
                        sw.Write(e.SubItem.Text);
                        sw.Flush();
                        ms.Seek(0, SeekOrigin.Begin);

                        var rtb = new RichTextBox();
                        {
                            rtb.BorderStyle = BorderStyle.None;
                            rtb.LoadFile(ms, RichTextBoxStreamType.RichText);
                            rtb.Location = e.SubItem.Bounds.Location;
                            rtb.Size = e.SubItem.Bounds.Size;
                            rtb.Parent = sender as Control;

                            var bmp = new Bitmap(128, 32);
                            rtb.DrawToBitmap(bmp, rtb.DisplayRectangle);
                            //bmp.Save("test.bmp");

                            e.Graphics.DrawImageUnscaledAndClipped(bmp, e.SubItem.Bounds);
                            //e.DrawBackground();
                            //e.Graphics.DrawString(rtb.Text, SystemFonts.DefaultFont, SystemBrushes.ControlText, e.SubItem.Bounds);
                        }
                    }
                }
            }
            else
            {
                e.DrawBackground();
                e.DrawText();
            }
        }
开发者ID:oojjrs,项目名称:Nuri4,代码行数:37,代码来源:TextForm.cs

示例2: listView_DrawSubItem

 private void listView_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
 {
     e.DrawBackground();
     e.DrawText();
 }
开发者ID:strillo,项目名称:ServiceBusExplorer,代码行数:5,代码来源:PartitionListenerControl.cs

示例3: listView_DrawSubItem

 /*************************************************************
  * CSVリストビューを縞模様に描画
  *************************************************************/
 private void listView_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
 {
     // 奇数行の場合は背景色を変更し、縞々に見えるようにする
     if (e.ItemIndex % 2 > 0)
     {
         e.Graphics.FillRectangle(Brushes.Azure, e.Bounds);
     }
     // テキストを忘れずに描画する
     e.DrawText();
 }
开发者ID:takashi0419,项目名称:CostAccounting,代码行数:13,代码来源:Form_Prepare_ProductReg.cs

示例4: listViewFilterItem_DrawSubItem

 private void listViewFilterItem_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
 {
     e.DrawText();
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:4,代码来源:WlbReportCustomFilter.cs

示例5: listView_DrawSubItem

 private void listView_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
 {
     Brush brush;
     Color backColor;
     Color foreColor;
     if (e.Item.Selected)
     {
         if (listView.Focused)
         {
             brush = SystemBrushes.Highlight;
             backColor = SystemColors.Highlight;
             foreColor = SystemColors.HighlightText;
         }
         else
         {
             // We use the same colors here as TreeViewMS does for
             // drawing unfocused selected rows.
             brush = Brushes.LightGray;
             backColor = Color.LightGray;
             foreColor = SystemColors.WindowText;
         }
     }
     else
     {
         brush = SystemBrushes.Window;
         backColor = SystemColors.Window;
         foreColor = SystemColors.WindowText;
     }
     if (e.ColumnIndex == 0)
     {
         // Erase the entire background when drawing the first sub-item
         e.Graphics.FillRectangle(brush, e.Item.Bounds);
     }
     if (e.ColumnIndex == colHdrDisplayText.Index)
     {
         var findResult = (FindResult) e.Item.Tag;
         var textRendererHelper = new TextRendererHelper
                                      {
                                          ForeColor = foreColor,
                                          BackColor = backColor,
                                          Font = e.Item.Font,
                                          HighlightFont = new Font(e.Item.Font, FontStyle.Bold),
                                      };
         textRendererHelper.DrawHighlightedText(e.Graphics, e.SubItem.Bounds, findResult.FindMatch);
     }
     else
     {
         e.SubItem.ForeColor = foreColor;
         e.DrawText();
     }
     if (e.ColumnIndex == 0)
     {
         e.DrawFocusRectangle(e.Bounds);
     }
 }
开发者ID:lgatto,项目名称:proteowizard,代码行数:55,代码来源:FindResultsForm.cs

示例6: nodeListView_DrawSubItem

        private void nodeListView_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            if (e.ColumnIndex > 0)
            {
                Rectangle bounds = e.SubItem.Bounds;

                if (e.Item.Selected)
                {
                    e.Graphics.FillRectangle(HL_BRUSH, bounds);
                    e.SubItem.ForeColor = SystemColors.HighlightText;
                }
                else
                {
                    e.Graphics.FillRectangle(new SolidBrush(e.Item.BackColor), bounds);
                    e.SubItem.ForeColor = e.Item.ForeColor;
                }

                e.DrawText(TextFormatFlags.VerticalCenter);
                e.Graphics.DrawLine(LINE_PEN, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom);
            }
            else
            {
                e.DrawDefault = true;
            }
        }
开发者ID:sschocke,项目名称:BrainSimulator,代码行数:25,代码来源:NodeSelectionForm.cs

示例7: DrawSubItem

        private void DrawSubItem(DrawListViewSubItemEventArgs e, decimal Width, bool Focused)
        {
            Rectangle rect, origrect = e.Bounds;
            if (Focused)
                e.Graphics.FillRectangle(SystemBrushes.Highlight, origrect); // Draw the background and focus rectangle for a selected item.
            else
                e.Graphics.FillRectangle(new SolidBrush(e.Item.BackColor), origrect); // Draw the background for an unselected item.

            origrect.X += 1;
            origrect.Y += 1;
            origrect.Height -= 3;
            origrect.Width -= 3;
            rect = origrect;
            e.Graphics.FillRectangle(new SolidBrush(e.Item.BackColor), rect);
            rect.Width = (int)((double)Width / 100.0 * origrect.Width);

            if (rect.Width > 0 && rect.Height > 0)
            {
                Brush br;
                if (Program.Settings.NoGradientTorrentList)
                    br = new SolidBrush(Color.LimeGreen);
                else
                    br = new LinearGradientBrush(rect, Color.ForestGreen, Color.LightGreen, LinearGradientMode.Horizontal);

                e.Graphics.FillRectangle(br, rect);
            }
            e.Graphics.DrawRectangle(LightLightGray, origrect);
            e.DrawText(TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter);
        }
开发者ID:miracle091,项目名称:transmission-remote-dotnet,代码行数:29,代码来源:MainWindow.cs

示例8: DrawSubItem

 private void DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
 {
     TextFormatFlags flag = e.ColumnIndex > 0 ? TextFormatFlags.HorizontalCenter : TextFormatFlags.Left;
     e.DrawBackground();
     e.DrawText(flag);
 }
开发者ID:khoavnguyen,项目名称:cs333,代码行数:6,代码来源:DisplayForm.cs

示例9: listView_DrawSubItem

        void listView_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            // 選択されている場合
            if (e.Item.Selected) {
                e.Graphics.FillRectangle(Brushes.LightGray, e.Bounds);
            } else {
                // 自デバイス宛のパケットだけ色を変える
                if (Adapter != null) {
                    if(e.Item.Tag.ToString().ToUpper() == Adapter.Mac.ToUpper()){
                        e.Graphics.FillRectangle(Brushes.LightSteelBlue, e.Bounds);
                    }
                }
            }

            // テキストを描画
            e.DrawText();
        }
开发者ID:furuya02,项目名称:HideAndSeek,代码行数:17,代码来源:CaptureView.cs

示例10: lvServerBrowser_DrawSubItem

        private void lvServerBrowser_DrawSubItem(Object sender, DrawListViewSubItemEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                Image imgLock = Properties.Resources.theLock;
                Image imgUnlock = Properties.Resources.theUnlock;

                if (lvServerBrowser.Items[e.ItemIndex].SubItems[e.ColumnIndex].Text.Equals("true"))
                {
                    e.Graphics.DrawImage(imgLock, lvServerBrowser.Items[e.ItemIndex].SubItems[e.ColumnIndex].Bounds.Location);
                }
                else
                {
                    e.Graphics.DrawImage(imgUnlock, lvServerBrowser.Items[e.ItemIndex].SubItems[e.ColumnIndex].Bounds.Location);
                }
                e.DrawFocusRectangle(lvServerBrowser.Items[e.ItemIndex].SubItems[e.ColumnIndex].Bounds);
            }
            else
            {
                e.DrawText();
            }
        }
开发者ID:LaocheXe,项目名称:1stCavDiv-Launcher,代码行数:22,代码来源:ServerBrowser.cs

示例11: OnListViewDrawSubItem

        private void OnListViewDrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            //Controller.WriteLine("e.SubItem.Name: {0}", e.SubItem.Text);

            if (!e.SubItem.Text.Contains("23"))
            {
                e.DrawDefault = true;
                return;
            }

            //e.DrawBackground();
            if ((e.ItemState & ListViewItemStates.Selected) == ListViewItemStates.Selected)
            {
                //
            }

            Rectangle b = new Rectangle(e.Bounds.Left + e.Bounds.Width / 4, e.Bounds.Top, e.Bounds.Width / 2, e.Bounds.Height);
            e.Graphics.FillRectangle(SystemBrushes.Highlight, b);

            e.DrawText(TextFormatFlags.Default);
        }
开发者ID:apakian,项目名称:buggazer,代码行数:21,代码来源:DBWinListView.cs

示例12: lstShow_DrawSubItem

        private void lstShow_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            if (e.ColumnIndex > 0)
            {
                e.DrawBackground();

                string searchTerm = "";
                int index = e.SubItem.Text.IndexOf(searchTerm);

                if (index >= 0)
                {
                    string sBefore = e.SubItem.Text.Substring(0, index);

                    Size bounds = new Size(e.Bounds.Width, e.Bounds.Height);
                    Size s1 = TextRenderer.MeasureText(e.Graphics, sBefore, this.Font, bounds);
                    Size s2 = TextRenderer.MeasureText(e.Graphics, searchTerm, this.Font, bounds);

                    Rectangle rect = new Rectangle(e.Bounds.X + s1.Width, e.Bounds.Y, s2.Width, e.Bounds.Height);

                    e.Graphics.SetClip(e.Bounds);
                    e.Graphics.FillRectangle(new SolidBrush(Color.Yellow), rect);
                    e.Graphics.ResetClip();
                }

                e.DrawText();
            }
        }
开发者ID:RisenZhang,项目名称:SignalAnalize,代码行数:27,代码来源:LogSearch.cs

示例13: lvWindows_DrawSubItem

        private void lvWindows_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            GameWindow window = Windows[e.ItemIndex];
            if (lastForegroundWindow == window.HWnd)
            {
                // Draw the background and focus rectangle for a selected item.
                e.Graphics.FillRectangle(Brushes.Maroon, e.Bounds);
            }
            else if (ActiveWindow == window)
            {
                // Draw the background and focus rectangle for a selected item.
                e.Graphics.FillRectangle(
                    new SolidBrush(System.Drawing.SystemColors.Highlight),
                    e.Bounds
                );
            }

            if (e.ColumnIndex == 0)
            {
                if (e.Item.Checked)
                {
                    ControlPaint.DrawCheckBox(e.Graphics, e.Bounds.X + 1, e.Bounds.Top + 1, 14, 14, ButtonState.Normal | ButtonState.Checked);
                }
                else
                {
                    ControlPaint.DrawCheckBox(e.Graphics, e.Bounds.X + 1, e.Bounds.Top + 1, 14, 14, ButtonState.Normal);
                }

                e.Graphics.DrawString(
                    e.Item.Text,
                    lvWindows.Font,
                    Brushes.Black,
                    new PointF(e.Bounds.X + 16, e.Bounds.Top + 1)
                );
            }
            else
            {
                e.DrawText(TextFormatFlags.VerticalCenter | TextFormatFlags.Left);
            }
        }
开发者ID:quadrowin,项目名称:afkgamer,代码行数:40,代码来源:MainForm.cs

示例14: lvLibrary_DrawSubItem

        void lvLibrary_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            TextFormatFlags flags = TextFormatFlags.Left;

            using (StringFormat sf = new StringFormat()) {
                // Store the column text alignment, letting it default
                // to Left if it has not been set to Center or Right.
                switch (e.Header.TextAlign) {
                    case HorizontalAlignment.Center:
                        sf.Alignment = StringAlignment.Center;
                        flags = TextFormatFlags.HorizontalCenter;
                        break;
                    case HorizontalAlignment.Right:
                        sf.Alignment = StringAlignment.Far;
                        flags = TextFormatFlags.Right;
                        break;
                }

                // Draw the text and background for a subitem with a
                // negative value.
                double subItemValue;
                if (e.ColumnIndex > 0 && Double.TryParse(
                    e.SubItem.Text, NumberStyles.Currency,
                    NumberFormatInfo.CurrentInfo, out subItemValue) &&
                    subItemValue < 0) {
                    // Unless the item is selected, draw the standard
                    // background to make it stand out from the gradient.
                    if ((e.ItemState & ListViewItemStates.Selected) == 0) {
                        e.DrawBackground();
                    }

                    // Draw the subitem text in red to highlight it.
                    e.Graphics.DrawString(e.SubItem.Text,
                        lvLibrary.Font, Brushes.Red, e.Bounds, sf);

                    return;
                }

                // Draw normal text for a subitem with a nonnegative
                // or nonnumerical value.
                e.DrawText(flags);
            }
        }
开发者ID:Lords08,项目名称:alanarduinotools,代码行数:43,代码来源:UcLibraryList.cs

示例15: OnDrawSubItem

        private static void OnDrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            if (e.Header.Index > 0)
            {
                TextFormatFlags tff = TextFormatFlags.Left;
                // Workout the text alignment
                switch (e.Header.TextAlign)
                {
                    case HorizontalAlignment.Center:
                        tff = TextFormatFlags.HorizontalCenter;
                        break;
                    case HorizontalAlignment.Right:
                        tff = TextFormatFlags.Right;
                        break;
                }

                // draw the strings
                e.DrawText(tff);
            }
        }
开发者ID:killbug2004,项目名称:WSProf,代码行数:20,代码来源:BaseView.cs


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