Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2002.05.30;
Скачать: [xml.tar.bz2];

Вниз

Рисую содержимое PaintBox в Image, пытаюсь сохранить и ничего???   Найти похожие ветки 

 
Как сделать?   (2002-05-18 13:33) [0]

Пытаюсь сохранить в BMP содержимое Image(Visible=false,AutoSize=true) и ничего?? Вот код программы может кто-то подскажет???



procedure TForm1.N10Click(Sender: TObject);
var
yg:integer;
begin
Form1.SavePictureDialog1.Execute;

Form1.Image3.Width:=Form1.Image1.Width;
Form1.Image3.Height:=Form1.Image1.Height;

Form1.Image3.Canvas.Pen.Color:=ColOs;
Form1.Image3.Canvas.MoveTo(Form1.SpinEdit1.Value,0);
Form1.Image3.Canvas.LineTo(Form1.SpinEdit1.Value,Form1.PaintBox1.Height);

Form1.Image3.Canvas.MoveTo(0,Form1.SpinEdit2.Value);
Form1.Image3.Canvas.LineTo(Form1.PaintBox1.Width,Form1.SpinEdit2.Value);

(*Изменение едю отрезка по оси X*)
if Form1.SpinEdit3.Value=1 then
begin
for i:=0 to 1200 do
begin
Form1.Image3.Canvas.Pixels[Form1.SpinEdit1.Value+(i*100),Form1.SpinEdit2.Value]:=clWhite;
Form1.Image3.Canvas.TextOut(Form1.SpinEdit1.Value+(i*100),Form1.SpinEdit2.Value+2,inttostr(i*100));

end;
end;


if (Form1.SpinEdit3.Value>1) and (Form1.SpinEdit3.Value<8) then
begin
for i:=0 to 1200 do
begin
Form1.Image3.Canvas.Pixels[Form1.SpinEdit1.Value+(i*Form1.SpinEdit3.Value),Form1.SpinEdit2.Value]:=clWhite;
if (i mod 10=0) then
begin
Form1.Image3.Canvas.Textout(Form1.SpinEdit1.Value+(i*Form1.SpinEdit3.Value),Form1.SpinEdit2.Value+2,inttostr(i));
end;
end;
end;


if (Form1.SpinEdit3.Value >=8) and (Form1.SpinEdit3.Value<15) then
begin
for i:=0 to 1200 do
begin
Form1.Image3.Canvas.Pixels[Form1.SpinEdit1.Value+(i*Form1.SpinEdit3.Value),Form1.SpinEdit2.Value]:=clWhite;
if (i mod 2=0) then
begin
Form1.Image3.Canvas.Textout(Form1.SpinEdit1.Value+(i*Form1.SpinEdit3.Value),Form1.SpinEdit2.Value+2,inttostr(i));
end;
end;
end;

if (Form1.SpinEdit3.Value>=15) then
begin
for i:=0 to 1200 do
begin
Form1.Image3.Canvas.Pixels[Form1.SpinEdit1.Value+(i*Form1.SpinEdit3.Value),Form1.SpinEdit2.Value]:=clWhite;
Form1.Image3.Canvas.Textout(Form1.SpinEdit1.Value+(i*Form1.SpinEdit3.Value),Form1.SpinEdit2.Value+2,inttostr(i));
end;
end;

(*Изменение едю отрезка по оси y*)(*Аналогично Х*)

//Рисую амплитуду R

Form1.Image3.Canvas.Pen.Color:=clred;
yg:=0;
if WoH=0 then
begin
Form1.Image3.Canvas.MoveTo(Form1.SpinEdit1.Value,Form1.SpinEdit2.Value-(R[0]*Form1.SpinEdit4.Value));
for q:=1 to Form1.Image1.Picture.Width-Form1.SpinEdit1.Value do
begin
Form1.Image3.Canvas.LineTo((q*Form1.SpinEdit3.Value)+Form1.SpinEdit1.Value,Form1.SpinEdit2.Value-(R[q]*Form1.SpinEdit4.Value));
end;
end;

if WoH=1 then
begin
Form1.Image3.Canvas.MoveTo((R[Form1.SpinEdit2.Value]*Form1.SpinEdit3.Value)+Form1.SpinEdit1.Value,Form1.SpinEdit2.Value);
for q:=Form1.SpinEdit2.Value-1 downto 1 do
begin
inc(yg);
Form1.Image3.Canvas.LineTo((R[q]*Form1.SpinEdit3.Value)+Form1.SpinEdit1.Value,Form1.SpinEdit2.Value-(yg*Form1.SpinEdit4.Value));
end;
end;

//Рисую амплитуды B и G аналогично R


Form1.Image3.Picture.SaveToFile(Form1.SavePictureDialog1.FileName);

PatBlt(Form1.Image3.Canvas.Handle,0,0,Form1.Image3.ClientWidth,
Form1.Image3.ClientHeight,WHITENESS);

