本文整理匯總了C#中System.Windows.Forms.DrawListViewColumnHeaderEventArgs.DrawBackground方法的典型用法代碼示例。如果您正苦於以下問題:C# DrawListViewColumnHeaderEventArgs.DrawBackground方法的具體用法?C# DrawListViewColumnHeaderEventArgs.DrawBackground怎麽用?C# DrawListViewColumnHeaderEventArgs.DrawBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.DrawListViewColumnHeaderEventArgs
的用法示例。
在下文中一共展示了DrawListViewColumnHeaderEventArgs.DrawBackground方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: listView1_DrawColumnHeader
// Draws column headers.
private void listView1_DrawColumnHeader(object sender,
DrawListViewColumnHeaderEventArgs e)
{
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;
break;
case HorizontalAlignment.Right:
sf.Alignment = StringAlignment.Far;
break;
}
// Draw the standard header background.
e.DrawBackground();
// Draw the header text.
using (Font headerFont =
new Font("Helvetica", 10, FontStyle.Bold))
{
e.Graphics.DrawString(e.Header.Text, headerFont,
Brushes.Black, e.Bounds, sf);
}
}
return;
}
開發者ID:.NET開發者,項目名稱:System.Windows.Forms,代碼行數:31,代碼來源:DrawListViewColumnHeaderEventArgs.DrawBackground