Создание прикладных Windows–приложений

Написание прикладного Windows-приложения на примере программы-органайзера, позволяющей вести электронный ежедневник и телефонную записную книжку. Описание блок-схемы программы и операционной системы. Листинг результатов обработки на контрольном примере.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык русский
Дата добавления 29.12.2014
Размер файла 2,5 M

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

copy.enabled:=false;

AllProper.enabled:=false;

AllInvert.enabled:=false;

AllUpper.enabled:=false;

AllLower.enabled:=false;

end

else begin

cut.enabled:=true;

copy.enabled:=true;

AllProper.enabled:=true;

AllInvert.enabled:=True;

AllUpper.enabled:=True;

AllLower.enabled:=True;

end;

end;

////////////////////////////////////////////////////////////////////////////////

// Попуп на списке заметок

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.ListPopupPopup(Sender: TObject);

var ind:integer;

begin

ind:=list.Selected.absoluteIndex;

UpdateNotes;

list.items[ind].Selected:=true;

if Phonebook.list.selected.Index=0 then

Phonebook.SetFirst.Enabled:=false;

end;

////////////////////////////////////////////////////////////////////////////////

// раскрыть все

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.N16Click(Sender: TObject);

begin

list.fullexpand;

end;

////////////////////////////////////////////////////////////////////////////////

// необходимо доработать

// сортировка списка

////////////////////////////////////////////////////////////////////////////////

procedure SortList;

var i:integer;

begin

with Phonebook do begin

for i:= 0 to list.Items.Count-1 do begin

if (list.items[i].ImageIndex=1) or (list.items[i].ImageIndex=3) then begin

list.items[i].MoveTo(list.items[i].Parent,naAddChildFirst)

end;

end;

for i:= 0 to list.Items.Count-1 do begin

if (list.items[i].ImageIndex=1) then begin

list.items[i].MoveTo(list.items[i].Parent,naAddChildFirst)

end;

end;

end;

end;

////////////////////////////////////////////////////////////////////////////////

// переместить в начало группы

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.SetFirstExecute(Sender: TObject);

begin

list.selected.MoveTo(list.selected.Parent,naAddChildFirst)

end;

////////////////////////////////////////////////////////////////////////////////

// сортировка списка (через меню)

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.N18Click(Sender: TObject);

begin

sortlist;

end;

////////////////////////////////////////////////////////////////////////////////

// перемещение фокуса по заметкам

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.FocusListExecute(Sender: TObject);

begin

if list.Focused then begin

if files.enabled then begin

files.SetFocus;

files.SelStart:=0;

end;

end

else list.SetFocus;

end;

////////////////////////////////////////////////////////////////////////////////

// Выделить все

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.SelAllExecute(Sender: TObject);

begin

if files.Focused then files.SelectAll;

end;

////////////////////////////////////////////////////////////////////////////////

// закрыть все ветки

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.N37Click(Sender: TObject);

begin

list.fullcollapse;

list.Items.GetFirstNode.Expand(false);

end;

////////////////////////////////////////////////////////////////////////////////

// печать заметки

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.PrintNoteExecute(Sender: TObject);

var

pd:TPrintdialog;

Line: Integer;

PrintText: TextFile; {declares a file variable}

begin

pd:=Tprintdialog.Create(Phonebook);

if Pd.Execute then begin

try

AssignPrn(PrintText); {assigns PrintText to the printer}

Rewrite(PrintText); {creates and opens the output file}

Printer.Canvas.Font := Files.Font; {assigns Font settings to the canvas}

for Line := 0 to Files.Lines.Count - 1 do

Writeln(PrintText, Files.Lines[Line]); {writes the contents of the Memo1 to the printer object}

CloseFile(PrintText); {Closes the printer variable}

except

WriteLog(Log,'PrintError','PrintNoteExecute');

showmessage('Ошибка печати');

end;

end;

end;

////////////////////////////////////////////////////////////////////////////////

// правельный регистр

////////////////////////////////////////////////////////////////////////////////

function ProperCase(ss:string):string;

var s : string;

fs : short;

begin

s:=TrimLeft(ss);

fs:=length(ss)-length(s);

