さて、私は私のデザインに固執し始め、スタイルを正しくし始めています。
私のテーマはkryptonFormスタイルのGUIを使用していますが、kyryptonFormsには事前に設計されたListViewがないため、これを自分で作成する必要があります
私のアプリケーションはXMPP/Jabberに基づくメッセンジャーシステムであるため、連絡先リストをどのように設計するかを推測できます。
私はほとんどのポジショニングを行いましたが、各コンタクト行のスタイリングに苦労しています。
MSNLiveメッセンジャーの連絡先リストに透明なオーバーレイシマーラーを目指しています
これが私のOnDrawイベントコードatmであり、グラデーションを実行するための最良の方法を見つけるのに苦労しています。
private void ContactItem_OnPaintDraw(object sender, DrawListViewItemEventArgs e)
{
Rectangle ImageRect = e.Bounds;
ImageRect.Inflate(-2, -2);
ImageRect.Width = 32;
Rectangle TextRect = e.Bounds;
TextRect.X = ImageRect.Right + 2;
TextRect.Width = e.Bounds.Width - TextRect.X;
Rectangle IconRect = TextRect;
IconRect.Inflate(-1, 0);
IconRect.Y = ImageRect.Bottom - 16;
IconRect.Width = 16;
IconRect.Height = 16;
if ((e.State & ListViewItemStates.Selected) != 0)
{
// Draw the background and focus rectangle for a selected item.
e.Graphics.FillRectangle(ContactListBackgroundBrush, e.Bounds);
e.DrawFocusRectangle();
}
else
{
// Draw the background for an unselected item.
e.Graphics.FillRectangle(Brushes.White, e.Bounds);
}
if (ListViewContacts.View != View.Details)
{
e.Graphics.DrawImage((Image)Resources.UserIconDefault, ImageRect);
TextRenderer.DrawText(e.Graphics, e.Item.Text, e.Item.Font, TextRect, e.Item.ForeColor, TextFormatFlags.GlyphOverhangPadding);
}
}
そして、ContactListBackgroundBrush
varはそのようなものです
private Brush ContactListBackgroundBrush = new SolidBrush(Color.FromArgb(33, 162, 191));
これは、スタイル付き要素に変換する必要があります
代替テキストhttp://screensnapr.com/u/yeq8o0.png
アプリはWindowsXPでも使用されるため、特定のWindows7DLLファイルをインポートせずにこの強調表示されたスタイルを取得しようとしています。
皆さんが私を助けてくれることを願っています:)