1

さて、私は私のデザインに固執し始め、スタイルを正しくし始めています。

私のテーマは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);
        }
    }

そして、ContactListBackgroundBrushvarはそのようなものです

private Brush ContactListBackgroundBrush = new SolidBrush(Color.FromArgb(33, 162, 191));

これは、スタイル付き要素に変換する必要があります

代替テキストhttp://screensnapr.com/u/yeq8o0.png

アプリはWindowsXPでも使用されるため、特定のWindows7DLLファイルをインポートせずにこの強調表示されたスタイルを取得しようとしています。

皆さんが私を助けてくれることを願っています:)

4

1 に答える 1

1

ブラシをとして定義できます。msndのドキュメントLinearGradientBrushを探してください。これは私見で、グラデーションを描くための最良の方法です。

于 2010-07-19T20:09:34.773 に答える