Good GUI Interface

D

dhawal

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
 
C

Christian Resma Helle

For UI design we relly completely on our graphic artist. The only problem is
that the better the design gets the longer it takes to implement it
 
G

Germán Schuager

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.

The "technology" would be owner-drawn and custom controls.

--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded communityhttp://community.OpenNETCF.com


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.
 
C

Chris Tacke, eMVP

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 community
http://community.OpenNETCF.com

Germán Schuager said:
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.

The "technology" would be owner-drawn and custom controls.

--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded communityhttp://community.OpenNETCF.com


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.
 
S

Simon Hart [MVP]

I don't *think* Silverlight is supported on CE 6 anyway, only Mobile 6 onwards.

Have you looked at DirectX there is a managed API for this if you want more
appealing UI, otherwise good old GDI is available.
 
G

Germán Schuager

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.
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.
 
S

Simon Hart [MVP]

What good will a video be? Show us some code ;)
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


Germán Schuager said:
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

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.

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.
 
G

Germán Schuager

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 ;)
--
Simon Hart
Visual Developer - Device Application Development MVPhttp://simonrhart.blogspot.com

Germán Schuager said:
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.
 
G

Germán Schuager

I'd like to hear some comments.
I'm wondering whether this is a common behaviour or I'm doing
something wrong.


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.
 
S

Simon Hart [MVP]

It does appear to be quite slow doesn't it.

I don't quite understand your code.

What does GetDoubleBufferGraphics look like and why are you always calling
it is it reusing a Bitmap object?

Also you don't appear to be cleaning anything up or are these brushes,
colours etc being re-used?

Show us the RenderDoubleBuffer method.

As you seem to be rendering the UI yourself, why are you calling
base.OnPaint()?
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


Germán Schuager said:
I'd like to hear some comments.
I'm wondering whether this is a common behaviour or I'm doing
something wrong.


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 ;)
:
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

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.

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.
 
G

Germán Schuager

Here they are:

static public Graphics GetDoubleBufferGraphics(int w, int h)
{
if (_doubleBufferBitmap == null) {
_doubleBufferBitmap = new Bitmap(w, h);
_doubleBufferGraphics = Graphics.FromImage(_doubleBufferBitmap);
}
else {
if (w>_doubleBufferBitmap.Width || h>_doubleBufferBitmap.Height) {
_doubleBufferBitmap.Dispose();
_doubleBufferGraphics.Dispose();
_doubleBufferBitmap = new Bitmap(w, h);
_doubleBufferGraphics = Graphics.FromImage(_doubleBufferBitmap);
}
}
return _doubleBufferGraphics;
}

public static void RenderDoubleBuffer(Graphics g, int w, int h)
{
if (_doubleBufferBitmap != null)
g.DrawImage(_doubleBufferBitmap, 0, 0, new Rectangle(0, 0, w, h),
GraphicsUnit.Pixel);
}

These methods are used to maintain only one Bitmap and only one
Graphics (to draw onto that bitmap) between all the controls that
requiere double-buffering.
And yes, things like GUtil.SolidBrush1 are also reused by several
owner-drawn controls.

The motivation for this approach is to "prevent" the Garbage Collector
to run too often. I only instanciate a new Bitmap/Graphics pair when I
need a bigger buffer.

About base.OnPaint() here is what the documentation says:
"Notes to Inheritors:
When overriding OnPaint in a derived class, be sure to call the base
class's OnPaint method so that registered delegates receive the
event."

Probabbly I could remove this call, but I really don't think that this
is causing the problem.

Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top