Can some one help me with this. on a form I have placed two rounded rectangles Shape1 and Shape2 and 2 lines Line1 and Line2. The two rectangles will allways be side by side and aligned by top. I want the two lines to connect the rectangles top and bottom to produce a simple cross section display of a tube, the dimensions of which vary by varying the rectangles sizes (they are always both the same size)
The problem I have is that the top line <Line1> always connects perfectley but the bottom line <Line2> will not always align with the bottom of the two rectangles, and instead positions a fraction lower. the code I used to position the lines is this
alright delete your posts!
I don't think anyone will answer your questions if you act like that If you look at this forum you can see that most people got their questions answered fast and without any spamming...
I would hurry up deleting those posts if you expect any answers.
it's not his falt, the server is playing up, been happening a bit all over the forums.
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
I had no idea all my attempts ended up on the board, Ianpbaker is right, I had the devils only job trying to get it to accept the post, and when it did I thought all the other attempts were just lost.
Please accept my apologies, I'll keep an eye out if it happens again.
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Normally you'd view your post, click the 'edit' button, then near the top, tick the checkbox on the left, then click delete, on the left.
But as your posts are a bit wierd, only the admin can do this, as it didn't register your post.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
I don't think there's anything you can do
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Originally posted by Ray.T
Can anyone help me here as I am starting to go a bit loopy!!
Many thanks
Ray
You sure butchered the forum there pal!
Oh well, not your fault!
Anyway, have you got the scale mode of the form you're working on set to some custom scale, or is it set to pixels or twips? I always work in pixels as twips tend to do strange things to my applications.
See if that helps...
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
I'm not sure exactly what you want, so here a bit that may help.
VB Code:
'The code below gets each corner of a shape.
TopLeftX = Shape.Left
TopLeftY = Shape.Top
TopRightX = Shape.Left + Shape.Width
TopRightY = Shape.Top
BottomLeftX = Shape.Left
BottomLeftY = Shape.Top + Shape.Height
BottomRightX = Shape.Left + Shape.Width
BottomRightY = Shape.Top + Shape.Height
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Don't mention it.
There's no need to apologize, it wasn't your fault.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Here is a screen shot of the trial form to clarify things abit.
The darker shapes dimensions are taken from the left hand set of text boxes and the cyan coloured from the right. As I vary the bottom right hand text box dimensions , Line2 does not always align like Line1 at the top (which incidentley aligns perfectley every time)
Is it because the top is a control attribute, where as the bottom is always a reference?
The two rectangles the line references to are the two cyan coloured ones (outer rectangles)
Can any one help?!
Ray
P.S the file has been scanned for viruses using Norton Antivirus 2001 with definitions dated 10/05/2002
It would be better if you could post your code, but I still reckon it's to do with those evil twips!
I'm guessing the problem is down to something farcical like...
Each pixel is about 15 twips and the screen can only display pixels so twips are rounded (sort of). Ergo, if something is 14 twips in then it is 0 pixels in. If it's 15 twips in, it's 1 pixel in.
try the stuff below which I've just invented now off the top of my head.
OK here it is (its been scanned as before for viruses). When you run it, increment the bottom right textbox by one each time until the line goes wrong (around 46 in the textbox)
Thinking about it I had to fiddle with the measurements, as you will see, to get the grey rectangles to line up with the circles (as you will see, its suposed to be a simple 2d cross sectional diagram) by adding and subtracting 20 twips (is this the process of twip rounding, as it makes sense what you said in your last post) and doing this to the line as well. Surely though you should be able to get everything to line up perfectley without mucking around.
See what you can do, and once again thank you very much for your time!!
I've had a quick look and you have a really bizarre problem there.
As I'm not sure what it's supposed to be doing it's proving a little tricky to debug.
It's not a large thing, so I'd recommend you recode it from the ground up and use pixels instead of twips. The screens smallest visible element is a pixel, so just forget twips.
I'll carry on looking at this though but I do have some real work to do as well.....
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
It does seem strange doesn't it, I thought maybe when you tried it the problem would not happen, and it would all be down to my graphics card or something. Surely though if you set the forms ScaleMode to pixels (I'm not sure if I'm qualified in VB enough to use the word 'surely') then this would be the same as recoding in pixels. To be honest I dont really know any other way of getting the diagram drawn, other than the Circle Method, and Shape controls. I know you can use RounRectangle API calls but then I wouldn't know how to fill in the rectangles with different shades.
I will keep badgering at it, and thanks very much for the time and patience you have given me Arbiter, it is well appreciated.
And simply setting the scalemode (although required) is not all there is to it. You have some values of 2700 and you're incrementing values by 20 for some reason. These would need to be adjusted as well.
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
Yes I tried just changing the ScaleMode to pixels when you first flagged up twips being problematic. Obviously this shifted the rectangles of the form completely (the Circles are based on a ratio of the froms width so they stay OK) so I adjusted the distance from the circles Y position to ba about the same distance in twips, but still the problem was there. The 20 twip adjustment was because, as this is supposed to be a 2D "cross section" drawing of the part (viewed from the top, Circles and view from the side, rectangles) the grey rectangles width should be the same length as the grey circles width (I think Ive explained that right!!) but it originaly came up just short if you state the width to be circle2 radius - circle3 radius, which is most probably a function of the original problem. If you set the rectangles Ypos to be the same as the circles, you can see this when you remove the +20 bit. At least the rectangle width, once you have added the 20 twips, hits the grey circle dimensions each time no matter what dimensions are entered into the text boxes.
I think I've just blown my cerebral cortex!!!
I'm off to have a lie down in a dark and quiet room!!!!!!
Draw them onto the form directly and get rid of those crappy controls. You can draw the boxes using the line method with the 'B' wotsit. (look up line for more info). It won't do them as rounded boxes, but rounded boxes look poo anyway...
And do it in pixels, you can't go wrong then!
If you get stuck replacing the shapes with drawing commands then give me a shout...
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
I'll give it ago, the only thing I couldn't seem to find any info on using line (or better still the RoundRectangle API whatsit) is how to fill them in as all you seem to get is that it will be filled in with the object that its drawn on's fill style, but how do you get two diferent fills????
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
change the form's fillstyle in-between
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Nope, but i'll take a look now
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Not too sure if this is what you want
In the command3 code, find this
VB Code:
Line2.Y1 = Line1.Y1 + Shape2.Height - 20
Line2.Y2 = Line1.Y1 + Shape2.Height - 20
and replace with this
VB Code:
Line2.Y1 = Shape2.Top + Shape2.Height - 20
Line2.Y2 = Shape2.Top + Shape2.Height - 20
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Yes I realised that I used this filling method to do the circles (bless em, they behaved so well!!!) but it was such a cut and try thing that I forgot about as soon as it worked!!
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
any time
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
No you have got to be joking Arbiter, I wish I had!!!
The program is not just to make pretty shapes. Its hopefully going to be part of an engineering program, which calculates finished sizes of a toroidal (ring) object. The output represents a cross sectional drawing of the finished articles dimensions. The dark grey area is the toroidal core, and the cyan parts are the buildup of material on that core.
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Re: No Sir!!!
Originally posted by Ray.T No you have got to be joking Arbiter, I wish I had!!!
If you want more help, just ask
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons