RSS Feed

TimeIsMoney 0.2.2 – Colored items in ComboBox

What’s New

  • 0.2.2
    • Task reminder
    • Priority Graphic

Task reminder

image

There is a new option in settings.

By selecting a task list with items to be reminded, the engine analyses the contents and notifies the user about items nearing the due date or with low estimated time.

Priority Graphic

image

Another addition in this version is a new Priority coloring. Application uses custom ListBox which overrides the drawing method to create items in different colors.

image

Same effect is applied on the priority  ComBox If you want to get this effect. Create custom ComboBox and override the OnDrawItem method.


1 public class ColorAbleComboBox : ComboBox 2 { 3 protected override void OnDrawItem(DrawItemEventArgs e) 4 { 5 if (e.Index >= 0) 6 { 7 Rectangle rect = new Rectangle( 8 e.Bounds.X, e.Bounds.Y, 9 e.Bounds.Width, e.Bounds.Height); 10 11 if (e.Index <= 3) 12 { 13 Color col = Color.FromArgb(0,255-(e.Index*60),0); 14 SolidBrush greenBrush = new SolidBrush(col); 15 e.Graphics.FillRectangle(greenBrush, rect); 16 } 17 else if (e.Index > 3 && e.Index <= 7) 18 { 19 Color col = Color.FromArgb(0, 0, 255 - ((e.Index-4) * 60)); 20 SolidBrush blueBrush = new SolidBrush(col); 21 e.Graphics.FillRectangle(blueBrush, rect); 22 } 23 else if (e.Index > 7) 24 { 25 Color col = Color.FromArgb(255 - ((e.Index - 8) * 60), 0,0 ); 26 SolidBrush redBrush = new SolidBrush(col); 27 e.Graphics.FillRectangle(redBrush, rect); 28 } 29 e.Graphics.DrawString(Items[e.Index].ToString(), 30 Font, new SolidBrush(Color.White), new PointF(rect.X, rect.Y)); 31 } 32 } 33 }

This code assumes that there are more than seven items in the box.

Important !! If you want items to draw on your overloaded method you need to change a property DrawMode from Normal to Either OwnerDrawVariable or OwnerDrawFixed.

  • 0.2.3
    • changes in reminder
    • changes in notification logic
    • added NUnit tests to XmlAnalyser

Notification logic

Reminder is described in my previous post “Reminder Mechanism” . For notifications, I am using an abstract Notifier which is extended by specific classes like DueDateNotifier .  Reminder adds Notifiers to his list, and then is querying them asking if the user should be notified about them.

image

Next Week

  • 0.2.4
    • Report engine
    • UI in Wpf for reports engine
Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s