anchor.diff:    {%region 'Auto-generated GUI code' -fold}
     {@VFD_BODY_BEGIN: MainForm}
     Name := 'MainForm';
  -  SetPosition(357, 227, 484, 378);
  -  WindowTitle := 'MainForm';
  +  SetPosition(357, 227, 630, 378);
  +  WindowTitle := 'Image Conversion Tool';
     Hint := '';
  -  AcceptDrops := True;
  +  DNDEnabled := True;
   
     MainMenu := TfpgMenuBar.Create(self);
     with MainMenu do
     begin
       Name := 'MainMenu';
  -    SetPosition(0, 0, 484, 24);
  +    SetPosition(0, 0, 630, 24);
       Anchors := [anLeft,anRight,anTop];
     end;
   
  
positive.code:     AddMenuItem('Quit', 'Ctrl+Q', @miFileQuit);
    end;
  
    {@VFD_BODY_END: MainForm}
  
    MainMenu.AddMenuItem('File', nil).SubMenu := pmFile;
  
negative.code: 
  implementation
  
  uses
    fpg_utils;
  
  {@VFD_NEWFORM_IMPL}
  
  procedure TMainForm.miFileQuit(Sender: TObject);
  begin
    Close;
  end;
  
  procedure TMainForm.MemoDragEnter(Sender, Source: TObject;
    AMimeList: TStringList; var AMimeChoice: TfpgString;
    var ADropAction: TfpgDropAction; var Accept: Boolean);
  var
    s: string;
  begin
    s := 'text/uri-list';  // 'text/plain';
    Accept := AMimeList.IndexOf(s) > -1;
    if Accept then
    begin
      if AMimeChoice <> s then
        AMimeChoice := s;
    end;
  end;
  
  procedure TMainForm.MemoDragDrop(Sender, Source: TObject; X, Y: integer;
    AData: variant);
  var
    fileName: string;
    sl: TStringList;
    i: integer;
  begin
    sl := TStringList.Create;
    try
      sl.Text := AData;
      memImages.BeginUpdate;
      for i := 0 to sl.Count-1 do
      begin
        fileName := sl[i];
        fileName := StringReplace(fileName, 'file://', '', []);
        memImages.Text := memImages.Text + ConvertImage(fileName);
      end;
    finally
      memImages.EndUpdate;
      sl.Free;
    end;
  end;
  
  function TMainForm.ConvertImage(const AFileName: string): string;
  const
    Prefix = '     ';
    MaxLineLength = 72;
  var
    InStream: TFileStream;
    I, Count: longint;
    b: byte;
    Line, ToAdd: String;
    ConstName: string;
  
    procedure WriteStr(const St: string);
    begin
      Result := Result + St;
    end;
  
    procedure WriteStrLn(const St: string);
    begin
      Result := Result + St + LineEnding;
    end;
  
  begin
    InStream := TFileStream.Create(AFileName, fmOpenRead);
    try
      ConstName := 'newimg_' + ChangeFileExt(fpgExtractFileName(AFileName), '');
      WriteStrLn('');
      WriteStrLn('const');
  
      InStream.Seek(0, soFromBeginning);
      Count := InStream.Size;
      WriteStrLn(Format('  %s: array[0..%d] of byte = (',[ConstName, Count-1]));
      Line := Prefix;
      for I := 1 to Count do
      begin
        InStream.Read(B, 1);
        ToAdd := Format('%3d',[b]);
        if I < Count then
          ToAdd := ToAdd + ',';
        Line := Line + ToAdd;
        if Length(Line) >= MaxLineLength then
        begin
          WriteStrLn(Line);
          Line := PreFix;
        end;
      end; { for }
      WriteStrln(Line+');');
      WriteStrLn('');
    finally
      InStream.Free;
    end;
  end;
  
  procedure TMainForm.btnClearClicked(Sender: TObject);
  begin
    memImages.Text := '';
  end;
  
  procedure TMainForm.AfterCreate;
  