Using SnapsToDevicePixels in OnRender

I have a class derived from FrameworkElement

where I override the method OnRender

to draw multiple lines. I would like the behavior to SnapsToDevicePixels

work with my primitive control, what's the best way to do this?

I know GuidelineSet

how to use them as well, but looking at some of the sample elements in the .NET Reference Source they weren't used and I didn't see anything that counted SnapsToDevicePixels

in the overrides OnRender

. Only a few parts UIElement

do anything with it in the method Arrange

, but the property works on Rectangle

s.

It seems to me that checking the property SnapsToDevicePixels

is equal true

and then clicking GuidelineSet

on drawingContext

would be a naive approach, and I thought (hoped) there was a better way to enable it.

This is true? If so, how should I develop methods OnRender

to use SnapsToDevicePixels

?

+3
wpf rendering


source to share


No one has answered this question yet

Check out similar questions:

7
WPF Decorator class useful?
6
WPF Canvas - Single Pixel Grid
five
How to dynamically draw a timeline in WPF
2
How does drawing with DrawingContext in OnRender work behind the scenes?
1
WPF - adding ContentControl to custom canvas
1
Frames per second using WPF DrawingContext class
1
Best way to write custom sizing control in WPF?
1
Transferring video to a specific region on the canvas
0
Silverlight / WPF: DependencyProperty.AddOwner & Render on Change
0
Form-derived class



All Articles
Loading...
X
Show
Funny
Dev
Pics