result:=stringofchar(' ',fs)+AnsiUpperCase(copy(s,1,1))+AnsiLowerCase(copy(s,2,length(s)));

end;

////////////////////////////////////////////////////////////////////////////////

// инверсный регистр

////////////////////////////////////////////////////////////////////////////////

function invertCase(s:string):string;

var i : integer;

s1,s2 : string;

begin

s1:='';

s2:='';

for i:=1 to length(s) do begin

if AnsiCompareStr(AnsiUpperCase(s[i]),s[i])>0 then begin

s1:=s[i];

s2:=s2+AnsiUpperCase(s1);

end

else begin

s1:=s[i];

s2:=s2+AnsiLowerCase(s1);

end;

end;

result:=s2;

end;

////////////////////////////////////////////////////////////////////////////////

// Перехват нажатия кнопок в редакторе заметок

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.filesKeyPress(Sender: TObject; var Key: Char);

var

line, scol,n,n2,x,y,n3: integer;

ss1,ss2,s1,s2,s3: String;

begin

if key=#13 then begin

key:=#0;

n2:=files.selstart;

line:=files.CaretPos.y;

x:=files.CaretPos.x;

s1:=files.lines[line];

s2:=trimleft(s1);

scol:=length(s1)-length(s2);

s3:=system.copy(files.lines[line],1,x);

s2:=system.copy(files.lines[line],x+1,length(files.lines[line])-x+1);

s1:=trimright(s3);

n3:=length(s3)-length(s1);

s2:=trim(s2);

files.lines[line]:=s1+#13#10+stringofchar(' ',scol)+s2;

files.selstart:=n2+2+scol-n3;

end;

if key=chr(vk_tab) then begin

n:=files.Selstart;

key:=#0;

y:=files.CaretPos.y;

x:=files.CaretPos.x;

ss1:=system.copy(files.lines[y],1,x);

ss2:=system.copy(files.lines[y],x+1,length(files.lines[y])-x);

files.lines[y]:=ss1+tab+ss2;

files.Selstart:=n+length(tab);

end;

end;

////////////////////////////////////////////////////////////////////////////////

// отображение положения курсора

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.filesClick(Sender: TObject);

begin

StatusBar1.Panels[2].Text:=inttostr(files.CaretPos.x)+':'+inttostr(files.CaretPos.y+1);

end;

////////////////////////////////////////////////////////////////////////////////

// положение курсора

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.filesKeyDown(Sender: TObject; var Key: Word;

Shift: TShiftState);

begin

StatusBar1.Panels[2].Text:=inttostr(files.CaretPos.x)+':'+inttostr(files.CaretPos.y+1);

end;

////////////////////////////////////////////////////////////////////////////////

// Сортировка списка телефонов

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.SpeedButton1Click(Sender: TObject);

begin

//

end;

////////////////////////////////////////////////////////////////////////////////

// обработка нажатия кнопок на списке телефонов

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.PhonesKeyUp(Sender: TObject; var Key: Word;

Shift: TShiftState);

begin

case key of

13: edit_Execute(nil);

46: delete_Execute(nil);

45: new_Execute(nil);

end;

end;

////////////////////////////////////////////////////////////////////////////////

// показать форму

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.FormShow(Sender: TObject);

var i:integer;

begin

if phonebook.WindowState=wsMaximized then begin

for i:=0 to Phonebook.ComponentCount-1 do

if Phonebook.Components[i] is TControl then

(Phonebook.Components[i] as TControl).Visible:=false;

phonebook.WindowState:=wsNormal;

phonebook.WindowState:=wsMaximized;

for i:=0 to Phonebook.ComponentCount-1 do

if Phonebook.Components[i] is TControl then

(Phonebook.Components[i] as TControl).Visible:=true;

end;

splitter1.Align:=alBottom;

end;

////////////////////////////////////////////////////////////////////////////////

// переносить по словам

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.CheckBox1Click(Sender: TObject);

begin

files.WordWrap:=checkbox1.Checked;

if files.WordWrap then

files.ScrollBars:=ssVertical

else

files.ScrollBars:=ssBoth;

n8.Checked:=checkbox1.Checked;

end;

////////////////////////////////////////////////////////////////////////////////

