nvas:TCanvas;Left,Top,Width,Height:integer;PanelType:integer); var Right,Bottom:integer; LeftTopColor,RightBottomColor:TColor; begin //凸起的panel if PanelType=RaisedPanel then begin LeftTopColor:=clwhite; RightBottomColor:=clgray; end else//凹下去的panel begin LeftTopColor:=clgray; RightBottomColor:=clwhite; end; Right:=Left+width; Bottom:=Top+Height;
procedure TForm1.ListView1SelectItem(Sender: TObject; Item: TListItem; Selected: Boolean); begin //当ShellTreeView1目录改变时 会激发此事件, if listview1.SelCount=0 then exit;
//当窗体释放时也会激发此事件 //ImageFileList.GetFileCount=0 后再 ImageFileList.SetIndex(item.Index); //会引起异常 if ImageFileList.GetFileCount=0 then exit;
procedure TForm1.ShowPreImageFit(const ImageFileName: string); begin Image1.Visible:=false; if IsJpgFile(ImageFileName) then begin JpgToBmp(ImageFileName,PreViewJpg,PreViewBmp); Image1.Picture.Bitmap:=PreViewBmp; end else Image1.Picture.LoadFromFile(ImageFileName);
if (Image1.Picture.Bitmap.Height<=Panel1.Height) and (image1.Picture.Bitmap.Width<=Panel1.Width) then begin Image1.AutoSize:=true; Image1.Stretch:=true; Image1.Left:=(Panel1.Width-image1.Width) div 2; Image1.Top:=(Panel1.Height-image1.Height) div 2; end elseif Panel1.Height>=Panel1.Width then begin Image1.AutoSize:=false; Image1.Stretch:=true; if image1.Picture.Bitmap.Height>=image1.Picture.Bitmap.Width then begin image1.Height:=Panel1.Width; Image1.Width:=Image1.Height*Image1.Picture.Bitmap.Width div Image1.Picture.Bitmap.Height; &