Click here to Skip to main content
16,005,121 members
Home / Discussions / C#
   

C#

 
Questionformatting a string Pin
teejayem22-Oct-06 14:59
teejayem22-Oct-06 14:59 
AnswerRe: formatting a string Pin
Edbert P22-Oct-06 15:15
Edbert P22-Oct-06 15:15 
AnswerRe: formatting a string Pin
Rob Philpott23-Oct-06 4:00
Rob Philpott23-Oct-06 4:00 
QuestionProblem with wmi for Get ProcessorId. Pin
hdv21222-Oct-06 14:10
hdv21222-Oct-06 14:10 
AnswerRe: Problem with wmi for Get ProcessorId. Pin
Dave Kreskowiak22-Oct-06 15:35
mveDave Kreskowiak22-Oct-06 15:35 
Questionproblem withTCPClient Pin
mohadcs22-Oct-06 13:52
mohadcs22-Oct-06 13:52 
AnswerRe: problem withTCPClient Pin
S. Senthil Kumar23-Oct-06 8:46
S. Senthil Kumar23-Oct-06 8:46 
QuestionListView OwnerDraw Question Pin
Guinness4Strength22-Oct-06 13:52
Guinness4Strength22-Oct-06 13:52 
I've derived my own GradientListView class from the ListView control to try and draw a gradient background. I'm able to draw the gradient background just fine by overriding the OnPaintBackground event, but the ListView items no longer appear in the ListView. Is it an all or nothing deal?....Do I need to handle all the painting events if I override one of them? If I comment out the SetStyle command in the constructor the ListView shows the items correctly, but obviously without the gradient background.

public GradientListView()
{
    //set styles
    SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
        ControlStyles.DoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
}

protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent)
{
    PaintRectangle(this.ClientRectangle, this.BackColor, Color.Black, pevent.Graphics);
}
protected void PaintRectangle(Rectangle Rect, Color RectColor, Color RectBorderColor, Graphics g)
{
    //draw rectangle
    Pen LinePen = new Pen(RectBorderColor, 10);
    g.DrawRectangle(LinePen, new Rectangle(Rect.X, Rect.Y, Rect.Width - 1, Rect.Height - 1));
    LinePen.Dispose();
    Rect = new Rectangle(Rect.X + 1, Rect.Y + 1, Rect.Width - 2, Rect.Height - 2);
    SolidBrush bgBrush = new SolidBrush(RectColor);
    g.FillRectangle(bgBrush, Rect);
    bgBrush.Dispose();
    LinearGradientBrush brush;
    Rectangle BottomRect;
    BottomRect = new Rectangle(Rect.X, Rect.Height-((int)(Rect.Height / 3)), Rect.Width, Rect.Height / 3);
    brush = new LinearGradientBrush(
        new Point(BottomRect.Width / 2, BottomRect.Top - 1),
        new Point(BottomRect.Width / 2, BottomRect.Bottom),
        RectColor,
        ControlPaint.Dark(RectColor));
    g.FillRectangle(brush, BottomRect);
    brush.Dispose();
}

AnswerRe: ListView OwnerDraw Question Pin
LongRange.Shooter23-Oct-06 4:18
LongRange.Shooter23-Oct-06 4:18 
GeneralRe: ListView OwnerDraw Question [modified] Pin
Guinness4Strength23-Oct-06 4:31
Guinness4Strength23-Oct-06 4:31 
Questionpass variables Pin
m.m._200722-Oct-06 7:02
m.m._200722-Oct-06 7:02 
AnswerRe: pass variables Pin
Michael P Butler22-Oct-06 7:19
Michael P Butler22-Oct-06 7:19 
AnswerRe: pass variables Pin
shabonaa22-Oct-06 16:45
shabonaa22-Oct-06 16:45 
QuestionDataTable.Select find rows within a specified column is null Pin
pcflasch22-Oct-06 6:21
pcflasch22-Oct-06 6:21 
AnswerRe: DataTable.Select find rows within a specified column is null Pin
Guffa22-Oct-06 6:34
Guffa22-Oct-06 6:34 
GeneralRe: DataTable.Select find rows within a specified column is null Pin
pcflasch22-Oct-06 7:32
pcflasch22-Oct-06 7:32 
QuestionCancel minimize problem Pin
Alocto22-Oct-06 4:40
Alocto22-Oct-06 4:40 
AnswerRe: Cancel minimize problem Pin
thegloomyclown22-Oct-06 6:14
thegloomyclown22-Oct-06 6:14 
GeneralRe: Cancel minimize problem Pin
Alocto22-Oct-06 7:26
Alocto22-Oct-06 7:26 
GeneralRe: Cancel minimize problem Pin
Stefan Troschuetz22-Oct-06 21:28
Stefan Troschuetz22-Oct-06 21:28 
QuestionShowDialog() problem Pin
thegloomyclown22-Oct-06 0:45
thegloomyclown22-Oct-06 0:45 
AnswerRe: ShowDialog() problem Pin
Alocto22-Oct-06 4:52
Alocto22-Oct-06 4:52 
GeneralRe: ShowDialog() problem Pin
thegloomyclown22-Oct-06 5:17
thegloomyclown22-Oct-06 5:17 
GeneralRe: ShowDialog() problem Pin
Alocto22-Oct-06 7:22
Alocto22-Oct-06 7:22 
GeneralRe: ShowDialog() problem Pin
thegloomyclown22-Oct-06 9:18
thegloomyclown22-Oct-06 9:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.