This page was last modified 11:47, 15 February 2008.
CS000824 - Drawing custom borders
From Forum Nokia Wiki
| ID | CS000824 | Creation date | February 15, 2008 |
| Platform | S60 3rd Edition S60 3rd Edition, FP1 S60 3rd Edition, FP2 | Tested on devices | Nokia E90 Communicator Nokia N95 8GB |
| Category | Symbian C++ | Subcategory | UI |
| APIs | None | Classes | CWindowGc CGraphicsContext TRect |
| Methods | CCoeControl::Draw |
Overview
This code snippet demonstrates how to draw a custom border around a GUI component.
This snippet can be self-signed.
Header file
Override the CCoeControl::Draw method.
// From CCoeControl
public:
// Draws the view.
void Draw(const TRect& aRect) const;
Source file
Define the color of the border:
#define KBorderColor TRgb(180, 0, 0)
The drawing is implemented in the CCoeControl::Draw method so that the border is drawn every time the view is drawn.
// Draws the view.
void CAppView::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
// Draw the border around the component (iComponent)
gc.SetBrushColor(KBorderColor);
TRect rect = iComponent->Rect();
// Enlarge the border rectangle so that it becomes visible. Without this,
// the rect would only contain the innards of the component, which will
// be obscured by the component itself.
rect.Grow(3, 3);
gc.DrawRect(rect);
}
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with S60 3rd FP1 device! Image "randomly" not TRANSPARENT | sandro1972 | Mobile Java Media (Graphics & Sounds) | 12 | 2008-05-19 16:36 |
| Drawing an indicator icon through system APIs | nsivach | General Symbian C++ | 0 | 2006-11-09 10:13 |
| How to make reliable connection between Nokia 6230 phone and a custom device | Fii | General Discussion | 2 | 2004-07-17 10:11 |
| Video flicker | ross666 | Mobile Java General | 6 | 2007-11-07 15:56 |
| Custom MIDI files as ringtones on 3650 | aehrath | General Symbian C++ | 1 | 2003-06-29 11:41 |