// Установка цвета фона (экспорт)

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.bgcolorClick(Sender: TObject);

begin

if colorD.Execute then

bgcolor.font.Color:=colorD.Color;

end;

////////////////////////////////////////////////////////////////////////////////

// установка цвет текста(экспорт)

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.textcolorClick(Sender: TObject);

begin

if colorD.Execute then

textcolor.font.Color:=colorD.Color;

end;

///////////////////////////////////////////////////////////////////////////////

// устантовка цвета фона(экспорт)

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.bordercolorClick(Sender: TObject);

begin

if colorD.Execute then

bordercolor.font.Color:=colorD.Color;

end;

////////////////////////////////////////////////////////////////////////////////

// выход

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.ExitOnEscExecute(Sender: TObject);

begin

if checkbox5.Checked then close;

end;

////////////////////////////////////////////////////////////////////////////////

// подгонка ширины столбцов

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.ToolButton16Click(Sender: TObject);

var i:integer;

begin

for i:=0 to phones.Columns.Count-1 do

phones.Column[i].width:=round(phones.Width/phones.Columns.Count)-1;

end;

////////////////////////////////////////////////////////////////////////////////

// перетаскивание при DnD

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.ListDragOver(Sender, Source: TObject; X, Y: Integer;

State: TDragState; var Accept: Boolean);

begin

if source is TTreeView then begin

node:=(Source as TTreeView).Selected;

ToNode:=(sender as TTreeView).GetNodeAt(x,y);

if tonode<>nil then begin

if ((tonode.ImageIndex in [0,1,3])and(node.ImageIndex<>0)and(tonode<>node)) then

accept:=true

else accept:=false;

if node.ImageIndex = 1 then StatusBar1.Panels[0].Text:=node.text+' -> '+tonode.Text;

if node.ImageIndex = 2 then StatusBar1.Panels[0].Text:=node.text+' -> '+tonode.Text;

end

else accept:=false;

end

else accept:=false;

end;

////////////////////////////////////////////////////////////////////////////////

// Переместить элимент при DnD

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.ListDragDrop(Sender, Source: TObject; X, Y: Integer);

var s:string;

begin

Application.CreateForm(TMoveNode, MoveNode);

case node.ImageIndex of

1:s:='Переместить группу "'+ansiuppercase(node.text)+'" в группу "'+ansiuppercase(tonode.Text)+'"?';

2:s:='Переместить заметку "'+ansiuppercase(node.text)+'" в группу "'+ansiuppercase(tonode.Text)+'"?';

end;

movenode.Label1.Caption:=s;

if node.ImageIndex=1 then movenode.RadioGroup1.ItemIndex:=0

else movenode.RadioGroup1.ItemIndex:=1;

if checkbox8.Checked then begin

if movenode.ShowModal=mrYes then begin

case movenode.RadioGroup1.ItemIndex of

0:node.MoveTo(ToNode,naAddChildFirst);

1:node.MoveTo(ToNode,naAddChild);

end;

end;

end

else

case movenode.RadioGroup1.ItemIndex of

0:node.MoveTo(ToNode,naAddChildFirst);

1:node.MoveTo(ToNode,naAddChild);

end;

movenode.Free;

end;

////////////////////////////////////////////////////////////////////////////////

// Сброс статуса DnD

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.ListEndDrag(Sender, Target: TObject; X, Y: Integer);

begin

statusbar1.panels[0].Text:='';

UpdateNotes;

UpdateNotesIcons;

end;

////////////////////////////////////////////////////////////////////////////////

// изменение

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.ApplicationEvents1Exception(Sender: TObject;

E: Exception);

var sc:string;

begin

if (sender is tComponent) then sc:=(sender as tComponent).Name

else sc:=sender.ClassName;

writelog(log,e.ClassName,SC);

ShowMessage(SC+' : '+#13#10+e.Message);

end;

////////////////////////////////////////////////////////////////////////////////

// перенос по словам

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.N8Click(Sender: TObject);

begin

if checkbox1.checked then checkbox1.checked:=false

else checkbox1.checked:=true;

CheckBox1Click(sender);

end;

////////////////////////////////////////////////////////////////////////////////

// изменение списка заметок

////////////////////////////////////////////////////////////////////////////////

procedure TPhoneBook.TabSheet4Show(Sender: TObject);

begin

ListChange(list,nil);

end;

procedure TPhoneBook.N30Click(Sender: TObject);

var lp:array[0..127] of char;

s:shortstring;

begin

s:='mailto:'+phones.Selected.SubItems[4];

shellexecute(0,nil,StrPCopy(lp,s),nil,nil,0);

end;

procedure TPhoneBook.EditFindChange(Sender: TObject);

var i:integer;

s:ShortString;

begin

for i:=0 to phones.items.count-1 do begin

s:=Ansiuppercase(system.Copy(phones.items[i].CAPTION,0,length(editFind.Text)));

if Ansiuppercase(EditFind.text)=s then begin

phones.items[i].Selected:=true;

phones.ItemIndex:=i;

phones.ItemFocused:=phones.items[i];

break;

end;

end;

if phones.ItemFocused<>nil then

phones.ItemFocused.MakeVisible(false);

end;

procedure TPhoneBook.SelAll1DrawItem(Sender: TObject; ACanvas: TCanvas;

ARect: TRect; Selected: Boolean);

var bm:tbitmap;

begin

if selected then begin

// acanvas.Pen.Color:=clblack+$00101010;

// Acanvas.brush.Color:=$00986565;

acanvas.Pen.Color:=clblack+$00101010;

Acanvas.brush.Color:=$00ffffff;

acanvas.Rectangle(arect.left+1,arect.top,arect.Right,arect.top+19);

if (sender as tmenuitem).Default then acanvas.Font.Style:=[fsBold]

else acanvas.Font.Style:=[];

if not(sender as TMenuItem).Enabled then acanvas.Font.Color:=clGrayText

else acanvas.Font.Color:=clBlack;

acanvas.TextOut(arect.left+32,arect.top+3,(sender as tmenuitem).Caption);

if (sender as tmenuitem).Enabled then acanvas.Font.Color:=clNavy;

if (sender as tmenuitem).ShortCut>0 then

acanvas.TextOut(arect.right-8-acanvas.TextWidth(ShortCutToText((sender as tmenuitem).ShortCut)),arect.top+3,ShortCutToText((sender as tmenuitem).ShortCut));

end

else begin

Acanvas.Pen.Color:=clSilver+$00221111;

Acanvas.brush.Color:=Acanvas.Pen.Color;

acanvas.Rectangle(arect.left+24,arect.top,arect.Right,arect.top+19);

if (sender as tmenuitem).Default then acanvas.Font.Style:=[fsBold]

else acanvas.Font.Style:=[];

if (sender as TMenuItem).Enabled then acanvas.Font.Color:=clBlack

else acanvas.Font.Color:=clGrayText;

acanvas.TextOut(arect.left+32,arect.top+3,(sender as tmenuitem).Caption);

if (sender as tmenuitem).Enabled then acanvas.Font.Color:=clNavy;

if (sender as tmenuitem).ShortCut>0 then

acanvas.TextOut(arect.right-8-acanvas.TextWidth(ShortCutToText((sender as tmenuitem).ShortCut)),arect.top+3,ShortCutToText((sender as tmenuitem).ShortCut));

acanvas.Pen.Color:=clSkyBlue;

// acanvas.Pen.Color:=$00ffddcc;

Acanvas.brush.Color:=acanvas.Pen.Color;

acanvas.Rectangle(arect.Left,arect.Top,arect.Left+24,arect.Bottom);

if (sender as TMenuItem).Caption='-' then begin

Acanvas.Pen.Color:=clSilver;

Acanvas.brush.Color:=clGray;

Acanvas.Rectangle(26,arect.top+3,arect.left+arect.Right-2,arect.top+6);

end;

end;

bm:=tbitmap.Create;

Actions.GetBitmap((sender as tmenuitem).ImageIndex,bm);

bm.Transparent:=true;

if not (sender as TMenuItem).Enabled then

bm.Mask(clWhite);

acanvas.Draw(arect.Left+3,arect.Top+1,(bm as TGraphic));

bm.Free;

end;

procedure TPhoneBook.PhonesColumnClick(Sender: TObject;

Column: TListColumn);

var ind:integer;

begin

ind:=column.Index;

case ind of

0:begin

if sorttype[ind]=0 then sorttype[ind]:=1

else sorttype[ind]:=0;

phones.CustomSort(@SortNames, sorttype[ind]);

end;

1:begin

if sorttype[ind]=0 then sorttype[ind]:=1

else sorttype[ind]:=0;

phones.CustomSort(@SortHPhones, sorttype[ind]);

end;

2:begin

if sorttype[ind]=0 then sorttype[ind]:=1

else sorttype[ind]:=0;

phones.CustomSort(@SortWPhones, sorttype[ind]);

end;

3:begin

if sorttype[ind]=0 then sorttype[ind]:=1

else sorttype[ind]:=0;

phones.CustomSort(@SortCelPhones, sorttype[ind]);

end;

4:begin

if sorttype[ind]=0 then sorttype[ind]:=1

else sorttype[ind]:=0;

phones.CustomSort(@SortAdres, sorttype[ind]);

end;

5:begin

if sorttype[ind]=0 then sorttype[ind]:=1

else sorttype[ind]:=0;

phones.CustomSort(@SortEmail, sorttype[ind]);

end;

6:begin

if sorttype[ind]=0 then sorttype[ind]:=1

else sorttype[ind]:=0;

phones.CustomSort(@SortDate, sorttype[ind]);

end;

end;

sortindex:=ind;

end;

procedure TPhoneBook.ToHTMLExecute(Sender: TObject);

var i:integer;

f:tstringlist;

bgcolor,textcolor,bordercolor:string;

begin

if shtml.Execute then begin

bgcolor:=ColorToHexRGB(phonebook.bgcolor.Color);

textcolor:=ColorToHexRGB(phonebook.textcolor.Color);

bordercolor:=ColorToHexRGB(phonebook.bordercolor.Color);

f:=tstringlist.create;

f.add('<html>');

f.Add(' <head>');

f.Add(' <title>Телефонный справочник</title>');

f.Add(' </head>');

f.Add('<body bgcolor=#'+bgcolor+' text=#'+textcolor+'>');

f.Add('<font face="Verdana">');

if border.Checked then

f.Add(' <table border="1" leftmargin="2" align="center" cellpadding="0" cellspacing="0" bordercolor=#'+bordercolor+' width="98%">')

else

f.Add(' <table align="center" leftmargin="2" cellpadding="0" cellspacing="0" width="98%">');

f.Add(' <tr>');

f.Add(' <td><b>Имя</td>');

if cb1.Checked then f.Add(' <td><b>&nbspТелефон</b></td>');

if cb2.Checked then f.Add(' <td><b>&nbspРабочий</b></td>');

if cb3.Checked then f.Add(' <td><b>&nbspСотовый</b></td>');

if cb4.Checked then f.Add(' <td><b>&nbspАдрес</b></td>');

if cb5.Checked then f.Add(' <td><b>&nbspE-mail</b></td>');

f.Add(' </tr>');

for i:=0 to Phones.items.Count-1 do begin

f.Add(' <tr>');

if length(Phones.items[i].Caption)>0 then f.Add(' <td>&nbsp'+Phones.items[i].Caption+'</td>')

else f.Add(' <td>&nbsp</td>');

if cb1.Checked then

if length(Phones.items[i].SubItems[0])>0 then f.Add(' <td>&nbsp'+Phones.items[i].SubItems[0]+'</td>')

else f.Add(' <td>&nbsp</td>');

if cb2.Checked then

if length(Phones.items[i].SubItems[1])>0 then f.Add(' <td>&nbsp'+Phones.items[i].SubItems[1]+'</td>')

else f.Add(' <td>&nbsp</td>');

if cb3.Checked then

if length(Phones.items[i].SubItems[2])>0 then f.Add(' <td>&nbsp'+Phones.items[i].SubItems[2]+'</td>')

else f.Add(' <td>&nbsp</td>');

if cb4.Checked then

if length(Phones.items[i].SubItems[3])>0 then f.Add(' <td>&nbsp'+Phones.items[i].SubItems[3]+'</td>')

else f.Add(' <td>&nbsp</td>');

if cb5.Checked then

if length(Phones.items[i].SubItems[4])>0 then f.Add(' <td>&nbsp'+Phones.items[i].SubItems[4]+'</td>')

else f.Add(' <td>&nbsp</td>');

f.Add(' </tr>');

end;

f.Add('</table>');

f.Add('</font>');

f.Add('</body>');

f.Add('</html>');

try

f.SaveToFile(shtml.FileName);

except

writeLog(log,'ExportError','PBToolButton6Click');

showmessage('Ошибка Сохранения файла');

end;

f.Free;

end;

end;

procedure TPhoneBook.ToExcelExecute(Sender: TObject);

var ws,xl:variant;

i,maxrow:integer;

col,fst:integer;

begin

fst:=2;

xl:=createoleobject('Excel.Application');

try

maxrow:=0;

xl.visible:=true;

XL.WorkBooks.Add;

ws := XL.ActiveWorkBook.ActiveSheet;

ws.Range['A1:O500'].NumberFormat:='@';

ws.Range['A'+inttostr(fst)].Value := '№пп';

ws.Range['B'+inttostr(fst)].Value := 'Имя';

col:=1;

if cb1.Checked then begin

inc(col);

ws.Range[Chr(Ord('A')+col)+inttostr(fst)].Value := 'Телефон';

end;

if cb2.Checked then begin

inc(col);

ws.Range[Chr(Ord('A')+col)+inttostr(fst)].Value := 'Рабочий телефон';

end;

if cb3.Checked then begin

inc(col);

ws.Range[Chr(Ord('A')+col)+inttostr(fst)].Value := 'Мобильный';

end;

if cb4.Checked then begin

inc(col);

ws.Range[Chr(Ord('A')+col)+inttostr(fst)].Value := 'Адрес';

end;

if cb5.Checked then begin

inc(col);

ws.Range[Chr(Ord('A')+col)+inttostr(fst)].Value := 'E-Mail';

end;

for i:=fst+1 to Phones.Items.Count+fst do begin

col:=1;

ws.Range['a'+inttostr(i)].Value := i-(fst);//# работы

ws.Range['b'+inttostr(i)].Value := Phones.Items[i-fst-1].Caption;

if cb1.Checked then begin

inc(col);

ws.Range[Chr(Ord('A')+col)+inttostr(i)].Value:=Phones.Items[i-fst-1].SubItems[0];

end;

if cb2.Checked then begin

inc(col);

ws.Range[Chr(Ord('A')+col)+inttostr(i)].Value:=Phones.Items[i-fst-1].SubItems[1];

end;

if cb3.Checked then begin

inc(col);

ws.Range[Chr(Ord('A')+col)+inttostr(i)].Value:=Phones.Items[i-fst-1].SubItems[2];

end;

if cb4.Checked then begin

inc(col);

ws.Range[Chr(Ord('A')+col)+inttostr(i)].Value:=Phones.Items[i-fst-1].SubItems[3];

end;

if cb5.Checked then begin

inc(col);

ws.Range[Chr(Ord('A')+col)+inttostr(i)].Value:=Phones.Items[i-fst-1].SubItems[4];

end;

maxrow:=i;

end;

//установим сетку для таблицы

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlEdgeLeft].LineStyle:=xlContinuous;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlEdgeLeft].Weight:=xlThin;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlEdgeLeft].ColorIndex:=xlAutomatic;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlEdgeTop].LineStyle:=xlContinuous;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlEdgeTop].Weight:=xlThin;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlEdgeTop].ColorIndex:=xlAutomatic;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlEdgeBottom].LineStyle:=xlContinuous;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlEdgeBottom].Weight:=xlThin;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlEdgeBottom].ColorIndex:=xlAutomatic;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlEdgeRight].LineStyle:=xlContinuous;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlEdgeRight].Weight:=xlThin;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlEdgeRight].ColorIndex:=xlAutomatic;

