VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Outlook Style Day View Control

by Anson Delaware (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (8 Votes)

This ActiveX control attempts to duplicate the Day View of the Outlook 2002 Calendar. As of yet, the code is sloppy and not well commented...but it works quite nicely! This control relies on GDI32 calls.
You will notice that the highlighting of time slots can not yet be persisted (I already have a plan for this, it just needs to be implemented), that means that every resize or scroll event will wipe any white highlights off the screen.
I am submitting this earlier than I wanted to because I would like some feedback (cut me some slack on the code-comments though because I haven't had much time to clean it up!) and advice on anything at all. Keep in mind that I already intend on persisting data, allowing font and color changes, 'on-the-fly' resizing and dragging of appointments, and allowing week, month, and year views.
This control is a lot of work and rather time consuming so, if you feel so inclined, please vote for it!

Inputs
No input parameters yet.
Assumes
This was (as you can see from the screenshot) developed on WinXP. I have no idea if it will work on another OS.
Code Returns
N/A.
Side Effects
None that I am aware of.
API Declarations
Plenty, see for yourself:
Currently, the code mostly relies on MoveToEx, CreateSolidBrush, LineTo, ShowText, DeleteObject, FillRect and CreatePen.
'GDI32 Declares for drawing
Public Declare Function CreateBrushIndirect Lib "gdi32" (lpLogBrush As LOGBRUSH) As Long
Public Declare Function CreateFont Lib "gdi32" Alias "CreateFontA" (ByVal H As Long, ByVal W As Long, ByVal E As Long, ByVal O As Long, ByVal W As Long, ByVal I As Long, ByVal u As Long, ByVal S As Long, ByVal C As Long, ByVal OP As Long, ByVal CP As Long, ByVal Q As Long, ByVal PAF As Long, ByVal F As String) As Long
Public Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
Public Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Public Declare Function FillRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long, ByVal hbrush As Long) As Long
Public Declare Function GetRgnBox Lib "gdi32" (ByVal hRgn As Long, lpRect As RECT) As Long
Public Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Public Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, lpPoint As POINT_TYPE) As Long
Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Public Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
Public Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As Long
Public Declare Function SetTextAlign Lib "gdi32" (ByVal hdc As Long, ByVal wFlags As Long) As Long
Public Declare Function SetTextColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
Public Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
'User32 Declares
Public Declare Function DrawFocusRect Lib "user32" (ByVal hdc As Long, lpRect As RECT) As Long
Public Declare Function FillRect Lib "user32" (ByVal hdc As Long, lpRect As RECT, ByVal hbrush As Long) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare Function IntersectRect Lib "user32" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long
Public Declare Function IsRectEmpty Lib "user32" (lpRect As RECT) As Long
Public Declare Function RedrawWindow Lib "user32" (ByVal hwnd As Long, lprcUpdate As Any, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long
Public Declare Function SetRectEmpty Lib "user32" (lpRect As RECT) As Long
Public Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long

Rate Outlook Style Day View Control

Upload

Download this snippet    Add to My Saved Code

Outlook Style Day View Control Comments

No comments have been posted about Outlook Style Day View Control. Why not be the first to post a comment about Outlook Style Day View Control.

Post your comment

Subject:
Message:
0/1000 characters