As you see attached picture, i have a boring case drawing crosshair on a globe, i am drawing crosshair with DrawMode=10 (Nor Xor Pen) therefore yor have draw line two times one for disappering one for redrawing you know. Hence when there is an another line under crosshair this time drawn line is boring little. Also i want crosshair to draw in solid color not chance with underlying color.
Is there an another drawing crosshair technique?
Last edited by BlueRose; Mar 5th, 2006 at 04:54 AM.
You can do while you think that you can do
If you think my answer solve your question, please rate it.
1. create a memory DC for a rectangle the height and width of your crosshairs.
before drawing the crosshairs draw to the memory DC what is on the map in the region of the crosshairs.
draw the crosshairs
to remove crosshairs, bitblt the memory DC back to the map
2. create a sprite using a usercontrol with a transparent background.
move the sprite on top of the map whereever the crosshairs are supposed to be
without seeing the rest od your code I cannot be more specific.
i wish i could sent whole code, but it is very complex and not writting in English
therefore i can show you a small part, code below is the calculation of corsshair points and drawing on screen, PicHolder is picturebox that grid is drawn on it
I hope you can understand the drawing idea of crosshair. Crosshair points are the longitude and latitude points of the globe.
is there sample that you stated?
VB Code:
'assignment
Private Type fCoord
X As Integer
Y As Integer
End Type
Private CrosshairScreen(0 To 1, 0 To 90) As fCoord
Private oldCrosshair(0 To 1, 0 To 90) As fCoord
'LatitudeX and LongitudeX are coordinates of mouse pointer on globe as longitude and latitude
'Covert3D is a function that convert globe coordinate Lat/Long to plane (or screen)
In a perfect world your method would work, however the points you calculate for the crosshairs don't all line-up with the lines on the graph. So you get the funny looking line.
Can you do this:
create a second hidden picturebox that holds the map picture without any crosshairs
To erase the old line simply Call Picture1.PaintPicture(picHidden.Picture, 0, 0)
Draw the new line using DrawMode vbCopyPen - 13.
If your picture is very big this probably will create some flicker.
Try this first, if it does not work then we can move to more complicated methods.
I've done your Crosshairs to work, but i could not find it satisfactory, project that i rearranged is attached look and test it youself, is it good enough or not?
I think the difficulty of this is to make crosshair visible everytime while the mouse is moving, therefore because the crosshair is slightly more big, time to rearrange and show the crosshair is getting much more long, but i think it must be a way to solve this.
What do you think about that?
You can do while you think that you can do
If you think my answer solve your question, please rate it.
thanks moeur
crosshair is slightly working good but there is still some flickering
and also when we move picture with RMB crosshair isn't updated and moving with picture and centered on picture1
is it some thing missing?
You can do while you think that you can do
If you think my answer solve your question, please rate it.
I've made more improvements. This is the best we can do I think. I use two usercontrols to double buffer the drawing. Also I needed to put the cursor redraw in both crosshais and picture mouse move events.