//внутреннее пересечение

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlInsideVertical].LineStyle:=xlContinuous;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlInsideVertical].Weight:=xlThin;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlInsideVertical].ColorIndex:=xlAutomatic;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlInsideHorizontal].LineStyle:=xlContinuous;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlInsideHorizontal].Weight:=xlThin;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(maxrow)].Borders[xlInsideHorizontal].ColorIndex:=xlAutomatic;

//наружние границы

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(fst)].Borders[xlEdgeLeft].LineStyle:=xlContinuous;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(fst)].Borders[xlEdgeLeft].Weight:=xlMedium;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(fst)].Borders[xlEdgeLeft].ColorIndex:=xlAutomatic;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(fst)].Borders[xlEdgeTop].LineStyle:=xlContinuous;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(fst)].Borders[xlEdgeTop].Weight:=xlMedium;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(fst)].Borders[xlEdgeTop].ColorIndex:=xlAutomatic;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(fst)].Borders[xlEdgeBottom].LineStyle:=xlContinuous;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(fst)].Borders[xlEdgeBottom].Weight:=xlMedium;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(fst)].Borders[xlEdgeBottom].ColorIndex:=xlAutomatic;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(fst)].Borders[xlEdgeRight].LineStyle:=xlContinuous;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(fst)].Borders[xlEdgeRight].Weight:=xlMedium;

ws.Range['A'+inttostr(fst)+':'+Chr(Ord('A')+col)+inttostr(fst)].Borders[xlEdgeRight].ColorIndex:=xlAutomatic;

for i:=ord('A')to ORD('A')+col do begin

ws.Range[Chr(i)+inttostr(fst)+':'+Chr(i)+inttostr(maxrow)].Borders[xlEdgeLeft].LineStyle:=xlContinuous;

ws.Range[Chr(i)+inttostr(fst)+':'+Chr(i)+inttostr(maxrow)].Borders[xlEdgeLeft].Weight:=xlMedium;

ws.Range[Chr(i)+inttostr(fst)+':'+Chr(i)+inttostr(maxrow)].Borders[xlEdgeLeft].ColorIndex:=xlAutomatic;

ws.Range[Chr(i)+inttostr(fst)+':'+Chr(i)+inttostr(maxrow)].Borders[xlEdgeTop].LineStyle:=xlContinuous;

ws.Range[Chr(i)+inttostr(fst)+':'+Chr(i)+inttostr(maxrow)].Borders[xlEdgeTop].Weight:=xlMedium;

ws.Range[Chr(i)+inttostr(fst)+':'+Chr(i)+inttostr(maxrow)].Borders[xlEdgeTop].ColorIndex:=xlAutomatic;

