(GDI) Scheduler Control

.
Scheduler Control


Introduction

This is a simple scheduler control created using plain GDI API. Lines drawing done using MoveToEx and LineTo. Coloring done using FillRect. All wrapped up in one class CScheculerCtrl without any MFC (though the demo project is in MFC).


How to Use

Initialization: (e.g.: in OnInitDialog)

//left margin: 40px, top margin: 25px
m_mySchedulerCtrl.Init(40, 25);




Painting: (e.g.: in OnPaint)
m_mySchedulerCtrl.Paint(dc.GetSafeHdc());


On mouse hover handling (e.g.: in OnMouseMove )
	CDC* pDC = GetDC();

    //rect structs that will hold changed regions coordinates
    //in case you are using a memroy DC and want to only paint updated regions only
    //to the final DC
	RECT rc1, rc2;
	memset(&rc1, 0, sizeof(rc1));
	memset(&rc2, 0, sizeof(rc2));

	m_mySchedulerCtrl.OnMouseMove(pDC->GetSafeHdc(), point.x, point.y, &rc1, &rc2);
	ReleaseDC(pDC);


Mouse click handling, in OnLButtonDown:
	CDC* pDC = GetDC();

	RECT rc;
	memset(&rc, 0, sizeof(rc));

	m_mySchedulerCtrl.OnMouseLClick(pDC->GetSafeHdc(), point.x, point.y, &rc);
	ReleaseDC(pDC);


History

19 FEB 11: first release.

.
.

Comments are closed on this post.