May 25, 2022, 12:20:04 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Recent posts

Pages 1 ... 8 9 10
91
General Questions / Best way to display an image m...
Last post by Andy - July 03, 2021, 03:44:48 AM
Hi,

I wondering about your views on this one:

As you know I now have a moving train that goes around a simple circuit.
The image looks good when it's moving horizontally, but need some more images as it goes around a curve.

I know the actual angles of that curve, so that's not a problem.

Would you go for a simple image that looks the same irrespective of where it is on that circuit e.g. an electric train - smooth, or would you make the image tilt and eventually make a view of it from above as it enters a vertical section.

Would you even do something like a 2D or 3D image?

You can see what I mean when you see the two screenshots attached.

Thanks,
Andy.
:)
92
General Questions / Re: Top most control
Last post by LarryMc - June 28, 2021, 10:49:09 AM
I decided that the coded I posted may look a little confusing to some because of its structure. It was created using IWB+.  I did it that way because of the ease in which I could create the buttons then switch over and modify the code and compile and run the program.
So what I've now done is modify the code and put it in "normal" IWB format for those who have never purchased IWB+.

$include "windowssdk.inc"
$include "Commctrl.inc"

WINDOW main
int x,y,w,h

OPENWINDOW main,0,0,400,300,@SIZE|@MINBOX|@MAXBOX|@CAPTION|@SYSMENU,0,"Form1",&main_handler
CONTROL main,@BUTTON,"Button 1",0,25,60,25,@CTLBTNBITMAP,10
CONTROL main,@RGNBUTTON,"RgnBtn 1",100,25,60,25,0,20

SETWINDOWCOLOR main, RGB(255,255,255)

sETCONTROLTEXT main,10,GETSTARTPATH() + "bug.bmp"

int RGNBUTTON_hrgn  = RGNFROMBITMAP(GETSTARTPATH() + "rgn_bmp2.bmp")
SETBUTTONRGN main,20,COPYRGN(RGNBUTTON_hrgn)
SETBUTTONBITMAPS main,20,LOADIMAGE(GETSTARTPATH() + "button_bmp_hot2.bmp",@IMGBITMAP),0,0
SETHTCOLOR main,20,RGB(128,128,128)
SETBUTTONBORDER main,20,2

CENTERWINDOW main

MODIFYEXSTYLE main,  @TOPMOST,0, 10

starttimer main, 500
x=0:y=25:w=60:h=25

WAITUNTIL ISWINDOWCLOSED(main)

end

SUB main_handler(),INT
SELECT @MESSAGE
case @IDTIMER
x++
setsize main,x+1,y,w,h,10
InvalidateRect(getcontrolhandle(main,10), NULL, FALSE)
case @IDCLOSEWINDOW
CLOSEWINDOW main
ENDSELECT
RETURN FALSE
ENDSUB
93
General Questions / Re: Top most control
Last post by Andy - June 27, 2021, 08:01:39 PM
Thanks Larry,

That's extremely helpful, I will study it.

Thanks,
Andy.
 :) 
94
General Questions / Re: Top most control
Last post by LarryMc - June 27, 2021, 09:45:11 AM
This code will do it. And the attached images are the ones I used for the bitmap button and the region button.
$include "windowssdk.inc"
$include "Commctrl.inc"
CONST main_BUTTON1 = 0x101
CONST main_RGNBUTTON1 = 0x102
WINDOW main
int x,y,w,h

OpenMainWindow()
'openconsole
ProcessAll()
END


SUB OpenMainWindow()
 OPENWINDOW main,0,0,400,300,@SIZE|@MINBOX|@MAXBOX|@CAPTION|@SYSMENU,0,"Form1",&main_handler
 CONTROL main,@BUTTON,"Button 1",0,25,60,25,@CTLBTNBITMAP,main_BUTTON1
 CONTROL main,@RGNBUTTON,"RgnBtn 1",100,25,60,25,0,main_RGNBUTTON1

 SETWINDOWCOLOR main, RGB(255,255,255)

 sETCONTROLTEXT main,main_BUTTON1,GETSTARTPATH() + "bug.bmp"

 int main_RGNBUTTON1_hrgn  = RGNFROMBITMAP(GETSTARTPATH() + "rgn_bmp2.bmp")
 SETBUTTONRGN main,main_RGNBUTTON1,COPYRGN(main_RGNBUTTON1_hrgn)
 SETBUTTONBITMAPS main,main_RGNBUTTON1,LOADIMAGE(GETSTARTPATH() + "button_bmp_hot2.bmp",@IMGBITMAP),0,0
 SETHTCOLOR main,main_RGNBUTTON1,RGB(128,128,128)
 SETBUTTONBORDER main,main_RGNBUTTON1,2

 CENTERWINDOW main

 MODIFYEXSTYLE main,  @TOPMOST,0, main_BUTTON1

 starttimer main, 500
 x=0:y=25:w=60:h=25

 ONMESSAGE main,@IDCLOSEWINDOW,&OnMainClose

ENDSUB