ws.Range[Chr(i)+inttostr(fst)+':'+Chr(i)+inttostr(maxrow)].Borders[xlEdgeBottom].LineStyle:=xlContinuous;

ws.Range[Chr(i)+inttostr(fst)+':'+Chr(i)+inttostr(maxrow)].Borders[xlEdgeBottom].Weight:=xlMedium;

ws.Range[Chr(i)+inttostr(fst)+':'+Chr(i)+inttostr(maxrow)].Borders[xlEdgeBottom].ColorIndex:=xlAutomatic;

ws.Range[Chr(i)+inttostr(fst)+':'+Chr(i)+inttostr(maxrow)].Borders[xlEdgeRight].LineStyle:=xlContinuous;

ws.Range[Chr(i)+inttostr(fst)+':'+Chr(i)+inttostr(maxrow)].Borders[xlEdgeRight].Weight:=xlMedium;

ws.Range[Chr(i)+inttostr(fst)+':'+Chr(i)+inttostr(maxrow)].Borders[xlEdgeRight].ColorIndex:=xlAutomatic;

end;

ws.range['A1:'+chr(Ord('A')+col)+'1'].merge;

if (Groups.ItemIndex>=0)and(Groups.ItemIndex<groups.Items.Count)then

ws.range['A1:'+chr(Ord('A')+col)+'1'].value:='Список телефонов "'+Groups.Items[Groups.ItemIndex].Caption+'"'

else

ws.range['A1:'+chr(Ord('A')+col)+'1'].value:='Список телефонов';

ws.range['A1:'+chr(Ord('A')+col)+'1'].font.bold:=true;

ws.range['A'+inttostr(fst)+':'+chr(Ord('A')+col)+inttostr(fst)].font.bold:=true;

