30.03.2011, 21:48 | #1 (permalink) |
Новичок
Регистрация: 30.03.2011
Сообщений: 1
Сказал(а) спасибо: 0
Поблагодарили 0 раз(а) в 0 сообщениях
Репутация: 10
|
Delphi, объясните принцип рисования StringGrid1. Canvas
Имеется календарь на один месяц. требуется чтобы по активации рамка(окружность) двигалась по датам с заданным интервалом, а по отмене - рамка вставала на первое число в календаре. Работает почти всё, только когда рамка доходит до 6-го числа - она начинает цикл в той же строке, а на след. не переходит. Подправьте, если вам не трудно или объясните принцип пожалуйста. Ссылка удалена код: Код:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Grids, ComCtrls, ExtCtrls, Menus; type TForm1 = class(TForm) StringGrid1: TStringGrid; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Timer1: TTimer; Label8: TLabel; PopupMenu1: TPopupMenu; N1: TMenuItem; mm1: TMainMenu; N2: TMenuItem; N3: TMenuItem; procedure FormCreate(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure N1Click(Sender: TObject); procedure N3Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; i,j,k:byte; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin StringGrid1.Cells[1,0]:='1'; StringGrid1.Cells[2,0]:='2'; StringGrid1.Cells[3,0]:='3'; StringGrid1.Cells[4,0]:='4'; StringGrid1.Cells[5,0]:='5'; StringGrid1.Cells[6,0]:='6'; StringGrid1.Cells[0,1]:='7'; StringGrid1.Cells[1,1]:='8'; StringGrid1.Cells[2,1]:='9'; StringGrid1.Cells[3,1]:='10'; StringGrid1.Cells[4,1]:='11'; StringGrid1.Cells[5,1]:='12'; StringGrid1.Cells[6,1]:='13'; StringGrid1.Cells[0,2]:='14'; StringGrid1.Cells[1,2]:='15'; StringGrid1.Cells[2,2]:='16'; StringGrid1.Cells[3,2]:='17'; StringGrid1.Cells[4,2]:='18'; StringGrid1.Cells[5,2]:='19'; StringGrid1.Cells[6,2]:='20'; StringGrid1.Cells[0,3]:='21'; StringGrid1.Cells[1,3]:='22'; StringGrid1.Cells[2,3]:='23'; StringGrid1.Cells[3,3]:='24'; StringGrid1.Cells[4,3]:='25'; StringGrid1.Cells[5,3]:='26'; StringGrid1.Cells[6,3]:='27'; StringGrid1.Cells[0,4]:='28'; StringGrid1.Cells[1,4]:='29'; StringGrid1.Cells[2,4]:='30'; StringGrid1.Cells[3,4]:='31'; i:=20*2; end; procedure TForm1.Timer1Timer(Sender: TObject); begin if i=287 then begin i:=0; j:=j+41; end; StringGrid1.Repaint; StringGrid1.Canvas.Brush.Style:=bsClear; StringGrid1.Canvas.Pen.Width:=1; StringGrid1.Canvas.Pen.Color:=clGreen; StringGrid1.Canvas.Ellipse(0+i,0+j,41+i,41+j); i:=i+41; k:=k+1; if k=50 then begin i:=20*2; j:=0; k:=50 end; end; procedure TForm1.N1Click(Sender: TObject); begin Timer1.Enabled:=true; end; procedure TForm1.N3Click(Sender: TObject); begin Timer1.Enabled:=false; StringGrid1.Repaint; StringGrid1.Canvas.Brush.Style:=bsClear; StringGrid1.Canvas.Pen.Width:=1; StringGrid1.Canvas.Pen.Color:=clGreen; i:=20*2; j:=0; k:=0; StringGrid1.Canvas.Ellipse(0+i,0+j,40+i,40+j); end; end. №5.zip Последний раз редактировалось Fenix; 11.06.2013 в 11:33 Причина: Ссылка мертва |
30.03.2011, 21:48 | |
Helpmaster
Member
Регистрация: 08.03.2016
Сообщений: 0
|
Хорошо было бы прочесть похожие обсуждения Помогите с программой рисования 3D-плат Принцип работы многоядерного процессора - нужна помощь Преобразователь напряжения, принцип работы Нужно описать принцип действия принципиальной схемы Помогите, нужно написать принцип действия схемы Принцип работы транзистора |
Ads | |
Member
Регистрация: 31.10.2006
Сообщений: 40200
Записей в дневнике: 0
Сказал(а) спасибо: 0
Поблагодарили 0 раз(а) в 0 сообщениях
Репутация: 55070
|
|
|