I wanna print black rectangle. How Can I do that?
How to print filled rectangle?
Moderator: Rathinagiri
How to print filled rectangle?
Hi guys (sorry, no women found
)
I wanna print black rectangle. How Can I do that?
I wanna print black rectangle. How Can I do that?
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to print filled rectangle?
In draw command, 'filled' facility is available. I noticed now that it is not available in 'print'. I think some changes in source code is required. 
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: How to print filled rectangle?
I've tried to print line with width like a height of required rectangle - it works, but ....
line has rounded endings and my rectangle looked like egg 
Re: How to print filled rectangle?
Maybe is somewhere place to define style of pen of line and I don't know where???
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to print filled rectangle?
Hi,
We have to alter HMG source and recreate the library file.
If you are really interested, replace "HB_FUNC ( _HMG_PRINTER_C_RECTANGLE )" in c_controlmisc.c (around line #998) with the following.
This will make all the rectangles to be filled.
We have to alter HMG source and recreate the library file.
If you are really interested, replace "HB_FUNC ( _HMG_PRINTER_C_RECTANGLE )" in c_controlmisc.c (around line #998) with the following.
This will make all the rectangles to be filled.
Code: Select all
HB_FUNC ( _HMG_PRINTER_C_RECTANGLE )
{
// 1: hDC
// 2: y
// 3: x
// 4: toy
// 5: tox
// 6: width
// 7: R Color
// 8: G Color
// 9: B Color
// 10: lWindth
// 11: lColor
int r ;
int g ;
int b ;
int x = hb_parni(3) ;
int y = hb_parni(2) ;
int tox = hb_parni(5) ;
int toy = hb_parni(4) ;
int width ;
HDC hdcPrint = (HDC) hb_parnl(1) ;
HGDIOBJ hgdiobj;
// HPEN hpen;
HBRUSH hbrush;
if ( hdcPrint != 0 )
{
// Width
if ( hb_parl(10) )
{
width = hb_parni(6) ;
}
else
{
width = 1 * 10000 / 254 ;
}
// Color
if ( hb_parl(11) )
{
r = hb_parni(7) ;
g = hb_parni(8) ;
b = hb_parni(9) ;
}
else
{
r = 0 ;
g = 0 ;
b = 0 ;
}
hbrush = CreateSolidBrush((COLORREF) RGB((int) r,(int) g,(int) b));
// hpen = CreatePen( (int) PS_SOLID, ( width * GetDeviceCaps ( hdcPrint , LOGPIXELSX ) / 1000 ), (COLORREF) RGB( r , g , b ) );
hgdiobj = SelectObject( (HDC) hdcPrint , hbrush );
Rectangle( (HDC) hdcPrint ,
( x * GetDeviceCaps ( hdcPrint , LOGPIXELSX ) / 1000 ) - GetDeviceCaps ( hdcPrint , PHYSICALOFFSETX ) ,
( y * GetDeviceCaps ( hdcPrint , LOGPIXELSY ) / 1000 ) - GetDeviceCaps ( hdcPrint , PHYSICALOFFSETY ) ,
( tox * GetDeviceCaps ( hdcPrint , LOGPIXELSX ) / 1000 ) - GetDeviceCaps ( hdcPrint , PHYSICALOFFSETX ) ,
( toy * GetDeviceCaps ( hdcPrint , LOGPIXELSY ) / 1000 ) - GetDeviceCaps ( hdcPrint , PHYSICALOFFSETY )
);
SelectObject( (HDC) hdcPrint , (HGDIOBJ) hgdiobj );
DeleteObject( hbrush );
// DeleteObject( hpen );
}
}
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: How to print filled rectangle?
Great Rathi! Hope you'll note down this "would be correction" for future version.
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to print filled rectangle?
No Swapan, It is not a correction.swapan wrote:Great Rathi! Hope you'll note down this "would be correction" for future version.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: How to print filled rectangle?
I think, it must be special parameter "filled" - after this correction we must draw all rectangles from lines...
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to print filled rectangle?
For having this feature, we have to alter i_print.ch, h_controlmisc.prg and c_controlmisc.c. I will do it tonight, verify it and give it to you.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.