rutmir Posted December 23, 2005 Posted December 23, 2005 Hi! Firstly, VERY GOOD WORK! I've been using your code for 5 days only. So able to inform you for one bug only. When you are just moving a mouse over the picture, it's taking 100% of the processor time. It's not good I think. For example because of this, the selection ants stop their moving and the top ruler indent are showed not correctly (it's jumping). I think that you should change the Value Set Property of the Ruler Class. Instead of forcing full redrawing of the rulers, place something like this: Graphics aGraphics = this.CreateGraphics(); IntPtr hDC = aGraphics.GetHdc(); PointF pt = scaleFactor.ScalePointJustX(new PointF(ClientRectangle.Left + aOldVal - Offset, ClientRectangle.Top)); SizeF size = new SizeF(Math.Max(1, scaleFactor.ScaleScalar(1.0f)), ClientRectangle.Height); pt.X -= 0.5f; Rectangle aRect = Rectangle.Truncate(new RectangleF(pt, size)); API32CSharp.RECT aRECT; aRECT.left = aRect.X; aRECT.top = aRect.Y; aRECT.right = aRect.Right; aRECT.bottom = aRect.Bottom; API32CSharp.Gdi.InvertRect(hDC, ref aRECT); pt = scaleFactor.ScalePointJustX(new PointF(ClientRectangle.Left + this.value - Offset, ClientRectangle.Top)); size = new SizeF(Math.Max(1, scaleFactor.ScaleScalar(1.0f)), ClientRectangle.Height); pt.X -= 0.5f; aRect = Rectangle.Truncate(new RectangleF(pt, size)); aRECT.left = aRect.X; aRECT.top = aRect.Y; aRECT.right = aRect.Right; aRECT.bottom = aRect.Bottom; API32CSharp.Gdi.InvertRect(hDC, ref aRECT); aGraphics.ReleaseHdc(hDC); aGraphics.Dispose(); Again thanks and with best regards Sorry for my English Quote
Rick Brewster Posted December 23, 2005 Posted December 23, 2005 Our rulers aren't drawn by inversion. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
rutmir Posted December 26, 2005 Author Posted December 26, 2005 Hi! I understand that they arent drawn by inversion. But the mark (values) of your rulers can be drawn by inversion. Or, if you dont like inversion, the same effect can be easily achived with BitBlt function. After these corrections it's needed of course to delete drawing functions for Ruler Value from DrawRuler method. Anyway it's not matter what way should be used, I want to say that it's not effective to redraw all the rulers every time when an user are just moving the mouse cursor over the picture. This full redrawing on my comp effects by taking 100% of the processor time. The last, in its turn, results not correct drawing the top ruler mark + stopping the selection ants moving. With best regards, rutmir Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.