end;


Сохраняю, но файл пустой???? Может кто подскажет в чем проблема???


 
cult   (2002-05-18 13:35) [1]

А может она Visible должна быть?
не пробовал?


 
Как сделать?   (2002-05-18 14:03) [2]


SpinEdit1 и SpinEdit2 - это положение осей X и Y
SpinEdit3 и SpinEdit4 - это ед. отрезок на X и Y


 
Как сделать?   (2002-05-18 14:18) [3]

Вот я укоротил


procedure TForm1.N10Click(Sender: TObject);
var
yg:integer;
begin

Form1.Image3.Width:=Form1.Image1.Width;
Form1.Image3.Height:=Form1.Image1.Height;

Form1.Image3.Canvas.Pen.Color:=ColOs;
Form1.Image3.Canvas.MoveTo(Form1.SpinEdit1.Value,0);
Form1.Image3.Canvas.LineTo(Form1.SpinEdit1.Value,Form1.PaintBox1.Height);

Form1.Image3.Canvas.MoveTo(0,Form1.SpinEdit2.Value);
Form1.Image3.Canvas.LineTo(Form1.PaintBox1.Width,Form1.SpinEdit2.Value);

(*Изменение едю отрезка по оси X*)

if Form1.SpinEdit3.Value=1 then
begin
for i:=0 to 1200 do
begin
Form1.Image3.Canvas.Pixels[Form1.SpinEdit1.Value+(i*100),Form1.SpinEdit2.Value]:=clWhite;
Form1.Image3.Canvas.TextOut(Form1.SpinEdit1.Value+(i*100),Form1.SpinEdit2.Value+2,inttostr(i*100));

end;
end;
(*Изменение едю отрезка по оси y*)(*Аналогично Х*)


//R for Save
Form1.Image3.Canvas.Pen.Color:=clred;
yg:=0;
if WoH=0 then
begin
Form1.Image3.Canvas.MoveTo(Form1.SpinEdit1.Value,Form1.SpinEdit2.Value-(R[0]*Form1.SpinEdit4.Value));
for q:=1 to Form1.Image1.Picture.Width-Form1.SpinEdit1.Value do
begin
Form1.Image3.Canvas.LineTo((q*Form1.SpinEdit3.Value)+Form1.SpinEdit1.Value,Form1.SpinEdit2.Value-(R[q]*Form1.SpinEdit4.Value));
end;
end;

if WoH=1 then
begin
Form1.Image3.Canvas.MoveTo((R[Form1.SpinEdit2.Value]*Form1.SpinEdit3.Value)+Form1.SpinEdit1.Value,Form1.SpinEdit2.Value);
for q:=Form1.SpinEdit2.Value-1 downto 1 do
begin
inc(yg);
Form1.Image3.Canvas.LineTo((R[q]*Form1.SpinEdit3.Value)+Form1.SpinEdit1.Value,Form1.SpinEdit2.Value-(yg*Form1.SpinEdit4.Value));
end;
end;

//Рисую амплитуды B и G аналогично R

Form1.SavePictureDialog1.Execute;
Form1.Image3.Picture.SaveToFile(Form1.SavePictureDialog1.FileName);

PatBlt(Form1.Image3.Canvas.Handle,0,0,Form1.Image3.ClientWidth,
Form1.Image3.ClientHeight,WHITENESS);

end;


 
Как сделать?   (2002-05-18 14:27) [4]

Укоротил как только мог!!1

procedure TForm1.N10Click(Sender: TObject);
begin
Form1.Image3.Canvas.LineTo(1450,1450);

Form1.SavePictureDialog1.Execute;

Form1.Image3.Picture.SaveToFile(Form1.SavePictureDialog1.FileName);

PatBlt(Form1.Image3.Canvas.Handle,0,0,Form1.Image3.ClientWidth,
Form1.Image3.ClientHeight,WHITENESS);

end;


Почему сохраняет в реальные размеры Image 25х41, хотя AutoSize=true????


 
Как сделать?   (2002-05-18 14:45) [5]

Спасибо всем за участие!!! Вопрос закрыт!! Все дело в битмапе



Страницы: 1 вся ветка

Форум: "Основная";
Текущий архив: 2002.05.30;
Скачать: [xml.tar.bz2];

Наверх




Память: 0.47 MB
Время: 0.005 c
1-97287
Ender
2002-05-18 18:58
2002.05.30
Структура Unita


4-97455
d_oleg
2002-03-28 18:21
2002.05.30
Caret pos в TMemo


1-97272
Durak
2002-05-16 18:27
2002.05.30
StringGrid and DrawGrids


4-97446
[HDD]John
2002-03-27 17:45
2002.05.30
Имитация нажатия кнопки.


7-97428
Sasha9
2002-02-27 20:25
2002.05.30
Выключение HDD





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский