|
Hi,
I developed a Slider UserControl to practice on VC2003 Framework 1.1. Now, i try to export the same control to VC2005 Framwork 2.0... but... oh my god, the Slider Control Blinks a lot, it's not an acceptable control.
Note:
Thumb.xxx is a Label.xxx
That's my draw routine:
private void OwnDraw() { PointF pStart = new PointF(0, 0); PointF pEnd = new PointF(0, this.Height);
LinearGradientBrush lgb1 = new LinearGradientBrush(pStart, pEnd, m_RightUpColor, m_RightDownColor); LinearGradientBrush lgb2 = new LinearGradientBrush(pStart, pEnd, m_LeftUpColor, m_LeftDownColor);
doublebuff = (Image)new Bitmap(this.Width, this.Height); Graphics g = Graphics.FromImage(doublebuff);
g.FillRectangle(lgb1, 0, 0, Thumb.Left, this.Height); g.FillRectangle(lgb2, Thumb.Left + Thumb.Width, 0, this.Width, this.Height);
this.Invalidate(); }
Paint User control event:
private void hslider_Paint(object sender, PaintEventArgs e) { this.BackgroundImage = doublebuff; }
Update hSlider ( property value ): public int Value { get { return m_Value; } set { if (this.m_Update == true) { if (value <= m_Max) m_Value = value; else m_Value = m_Max;
if (value >= m_Min) m_Value = value; else m_Value = m_Min;
ReallocateThumb(); this.OwnDraw(); } } }
Some suggestion/tips... are wellcome. Thanks.
|