//подгоним размеры

ws.Columns['A:'+chr(Ord('A')+col)].EntireColumn.AutoFit;

xl.ActiveWindow.SplitRow:=fst;

xl.ActiveWindow.FreezePanes:=True;

xl.ActiveSheet.PageSetup.Orientation:=xlLandscape;

xl.ActiveSheet.PageSetup.PrintArea:='$A:$G';

finally

//выход из экселя

// xl.quit;

end;

end;

procedure TPhoneBook.commentExit(Sender: TObject);

var i:integer;

begin

if CommentChanged then begin

for i:=0 to 100 do

ini.DeleteKey(phones.ItemFocused.Caption,'c'+inttostr(i));

for i:=0 to comment.Lines.Count-1 do

ini.WriteString(phones.ItemFocused.Caption,'c'+inttostr(i),comment.lines[i]);

end;

end;

procedure TPhoneBook.PopupListPopup(Sender: TObject);

begin

Groups.SetFocus;

end;

procedure TPhoneBook.commentChange(Sender: TObject);

begin

CommentChanged:=true;

end;

end.

Размещено на Allbest.ru


Подобные документы

  • Обзор и комплексный анализ операционной системы Windows Vista, оценка ее преимуществ и недостатков. Разработка программы, которая реализует алгоритм очереди на 20 элементов. Построение блок-схемы и листинг алгоритма, контрольный пример его работы.

    курсовая работа [4,2 M], добавлен 20.11.2013

  • Основы программирования на 32-битном Ассемблере, разработка с его помощью программы, демонстрирующей работу одного из разделов ОС Windоws. Описание используемых АРI-функций как интерфейса программирования приложений. Листинг программы, результаты работы.

    курсовая работа [164,5 K], добавлен 18.05.2014

  • Операционная система MS-DOS: история и характеристика. Обзор стандартных программ операционной системы Windows. Способы запуска программ. Служебные приложения Windows и их назначение: диспетчер задач, проверка, очистка, дефрагментация и архивация диска.

    реферат [221,4 K], добавлен 06.01.2015

  • Создание программы для хранения и обработки данных о съеме/сдаче жилья. Написание программы на языке C++ с использованием библиотеки Qt; использование исходного кода для создания приложения под Windows, Linux, Mac OS X без дополнительных изменений кода.

    курсовая работа [60,4 K], добавлен 07.03.2013

  • Характеристика операционной системы. История развития Windows. Сравнительная характеристика версий Windows. Элементы и инструменты Windows XP. Прикладные программы в Windows XP. Работа настольных и портативных компьютеров под управлением Windows.

    доклад [19,1 K], добавлен 16.10.2011

  • Программа операционной системы. Перемещение и копирование объектов. Окна Windows, операционное меню, настройка свойств папки, вызов справки Windows. Работа с дисками, папками и файлами, с приложениями и документами. Стандартные программы Windows.

    контрольная работа [21,9 K], добавлен 29.01.2011

  • Технические характеристики игрового приложения для операционной системы Microsoft Windows. Обоснование выбора состава технических и программных средств. Характеристика процесса разработки программы "Угадайка", ее спецификация, описание и тестирование.

    курсовая работа [422,4 K], добавлен 10.06.2011

  • Доступ пользователей сети к электронным сообщениям, хранящимся на сервере. Описание программы, аутентификация простая, APOP и AUTH-аутентификация. Реализация функций, руководство пользователя, алгоритмы функционирования программы, графический интерфейс.

    курсовая работа [1,1 M], добавлен 13.11.2009

  • Реализация программы, созданной средствами языка C#. Предназначение Windows-приложения для решения комплекса задач. Определение состава форм с графиком функции. Вычисление коэффициентов полинома. Создание текстового поля для введения корней многочлена.

    курсовая работа [234,8 K], добавлен 13.11.2016

  • Создание системной утилиты, работающей с реестром ОС Windows; структура, функции и роль реестра. Разработка программного обеспечения: интерфейс, структурная схема вызовов окон приложений; реализация и тестирование программы, процедуры; листинг модулей.

    курсовая работа [1,2 M], добавлен 01.06.2013

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.