![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
The line you are drawing is going to be 5 pixels wide. You know the difference in X & Y coordinates.
Find the extremes of the cells you are connecting (depends on the orientation of the line, but you only need the "outside" two). Step through in jumps of 1 real pixel & flag/fill the cells you need. Incidentally, I think you may be in for trouble if you connect a "vertical" line from top to bottom, with a 1 "box" step to one side. Your current strategy will give you a 2 pixel line, top to bottom. I think you want to join the cell centres, moving from X1,Y1 to X2,Y2 in SQRT([(X2-X1)*(X2-X1)]+[(Y2-Y1)*(Y2-Y1)])/5 real pixel steps (Pythagorus). Flag the cell you are in, using whatever grid record system you have established.
|
|
||||
|
LineCutter,
Thank you for your response. I think that I might be tackiling the problem in completely the wrong way. My App draws the grid on the Forelayer using FLine, as shown in the code below. Code:
Sub DrawGrid Designer.ForeLayer=True Designer.Fline(Designer.Width-170,10,Designer.Width-10,165,cBlack,B) For Row=0 To 15 Designer.Fline(Designer.Width-170,10+(10*Row),Designer.Width-10,15+(10*Row),cBlack,B) Next For Col=0 To 15 Designer.Fline(Designer.Width-165+(10*Col),10,Designer.Width-160+(10*Col),165,cBlack,B) Next Designer.Line(Designer.Width-170,10,Designer.Width-10,165,cWhite,BF) Designer.FLine(10,10,Designer.Width-170,165,cBlack,B) End Sub It was my intention to draw the line and then locate each part of the grid that contained the line and fill the entire 5x5 square. I've managed to draw the line wherever the user wants it but fallen over when it comes to trying to determine which parts to fill. Do I need to use an array or matrix kind of approach? How does MS Paint Brush calculate a line, my program will be very simple in that the uses a mousedown event for the start position and the end position will be set by the point that the mouseup event is fired. I'd love to be able to show and update the position of the line as it is being drawn but this is beyond my ability I think. Is it time to go back to the drawing-board (pardon the pun) and start again ![]() Regards, RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
|
||||
|
I guess that the mechanism for drawing a line is determined by how you store the result, which in itself is determined by how you are going to get the data to save as an icon.
I'd assumed a 32x32 array of pixels, drawn to a hidden image & then saved. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| simple code: Draw line on the form | xiaoye.org | Code Samples & Tips | 3 | 09-04-2008 01:54 PM |
| draw line into image control | giannimaione | Questions & Help Needed | 4 | 06-03-2008 05:40 PM |
| How to draw a line on a panel? | yildi | Questions & Help Needed | 6 | 02-29-2008 04:05 PM |
| Draw line on TabControl? | Standa | Questions & Help Needed | 2 | 01-19-2008 11:38 AM |
| Draw/Shapes | bdiscount | Code Samples & Tips | 5 | 12-04-2007 12:30 PM |