powered by simpleCommunicator - 2.0.51     © 2025 Programmizd 02
Форумы / PowerBuilder [игнор отключен] [закрыт для гостей] / Распечатка картинки
3 сообщений из 3, страница 1 из 1
Распечатка картинки
    #37286812
Фотография Riska
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Имеется файл на диске "C:\1.jpg" (bmp, gif etc).
Его нужно распечатать в оригинальном размере (если размер больше, чем лист (А4), то надо подогнать пропорционально под размер листа.
Не хочется изобретать велосипед. У кого-нибудь есть готовое решение?
...
Рейтинг: 0 / 0
Распечатка картинки
    #37288621
andy753
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Riska,

А вставить в ДВ либо как какртинку или как подложку? А ДВ сделать сразу под размер А4. Тогда картинки ресайзиться автоматом будут... да и печать работает :) Это как идея.
...
Рейтинг: 0 / 0
Распечатка картинки
    #37289069
Фотография Riska
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Вот, набросал по-деревенски

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
forward
global type w_print_picture from window
end type
type p_test_for_size from picture within w_print_picture
end type
end forward

global type w_print_picture from window
integer width =  302 
integer height =  340 
boolean titlebar = true
string title = "PRINTING..."
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
long backcolor =  33289706 
string icon = "AppIcon!"
boolean center = true
p_test_for_size p_test_for_size
end type
global w_print_picture w_print_picture

on w_print_picture.create
this.p_test_for_size=create p_test_for_size
this.Control[]={this.p_test_for_size}
end on

on w_print_picture.destroy
destroy(this.p_test_for_size)
end on

event open;string ls_path
string ls_syntax, ls_error
long ll_paper_width =  3400 , ll_paper_height =  4350 
long li_rtn, ll_width, ll_height
Double ld_raitio
DataStore lds_picture

ls_path = Message.StringParm

IF NOT FileExists(ls_path) THEN Close(This)

SetPointer(HourGlass!)

lds_picture = CREATE DataStore

ls_syntax = 'release 10.5;&
				datawindow(processing=0  )~r~n&
				detail(height=0  height.autosize=yes )~r~n&
				table(column=(type=char(500) name=filename dbname="fileName" ) )~r~n&
				column(band=detail id=1 x="0" y="0" height="0" width="0" name=filename visible="1" bitmapname=yes)'

lds_picture.create(ls_syntax, ls_error)

p_test_for_size.picturename = ls_path
ll_width = p_test_for_size.width
ll_height = p_test_for_size.height
 
 IF ll_width > ll_height AND (ll_width > ll_paper_width OR ll_height > ll_paper_height) THEN
	ll_paper_width =  4350 
	ll_paper_height =  3400 
	lds_picture.Object.DataWindow.Print.Orientation = '1'
END IF

if ll_width > ll_paper_width then
	ld_raitio = ll_width / ll_paper_width
	ll_width = ll_paper_width
	ll_height /= ld_raitio		
End if

if ll_height > ll_paper_height then
	ld_raitio =ll_height / ll_paper_height
	ll_height = ll_paper_height
	ll_width /= ld_raitio
End if

lds_picture.Object.filename.Width = string(ll_width)
lds_picture.Object.filename.Height = string(ll_height)

lds_picture.insertRow( 1 )

lds_picture.setItem( 1 ,"filename",ls_path)
lds_picture.Print()

Sleep( 1 )

SetPointer(Arrow!)

Close(This)
end event

type p_test_for_size from picture within w_print_picture
boolean visible = false
integer x =  14 
integer y =  12 
integer width =  229 
integer height =  200 
boolean originalsize = true
boolean focusrectangle = false
end type
...
Рейтинг: 0 / 0
3 сообщений из 3, страница 1 из 1
Форумы / PowerBuilder [игнор отключен] [закрыт для гостей] / Распечатка картинки
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]