-
Постов
322 -
Зарегистрирован
-
Посещение
-
Победитель дней
56
Весь контент OnePeople
-
Вот что говорит: System.NullReferenceException: Object reference not set to an instance of an object
-
procedure TForm1.IdUDPServer1UDPRead(AThread: TIdUDPListenerThread; const AData: TIdBytes; ABinding: TIdSocketHandle); Ругается на константы. Как заставить работать??? Добавлял для AData в uses idGlobal; Но всё равно с AData ничего не сделать, на все его параметры среда ругается( Вообще у меня Client нормально всё отрабатывает, а на компе сервер отвечает, может как то клиентом можно отловить ответ сервера?
-
Не знаю как в fmx но в vcl при перерисовке в потоке нужно для image использовать команды lock и unlock
-
Спасибо за помощь, не могу завести( Делаю так uses PrinerAPI; var MyPrinter:TMyPrinter; begin if (MyPrinter<>NIL)and(not SameText(MyPrinter.PrinterName, Printer.ActivePrinter.Device)) then FreeAndNil(MyPrinter); MyPrinter:=TMyPrinter.Create(Printer.ActivePrinter.Device,false); MyPrinter.PrinterProperties; Access V в PrinterAPI procedure TMyPrinter.Get_Printer(DevModePtr:PDeviceMode); var pi:TPrinterInfo9; sz:integer; buf:PPrinterInfo9; r:Cardinal; InfoKind:integer; begin sz:=0; CheckError(); pi.pDevMode := DevModePtr; if UseDefaultSettings then InfoKind := 8 else InfoKind := 9; r:=GetLastError; if r<>0 then RaiseLastOSError; if not Winapi.Winspool.GetPrinter(Handle, InfoKind, nil, 0, @sz) then begin r:=GetLastError; if r<>ERROR_INSUFFICIENT_BUFFER then RaiseLastOSError else if sz=8 then // shit happens. windows не говорит, каого размера буфер ей надо ((( sz:=10000; end; buf:=getmemory(sz); try if not Winapi.Winspool.GetPrinter(Handle, InfoKind, buf, sz, @sz) then RaiseLastOSError else SetLastError(0); ---------------------------------------------------------------------------------------------------------- MoveMemory(DevModePtr, buf.pDevMode, buf.pDevMode.dmSize+buf.pDevMode.dmDriverExtra); --ЗДЕСЬ ---------------------------------------------------------------------------------------------------------- finally freeMemory(buf); end; P.S. Извеняюсь всё работает, просто от администратора нужно запускать, ничего манифест добавлю)))
-
Делаю простинькую настройку печати из Memo var m:Single; i,page,pageall:integer; DestRect:TRectF; textFill: tFillTextFlags; stranp:TStringList; pt:Boolean; begin m:= Memo2.Lines.Count-1; pageall:=Round(m) div 67; if Round(m) mod 67>0 then pageall:=pageall+1; textFill := []; Printer.Title := Memo2.Lines.Strings[0]; Printer.Copies := StrToInt(SpinBox1.Text); // Printer.Orientation := poLandscape; stranp:=TStringList.Create; Printer.ActivePrinter:=Printer.Printers[Combobox1.ItemIndex]; Printer.BeginDoc; Printer.Canvas.Font.Size := 14; Printer.Canvas.Font.Family:='Arial'; page:=1; pt:=true; while (not Printer.Aborted) and (Printer.Printing) and (pt) do begin stranp.Clear; for I := 0 to 67 do begin if i+((page-1)*67)<=Memo2.Lines.Count-1 then stranp.Add(Memo2.Lines.Strings[i+((page-1)*67)]+' '+IntToStr(pageall)); end; DestRect := RectF(100,100,(Printer.Pagewidth - 100),(Printer.PageHeight - 100)); Printer.Canvas.FillText(DestRect,stranp.Text,True,1,textFill,TTextAlign.Center,TTextAlign.Leading); Inc(page); if (page <= pageall) and (not printer.aborted) then begin Printer.NewPage; end else begin pt:=false; end; end; Printer.EndDoc; stranp.Free; end; Всё отлично работает, кроме того что я хочу открыть настройки печати самого принтера Printer.ActivePrinter.ShowDeviceOptions; Не работает( Там даже кода нет( И ещё вопрос как узнать состояние принтера готов не готов в WinApi будет GetPrinter(hPrinter, PRINTER_INFO_2... , как в Обезьяне сделать?
-
Платформа: Windows Delphi: Seatle Есть листбокс прокручивается клавишами с клавиатуры. В XE8 был баг и прокрутки своей небыло, делал так scb:=VideoList.FindStyleResource('vscrollbar') as TScrollBar; posIt:= (VideoList.ItemIndex div vidcolumn) * VideoList.ItemHeight; posVer:=scb.Value; posNiz:=scb.Value+VideoList.Height; if posIt>posNiz-VideoList.ItemHeight then begin TAnimator.AnimateFloat(scb,'Value',(VideoList.ItemIndex div 5) * VideoList.ItemHeight-VideoList.Height+VideoList.ItemHeight,0.25); end; if posIt<posVer then begin TAnimator.AnimateFloat(scb,'Value',(VideoList.ItemIndex div 5) * VideoList.ItemHeight,0.25); end; Сейчас прокрутка есть но не плавная, подскажите пожалуйста как сделать плавную или вообще её отключить! P.S. когда не было прокрутки, меня мой вариант устраивал
-
Хотел сделать эффект что бы при наведении Item увеличивался, с Item манимуляции ни к чему не привели так как он оказывается за другими Itemами, сделал создание в ListBox контрола. Все работает но как позиция моего контрола становиться большее 1500 контрол исчезает(( procedure TForm1.VideoListChange(Sender: TObject); var scb:TScrollBar; posVer,posIt,posNiz:Single; po:Real; bmp:TBitmap; begin po:= (VideoList.ItemIndex div vidcolumn)* VideoList.ItemHeight; FocusItem.Position.X:=(((VideoList.ItemIndex mod vidcolumn)* VideoList.ItemWidth))*mashX+9; FocusItem.Position.Y:=(po)*mashY+9; if VideoList.Items.Count-1>=predit then VideoList.ItemByIndex(predit).Opacity:=1; scb:=VideoList.FindStyleResource('vscrollbar') as TScrollBar; posIt:= (VideoList.ItemIndex div vidcolumn) * VideoList.ItemHeight; posVer:=scb.Value; posNiz:=scb.Value+VideoList.Height; if posIt>posNiz-VideoList.ItemHeight then begin TAnimator.AnimateFloat(scb,'Value',(VideoList.ItemIndex div 5) * VideoList.ItemHeight-VideoList.Height+VideoList.ItemHeight,0.15); end; if posIt<posVer then begin TAnimator.AnimateFloat(scb,'Value',(VideoList.ItemIndex div 5) * VideoList.ItemHeight,0.15); end; VideoList.ItemByIndex(VideoList.ItemIndex).StylesData['Rectangle2.Fill.Color']:=$CF0C0C0C; VideoList.ItemByIndex(VideoList.ItemIndex).StylesData['Icon.Opacity']:=1; FocusItem.Align:=TAlignLayout.None; bmp:=TBitmap.Create; bmp.Assign(VideoList.ItemByIndex(VideoList.ItemIndex).ItemData.Bitmap); VideoList.ItemByIndex(VideoList.ItemIndex).Opacity:=0; po:= ( ((VideoList.ItemIndex div vidcolumn)* VideoList.ItemHeight)); FocusItem.Position.X:=(((VideoList.ItemIndex mod vidcolumn)* VideoList.ItemWidth))*mashX+9; FocusItem.Position.Y:=(po)*mashY+9; predit:=VideoList.ItemIndex; ItemIcon.Fill.Bitmap.Bitmap:=Bmp; ItemText.Text:=VideoList.ItemByIndex(VideoList.ItemIndex).ItemData.Text; FocusItem.Width:=VideoList.ItemWidth-18; FocusItem.Height:=VideoList.ItemHeight-18; FocusItem.Visible:=true; FocusItem.Opacity:=1; FocusItem.BringToFront; TAnimator.AnimateFloat(FocusItem,'Width',FocusItem.Width+(14*(FocusItem.Width/FocusItem.Height)),0.25); TAnimator.AnimateFloat(FocusItem,'Height',FocusItem.Height+14,0.25); Title.Text:=FloatToStr(FocusItem.Position.X)+''+FloatToStr(FocusItem.Position.y); TAnimator.AnimateFloat(FocusItem,'Position.X',FocusItem.Position.X-(7*(FocusItem.Width/FocusItem.Height)),0.25); TAnimator.AnimateFloat(FocusItem,'Position.Y',FocusItem.Position.Y-7,0.25); bmp.Free; end;
-
Нет ну это само сабой, просто я думал может есть какой нибудь ключ, для отправки вне основного потока. Почему для таких компонентов сразу так не делать?
-
Отправляю список файлов по WiFi, программа стопориться до конца отправки, как этого избежать?( if AResource.Hint='GetPlayList' then begin try for p := 0 to TetheringManager1.RemoteProfiles.Count-1 do TetheringAppProfile1.SendString(TetheringManager1.RemoteProfiles[p],'MusicClear','1'); except end; for i := 0 to PlayList.Items.Count-1 do begin try for p := 0 to TetheringManager1.RemoteProfiles.Count-1 do TetheringAppProfile1.SendString(TetheringManager1.RemoteProfiles[p],'AddMusic',IntToStr(i)+'.'+PlayList.Items.Strings[i]); except end; end; end;