unit testFrm; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.ComCtrls, Vcl.Grids, Vcl.DBGrids, Vcl.StdCtrls, Vcl.CheckLst; type TtestFrame = class(TForm) lv1: TListView; saveBtn1: TButton; chklst1: TCheckListBox; saveBtn2: TButton; edt: TEdit; procedure saveBtn1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure saveBtn2Click(Sender: TObject); procedure edtChange(Sender: TObject); procedure edtExit(Sender: TObject); procedure lv1DblClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var testFrame: TtestFrame; nCurIndex : Integer; implementation {$R *.dfm} procedure TtestFrame.FormCreate(Sender: TObject); begin ShowScrollBar(lv1.Handle,SB_HORZ,False); end; procedure TtestFrame.lv1DblClick(Sender: TObject); var W,X,nCount,nCol:Integer; Rect:TRect; Pos : TPoint; ColSet:set of 0..0; //屏蔽列段 begin ColSet := [0..0]; if Assigned(lv1.Selected) then begin Pos := lv1.ScreenToClient(Mouse.CursorPos); nCount := lv1.Columns.Count; X := GetScrollPos(lv1.Handle,SB_HORZ); for nCol := 0 to nCount - 1 do begin W := lv1.Columns[nCol].Width; if Pos.X <= X+W then begin Break; end; X:=X+W; end; nCurIndex := nCol; if nCol = nCount then begin Exit; end; if (nCol in ColSet) then begin Exit; end; if X <0 then begin Exit; W := W+X; X := 0; end; Rect := lv1.Selected.DisplayRect(drBounds); Pos.X := X-lv1.Left; Pos.Y := Rect.Top; MapWindowPoints(lv1.Handle,Handle,Pos,1); edt.SetBounds(Pos.X,Pos.Y,W,Rect.Bottom-Rect.Top+3); edt.Parent := lv1; edt.Top := lv1.Selected.Top; edt.Text := lv1.Selected.SubItems[nCurIndex - 1]; edt.Visible := True; edt.SetFocus; end; end; procedure TtestFrame.edtChange(Sender: TObject); begin lv1.Selected.SubItems[nCurIndex-1] := edt.Text; end; procedure TtestFrame.edtExit(Sender: TObject); begin if edt.Text <> '' then begin lv1.Selected.SubItems[nCurIndex - 1]:=edt.Text; end; edt.Visible := False; end; procedure TtestFrame.saveBtn1Click(Sender: TObject); var i : Integer; begin lv1.Clear; for i := 0 to 30 do begin with lv1.Items.Add do begin Caption := '测试1'; SubItems.Add('测试2'); SubItems.Add('测试3'); end; end; chklst1.Items.AddObject('AAA',TObject(1000)); chklst1.Items.AddObject('BBB',TObject(1001)); chklst1.Items.AddObject('CCC',TObject(1002)); end; procedure TtestFrame.saveBtn2Click(Sender: TObject); var i : Integer; begin for i := 0 to chklst1.Count - 1 do begin if chklst1.Checked[i] then begin ShowMessage(IntToStr(Integer(chklst1.Items.Objects[i]))); end; end; end; end.
本文详细介绍了一种利用 ESP8266 01S 模块构建 Web 服务器的成功实践方案。通过具体的代码示例和详细的步骤说明,帮助读者快速掌握该模块的使用方法。在疫情期间,作者重新审视并研究了这一未被充分利用的模块,最终成功实现了 Web 服务器的功能。本文不仅提供了完整的代码实现,还涵盖了调试过程中遇到的常见问题及其解决方法,为初学者提供了宝贵的参考。 ...
[详细]