I just wanted to let everyone know that I’ve posted piDogScrollingCanvas v1.0
I’m pretty happy with the result. I’ve optimized things pretty tightly and use all native rendering for each platform. The only place I might be able to make significant improvements would be using GL under windows. I’ll be expanding on the example list view subclass and adding more custom controls based on piDogScrollingCanvas in the future.
There are too many features/capabilities to list so please check out the demo project and docs. There is also a link to download builds of the demo project. More Info
There is not, but you could add the week to the first day cell.
Something like this…
Function CellTextPaint(g as graphics, d As Date) As Boolean
if d.DayOfWeek=me.StartOfWeek+1 then
dim tSize As Integer=g.TextSize
dim weekText As String="Week "+Str(d.WeekOfYear)
g.TextSize=tSize //To set the textsize back to original for drawing the day number
I’ll be putting together a tutorial to better explain how everything works, but the basic idea is that you can treat the scrollingLayer and dragLayer as you would treat a regular canvas, but the size is not locked to the size of the control. The StaticLayer works pretty much the way a generic canvas would work, but rendered above the other layers.
You can set an area to be redrawn by calling RefreshRectScrollingLayer, RefreshRectDragLayer, or RefreshRectStaticLayer.
Then when the associated paint event (PaintScrollingLayer, PaintDragLayer or PaintOverlayLayer) fires, you can redraw the content within the area needing a redraw using the passed offsets and zoom factor.
The layers will redraw from the bottom up. For example, if you refreshed a rectangle in the scrolling layer, the PaintDragLayer and PaintOverlayLayer events will fire with the appropriate offsets to draw into the same rectangle.
The listView is at this point really just meant to be an example of how the canvas could be used. Take a look at the Paint method of the ListItem Class within the piDogSimpleListView Module. That is where the drawing happens. The ListItem class is essentially just an object that can contain data, display the data and contain instances of ListItem.
Firstly, this control is great. One question, what’s the best way to save the entire piDogScrollingCanvas as a JPEG or PNG? I’m basically using it as a simple way to resize a photo (ScrollingLayer Picture) and then add labels (custom drawn arrows, on the DraggableLayer).
Also, is it possible to stop the user from zooming out too far? Currently, there doesn’t seem to be an elegant way to stop zooming out when the entire image is visible on the screen (normal expected behaviour).
[quote=87921:@Garry Pettet]Also, is it possible to stop the user from zooming out too far? Currently, there doesn’t seem to be an elegant way to stop zooming out when the entire image is visible on the screen (normal expected behaviour).
You could add an event handler for the Magnify Event (I’m assuming this is under OSX with trackpad zooming)
[code]Function Magnify(Zoom As Double,x as Double,y as double) As boolean
dim minZoom As Double= min(me.width/me.ScrollingLayerWidth,me.Height/me.ScrollingLayerHeight)
dim newZoom As Double=me.Zoom+Zoom
if newZoom<minZoom then
Although I think the Zoom parameter should probably be the value that zoom will be after the event fires… currently it is essentially the zoomDelta value.