Here's the video where you can see what I'm talking about:
And here is the OnPaintBackground and OnPaint methods of one of my
controls:
protected override void OnPaintBackground(PaintEventArgs e)
{
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = GUtil.GetDoubleBufferGraphics(Width, Height);
valueRect.X = _innerMargin;
valueRect.Y = _innerMargin;
valueRect.Width = Width - 2 * _innerMargin;
valueRect.Height =
(int)GUtil.GetDoubleBufferGraphics(Width,
Height).MeasureString(_value, ValueFont).Height;
unitRect.X = _innerMargin;
unitRect.Width = Width - 2 * _innerMargin;
unitRect.Height = (int)
GUtil.GetDoubleBufferGraphics(Width,
Height).MeasureString(_unit, UnitFont).
Height;
unitRect.Y = Height - unitRect.Height - _innerMargin;
if (Parent != null)
g.Clear(Parent.BackColor);
GUtil.Draw3DRoundedBox(
g,
ClientRectangle,
Style3d.Sunken,
_shadowColor,
_highlightColor,
_midtoneColor,
_backColor
);
GUtil.SolidBrush1.Color = _valueColor;
g.DrawString(_value, ValueFont, GUtil.SolidBrush1,valueRect,
GUtil.RightStringFormat);
if (_showUnit) {
GUtil.SolidBrush1.Color = _unitColor;
g.DrawString(_unit, UnitFont, GUtil.SolidBrush1, unitRect,
GUtil.RightStringFormat);
}
GUtil.RenderDoubleBuffer(e.Graphics, Width, Height);
base.OnPaint(e);
}
GUtil is a static class used to:
- implement double-buffering with a single Bitmap object for all the
controls that require this feature.
- common drawing functionality.
- object caching
What good will a video be? Show us some code
Germán Schuager said:
On 10 abr, 09:31, "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com>
wrote:
Then you're probably not handling repaints properly. There should be no
difference between an owner-drawn and a system drawn control in this
regard - they both have to paint their client areas with every cycle..
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded communityhttp://community.OpenNETCF.com
You could use flash.
I am in a project where every control that I'm using is owner-drawn.
You can make you UI to look good, but there are some annoying issues,
for example the screen refresh... you can see how the system "draws"
every control; it gives an ugly choppy feeling. I haven't found a way
to work this out yet.
On 10 abr, 00:04, "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com>
wrote:
The "technology" would be owner-drawn and custom controls.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded communityhttp://community.OpenNETCF.com
Hi,
If I ish to create a good appealing gui interface with compact
framework[windows CE 6] what technologies should I need to
use??[Silverlight
on mobile is not yet out]. If anyone could suggest me in this regard or
point
me in the right direction it would be of great help.
tx
May be I'm doing something wrong.
May be is the actual behaviour. I will try to take a short video to
show you what I mean.