×
Namespaces

Variants
Actions
(Difference between revisions)

Drawing custom borders around a Symbian control

From Nokia Developer Wiki
Jump to: navigation, search
lpvalente (Talk | contribs)
m (Lpvalente -)
hamishwillee (Talk | contribs)
m (Hamishwillee - Unarchive and fix categories - this is still valid)
Line 1: Line 1:
[[Category:Symbian C++]][[Category:UI]][[Category:Code Snippet]][[Category:Code Snippet]][[Category:S60 3rd Edition FP1]][[Category:S60 3rd Edition FP2]][[Category:S60 3rd Edition (initial release)]]
+
[[Category:Symbian C++]][[Category:UI]]
{{Archived|timestamp=20120803210705|user=[[User:Lpvalente|Lpvalente]]}}
+
 
+
 
+
 
{{ArticleMetaData <!-- v1.2 -->
 
{{ArticleMetaData <!-- v1.2 -->
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
Line 30: Line 27:
 
==Overview==
 
==Overview==
  
{Abstract|{This code snippet demonstrates how to draw a custom border around a GUI component.}}
+
{{Abstract|This code snippet demonstrates how to draw a custom border around a GUI component.}}
  
 
==Header file==
 
==Header file==
Line 70: Line 67:
 
     }
 
     }
 
</code>
 
</code>
 +
 +
{{VersionHint}}
 +
[[Category:S60 3rd Edition (initial release)]] [[Category:S60 3rd Edition FP1]] [[Category:S60 3rd Edition FP2]]
 +
[[Category:S60 5th Edition]]
 +
[[Category:Symbian^3]] [[Category:Symbian Anna]] [[Category:Nokia Belle]]

Revision as of 08:22, 15 August 2012

Article Metadata
Tested with
Devices(s): Nokia E90 Communicator
Nokia N95 8GB
CompatibilityPlatform Security
Signing Required: Self Signed
Article
Keywords: CWindowGc, CGraphicsContext, TRect, CCoeControl::Draw
Created: tapiolaitinen (06 Feb 2008)
Last edited: hamishwillee (15 Aug 2012)

Contents

Overview

This code snippet demonstrates how to draw a custom border around a GUI component.

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

Version Hint

Windows Phone: [[Category:Windows Phone]]
[[Category:Windows Phone 7.5]]
[[Category:Windows Phone 8]]

Nokia Asha: [[Category:Nokia Asha]]
[[Category:Nokia Asha Platform 1.0]]

Series 40: [[Category:Series 40]]
[[Category:Series 40 1st Edition]] [[Category:Series 40 2nd Edition]]
[[Category:Series 40 3rd Edition (initial release)]] [[Category:Series 40 3rd Edition FP1]] [[Category:Series 40 3rd Edition FP2]]
[[Category:Series 40 5th Edition (initial release)]] [[Category:Series 40 5th Edition FP1]]
[[Category:Series 40 6th Edition (initial release)]] [[Category:Series 40 6th Edition FP1]] [[Category:Series 40 Developer Platform 1.0]] [[Category:Series 40 Developer Platform 1.1]] [[Category:Series 40 Developer Platform 2.0]]

Symbian: [[Category:Symbian]]
[[Category:S60 1st Edition]] [[Category:S60 2nd Edition (initial release)]] [[Category:S60 2nd Edition FP1]] [[Category:S60 2nd Edition FP2]] [[Category:S60 2nd Edition FP3]]
[[Category:S60 3rd Edition (initial release)]] [[Category:S60 3rd Edition FP1]] [[Category:S60 3rd Edition FP2]]
[[Category:S60 5th Edition]]
[[Category:Symbian^3]] [[Category:Symbian Anna]] [[Category:Nokia Belle]]

70 page views in the last 30 days.
×