PC Review


Reply
Thread Tools Rate Thread

BUG in GDI whit zoom ?

 
 
davide rocchelli
Guest
Posts: n/a
 
      17th May 2004
I have found a probable bug when you draw with GDI.
Look this simple code

Private Sub Form1_Paint(ByVal sender As Object, ByVal e
As System.Windows.Forms.PaintEventArgs) Handles
MyBase.Paint

Const Zoom As Single = 0.001
Dim p As Pen

'line incriminate
e.Graphics.SmoothingMode =
Drawing2D.SmoothingMode.AntiAlias

'clear
e.Graphics.Clear(Color.Black)
'zoom
e.Graphics.ScaleTransform(Zoom, Zoom)
'create a pen
p = New Pen(Color.Red, 1)
p.DashPattern = New Single() {5, 5}
'draw line (adjusted to zoom)
e.Graphics.DrawLine(p, (Me.ClientRectangle.Left /
Zoom), (Me.ClientRectangle.Top / Zoom),
(Me.ClientRectangle.Right / Zoom),
(Me.ClientRectangle.Bottom / Zoom))
End Sub

If you set SmoothingMode to AntiAlias or HighQuality the
line is ok: the dash pattern is what you want. But if you
set SmoothingMode to another value, the pattern is
oscene, idem if you set p.DashStyle = DashStyle.Dash (or
other value except Solid) without use DashPattern. If
yout don't use the zoom (ScaleTransform) you have no
problem.

With personal Pattern you must do this to have the
desired pattern

p.DashPattern = New Single() {5 / Zoom, 5 / Zoom}

but if you use this line with e.Graphics.SmoothingMode =
Drawing2D.SmoothingMode.AntiAlias (or HightQuality) the
line's style is obsene.

The right action is with
Drawing2D.SmoothingMode.AntiAlias: if I set thath i want
a line, I want a line, not a trash 'cause i make a
zoom ...

Suggestion ? I must calculate then pattern depending the
quality, and this not good ...

Davide.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help! Print Preview Zoom is Grayed Out...Doesn't zoom. PK Microsoft Excel Misc 0 20th Jul 2009 03:33 PM
Ctrl+Mouse Wheel = Zoom In or Zoom Out? StevenM Microsoft Word New Users 1 11th Jul 2008 05:52 PM
zoom in &zoom out in VBA User Form youu917@gmail.com Microsoft Excel Programming 0 21st Jan 2008 04:59 AM
Fast zoom or zoom telephoto lens =?Utf-8?B?S2F5TVIgY2FyZGJvYXJkIGJveA==?= Microsoft Frontpage 5 13th May 2005 03:31 AM
How to Zoom on a Slide Content Without Using the Zoom Addin Mallinath Microsoft Powerpoint 2 18th Jul 2004 11:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:08 AM.