Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Text near a mousepointer, DrawImage function (Read 1004 times)
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Text near a mousepointer, DrawImage function
Apr 12th, 2009 at 8:10pm
Print Post  
Hi.

I need to show any text near a cursor while creating a link. So I use DrawString function in DrawLink event. But it seems area to draw is small for me and property Graphics of parameter e is readonly.

Now Im playing with some solutions and I found out that there is any increasing area around mouse cursor. Right part of text is not visible when Im moving cursor to right. But then when Im coming back to left averything is okay.

http://i43.tinypic.com/35lrfys.jpg


On this picture is shown increasing blinking area while Im moving a cursor. Thats the proof  Wink

http://i43.tinypic.com/raywqr.jpg

Im using this code for it (sub is called from DrawLink event):
Code
Select All
Public Sub DrawText(ByRef IoEvent As DrawLinkEventArgs, ByVal InX As Single, ByVal InY As Single)
   Dim font As Font = New Font("Arial", 12, FontStyle.Regular, GraphicsUnit.Pixel)
   Dim defaultIcon As Bitmap = New Bitmap(50, 50)
   Dim graphics As Graphics = graphics.FromImage(defaultIcon)

   IoEvent.Graphics.DrawString("abcdefg", font, Brushes.Blue, InX, InY)

   Dim g As Graphics = XtraForm1.fcDiagramView.CreateGraphics
   g.Clear(Color.Transparent)
   font.Dispose()
End Sub

 



Any help how to draw string or icon or whatever near a cursor?
Thx.

...MUDO...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Text near a mousepointer, DrawImage function
Reply #1 - Apr 13th, 2009 at 8:18am
Print Post  
For performance reasons the control redraws only the smallest possible area around a modified item. You could handle the LinkCreating event and there call Diagram.Invalidate(RectangleF) with a rectangle large enough to contain your text.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint