G
Guest
I am creating a custom control by setting control's .Region property to a region, created by manipulating GraphicsPath objects. Something like this
GraphicsPath oCirclePath = new GraphicsPath(FillMode.Alternate)
oCirclePath.AddEllipse(oRect)
Region oRegionCircle = new Region(oCirclePath)
Region oRegionCut = new Region(oRectCut)
oRegionCut.Xor(oRegionCircle)
oCtrlRegion.Exclude(oRegionCircle)
oCtrlRegion.Union(oRegionCut)
This code cuts a circle-like shape from the center of the control, so this control, like a frame, can mask off part of control below it (you can see through the cut-out part of the control)
The problem I am having is that the inside borders (edges) of the control are not really smooth. The circle visibly consists of small number of lines, making it look pretty bad. I am using SmoothingMode.AntiAlias for SmoothingMode anywehere I can --- it doesn't help
So, I guess the question is how to make it smoother? Also, I don't think I understand which object is responsible for drawing that border (.Region) -- is it the control itself or the control it's added to
I appreciate any suggestions
VR
GraphicsPath oCirclePath = new GraphicsPath(FillMode.Alternate)
oCirclePath.AddEllipse(oRect)
Region oRegionCircle = new Region(oCirclePath)
Region oRegionCut = new Region(oRectCut)
oRegionCut.Xor(oRegionCircle)
oCtrlRegion.Exclude(oRegionCircle)
oCtrlRegion.Union(oRegionCut)
This code cuts a circle-like shape from the center of the control, so this control, like a frame, can mask off part of control below it (you can see through the cut-out part of the control)
The problem I am having is that the inside borders (edges) of the control are not really smooth. The circle visibly consists of small number of lines, making it look pretty bad. I am using SmoothingMode.AntiAlias for SmoothingMode anywehere I can --- it doesn't help
So, I guess the question is how to make it smoother? Also, I don't think I understand which object is responsible for drawing that border (.Region) -- is it the control itself or the control it's added to
I appreciate any suggestions
VR