SUB main_handler(),INT
 SELECT @MESSAGE
 case @IDTIMER
 x++
 setsize main,x+1,y,w,h,main_BUTTON1
 InvalidateRect(getcontrolhandle(main,main_BUTTON1), NULL, FALSE)

 ENDSELECT
 RETURN FALSE
ENDSUB

SUB ProcessAll()
 WAITUNTIL ISWINDOWCLOSED(main)
ENDSUB

SUB OnMainClose(),INT
 CLOSEWINDOW main
 RETURN FALSE
ENDSUB

bmp.zip
95
General Questions / Top most control
Last post by Andy - June 26, 2021, 04:00:48 AM
Hi, me again.

I have two controls:

1. A region button with an image.
2. A standard button displaying a bitmap.

Now the bitmap button (number 2) moves over time across number 1 (the region button).

The problem is number 1 (region button) obscures the bitmap button, that is it's over the bitmap button so you can't see the bitmap button properly.

How can I force the bitmap button to show on top on the region button?

I'm trying the SetWindowPos command, but I'm not sure if this is what I need and if so can't get it to work.

Any help or examples anyone please?

Andy.
:)
96
Tutorials / Re: Parallel curves - an easy ...
Last post by Andy - June 22, 2021, 05:01:51 AM
Thanks Clint, always a help!

Just showing one simple way to create parallel curves, it may help someone, someday.

Andy.
 :)
97
Tutorials / Re: Parallel curves - an easy ...
Last post by ckoehn - June 21, 2021, 09:16:49 AM
I'm not sure what you are trying to do with arc's,  but here is something for you to play around with.

$INCLUDE "windowssdk.inc"

WINDOW win

OpenWindow win,0,0,400,425,@MINBOX|@MAXBOX|@SIZE|@CAPTION|@SYSMENU,0,"Test",&win_handler

DrawArc(win, 110,110, 95, 90,0, 1, rgb(255,0,0), TRUE)
DrawArc(win, 110,110, 100, 90,90, 1, rgb(255,0,0))
DrawArc(win, 110,110, 95, 180,-90, 1, rgb(255,0,0))

WAITUNTIL ISWINDOWCLOSED(win)
END

SUB win_handler(), INT
SELECT @MESSAGE
CASE @IDCREATE
CENTERWINDOW win
/* Initialize any controls here */
CASE @IDCLOSEWINDOW
CLOSEWINDOW win
ENDSELECT
RETURN 0
END SUB

sub DrawArc(window w1, int cx, int cy, int radius, float start_angle, float sweep_angle, int arc_width, uint arc_color, Opt int MoveToStart = FALSE, opt uint backcolor = rgb(255,255,255)), int
int hdc = gethdc(w1) ' get the hdc of the window

if MoveToStart
MoveToEx(hdc, cx,cy, 0) 'move point to center of arc
SelectObject(hdc, GetStockObject(NULL_PEN)) 'this draws a line (transparent) from center to starting point of the arc))
AngleArc(hdc, cx,cy, radius, start_angle, 0) 'move to starting point of arc
endif

SelectObject(hdc, CreatePen(PS_SOLID,arc_width,arc_color)) 'set the pen color

AngleArc(hdc, cx,cy, radius, start_angle, sweep_angle) 'draws the arc

releasehdc w1, hdc 'release the hdc

        return 0
endsub

Later,
Clint
98
Tutorials / Parallel curves - an easy way ...
Last post by Andy - June 18, 2021, 05:07:41 AM
I thought I would re-post this in this section.

I struggled for a long time trying to draw parallel curves.

This is an easy way for you if you want to save them as a bitmap etc.

Here I am using the CIRCLE command and I draw to circles around the same point, the second one has a smaller radius than the first, how much smaller is up to you.

circle w1, 650,350,200, RGB(255,0,0), RGB(219,219,219) 'Radius 200
circle w1, 650,350,190, RGB(255,0,0), RGB(0,0,0) 'Radius 190 (smaller)

Once you have drawn the two circles the steps are:

1. Use the Windows snipping tool to capture the circle.
2. Use a graphics editor to load the circle image.
3. Crop whatever portion of the circle you want (I use a quarters of it).
4. Save the portion(s) of the image as a new image / images.

And there you have it.

Parallel curves made easy.

See attached.

Thanks,
Andy.
:)
99
General Questions / Re: Region button & bitmaps
Last post by Andy - June 08, 2021, 03:42:15 AM
The solution (well for my program) was quite simple in the end.

I changed the background from Black to transparent and that was it!

Andy.
 :)
100
General Questions / Region button & bitmaps
Last post by Andy - June 07, 2021, 04:26:13 AM
I have been messing about with parallel curves again, and found an easy way to make them with the CIRCLE command.

Now when I load r1.bmp into a bitmap button it's shown correctly (smooth).
But when I load it into a region button it's messy.

See attached.

I have reread the help file just to check I am not missing anything, but then again it is me!

I tried making a region bitmap r1t.bmp and then loading the r1.bmp into it and that shows nothing.

What am I doing wrong here please? can anyone give an example with these bitmaps?

Thanks,
Andy.
Pages 1 ... 8 9 10