logo
down
shadow

How to change the pixelformat of a TWICImage in Delphi 2010


How to change the pixelformat of a TWICImage in Delphi 2010

By : tatamas
Date : November 20 2020, 07:00 PM
it helps some times Bummi and Warren P asked that I post the answer that I had added sometime ago. Here is the answer:
For those that may want to know I tried this and it seems to work (it uses TcxImage by Developer Express, but I suspect TImage will work as well):
code :


Share : facebook icon twitter icon
is there a way to change scrolbar style in delphi 2010?

is there a way to change scrolbar style in delphi 2010?


By : user3340768
Date : March 29 2020, 07:55 AM
this one helps. This is how I do it in a custom component of mine (a simple text viewer):
code :
procedure TCustomViewer.UpdateScrollInfo;
var
  ScrollInfo: TScrollInfo;
begin
  with ScrollInfo do
  begin
    cbSize := SizeOf(ScrollInfo);
    fMask := SIF_POS or SIF_PAGE or SIF_RANGE or SIF_DISABLENOSCROLL;
    nMin := 0;
    nMax := 1023;
    nPage := PageWidth;
    nPos := FTopLeft.X;
  end;
  SetScrollInfo(Handle, SB_HORZ, ScrollInfo, True);
  with ScrollInfo do
  begin
    nMax := FLines.Count - 1;
    nPage := PageHeight;
    nPos := FTopLeft.Y;
  end;
  SetScrollInfo(Handle, SB_VERT, ScrollInfo, True);
  UpdateCaretPos;
  Update;
end;
How to change the font size of the editor tabs in Delphi 2010 IDE?

How to change the font size of the editor tabs in Delphi 2010 IDE?


By : user3802907
Date : March 29 2020, 07:55 AM
hope this fix your issue There is not an option to change the font size of these elements, but as you say this can be done writting an expert. Some time ago I started to write an Delphi IDE Expert (This project is not finished yet) which allow you to change the apparence of the Delphi IDE (here you can found the Source Code) , try using some of the code of this project to write your own. Check this image which shows the result of modify the code of the project to increase the font of the TIDEGradientTabSet.
CodeContracts: requires unproven: (image.PixelFormat & PixelFormat.Indexed) == 0

CodeContracts: requires unproven: (image.PixelFormat & PixelFormat.Indexed) == 0


By : Saurabh Sharma
Date : March 29 2020, 07:55 AM
will be helpful for those in need The issue is that Graphics.FromImage() can't be used with an indexed bitmap, and the corresponding contract assembly (System.Drawing.Contracts.dll) contains a precondition to enforce that. The static checker can't find anything in your code to prove the requirement is satisfied, so it gives you that warning.
You'll have to make sure that this._otherBitmap is not created with the PixelFormat.Indexed format. If you're absolutely sure it's not, you could add this line above the call to Graphics.FromImage():
code :
Contract.Assume((this._otherBitmap.PixelFormat & PixelFormat.Indexed) == 0);
How to change application icon within taskbar Delphi 2010

How to change application icon within taskbar Delphi 2010


By : tayfa3003
Date : March 29 2020, 07:55 AM
will help you The icon is that of the window associated with the taskbar button. So with Application.MainFormOnTaskbar set to True, it's the main form icon. When False it's the icon of the hidden window of Application. So to have different icon on taskbar from main form, you need MainFormOnTaskbar to be False, and assign different icon to Application.Icon. This seems to be the easy way to work around the issue.
If I recall the VCL only sets one size of icon. In my experience it is better to do the job properly yourself and send WM_SETICON messages directly to set both small and large icons.
In Delphi, how does TBitmap.Monochrome and .PixelFormat influcence the format of .ScanLine?

In Delphi, how does TBitmap.Monochrome and .PixelFormat influcence the format of .ScanLine?


By : Si1en7ium
Date : March 29 2020, 07:55 AM
With these it helps Monochrome has sense for pf1bit bitmaps.
Otherwise Monochrome := True changes bitmap format to DDB (pfDevice). Your screen is 32-bit, so call to Scanline caused DibNeeded call and transformation to 32bit, and using of function CopyToBitmapMono8 (intended for 8-bit) filled only 1/4 of screen.
code :
procedure CopyToBitmapMono8(_Buffer: PByte; _Bmp: TBitmap);
var
  y: Integer;
  x: Integer;
  ScanLine: PByteArray;
begin
  for y := 0 to _Bmp.Height - 1 do begin
    ScanLine := _Bmp.ScanLine[y];
    for x := 0 to _Bmp.Width - 1 do begin
      ScanLine[x] := _Buffer^;
      Inc(_Buffer);
    end;
  end;
end;

var
   FBmp: TBitmap;
   Buffer: PbyteArray;
   i: integer;
begin
  GetMem(Buffer, 512 * 100);
  for i := 0 to 512 * 100 - 1 do
     Buffer[i] := (i and 511) div 2; // gray gradient

  FBmp := Tbitmap.Create;
  FBmp.Width := 512;
  FBmp.Height := 100;
  FBmp.PixelFormat := pf8bit;
  CopyToBitmapMono8(PByte(Buffer), FBmp);
  Canvas.Draw(0, 0, FBmp);

  //now right approach
  FBmp.Palette := MakeGrayPalette; // try to comment
  CopyToBitmapMono8(PByte(Buffer), FBmp);
  Canvas.Draw(0, 110, FBmp);

end;

function TForm1.MakeGrayPalette: HPalette;
var
  i: integer;
  lp:  TMaxLogPalette;
begin
  lp.palVersion    := $300;
  lp.palNumEntries := 256;
  for i := 0 TO 255 do begin
     lp.palPalEntry[i].peRed   := i;
     lp.palPalEntry[i].peGreen := i;
     lp.palPalEntry[i].peBlue  := i;
     lp.palPalEntry[i].peFlags := PC_RESERVED;
   end;
   Result := CreatePalette(pLogPalette(@lp)^);
end;
Related Posts Related Posts :
  • Is there any way to run "dir" directly?
  • Delphi 7 inheritance
  • Resize PNG image
  • create a wav file from multiple wav files in delphi
  • Can Delphi dragging be "promoted" to docking?
  • Using Delphi's ShellExecute() with the process inheriting the original console?
  • Where to download Delphi BDE 5.01
  • How can create a color progressbar in delphi?
  • Is there a Delphi dropdown notification component?
  • How make DBLookupcombobox has a Windows 7 Look with RAD 2010?
  • Improve speed of own debug visualizer for Delphi 2010
  • I have the Process ID and need to close the associate process programmatically with Delphi 5
  • How test a Delphi app with Application Verifier 4.0?
  • DataSetProvider - DataSet to ClientDataSet
  • Creating Delphi Objects at runtime based on class type
  • installing Delphi5 pro in windows 64b
  • Which is more appropriate for pbx events, TIdTCPServer or TIdTCPClient?
  • Why "menus" unit is finalized too early?
  • Small Command line scripter (like Autocad commands) one line editor
  • Delphi: How to set the default project in a project group?
  • Delphi exe, will it run with just BDE configuration?
  • Looking for Delphi 4 professional/Quickreport
  • AcroPDF in Delphi - How do I scroll?
  • How retrive full path with file name or folder name from ShellTreeView/ShellListView
  • Difference between then and then begin?
  • Sending a file from my application (Indy/Delphi) to an ASP page and then onto another server (Amazon S3)
  • Need to send a pasting command from one program to another?
  • Delphi, read data from 3rd party data field
  • Looking for a good Delphi unicode string library
  • How can I create a context menu for a Delphi component?
  • How to access a Cassandra distributed database from Delphi
  • How to avoid the focus on Delphi application?
  • Emulate terminal services
  • A better way of converting Codepage-1251 in RTF to Unicode
  • How to pass multiple different records (not class due to delphi limitations) to a function?
  • How to get TableName of a DataSet?
  • Easiest way to find previous instance of an application
  • Difference between GetPixel and Canvas.Pixels in Delphi
  • How to use .Ini Files in FMX/Delphi
  • Get Current Pixel value using Scanline in Delphi
  • How to send both command line switches and paramstring with TShellExecuteInfo
  • Selection contains a component introduced in an ancestor
  • The process won't wait?
  • TADODataset catch Post method error code in Delphi
  • Direct show capture pin configure run time live gamer portable 2 plus
  • Connection timeout with TNetHTTPClient and Delphi 10.3
  • How to horizontally center text in a TMemo component?
  • Delphi listview change header text
  • Why MoveFile is missing operator?
  • Invalid types in Delphi XE4 generic wrapper
  • Variable required error (Delphi) - How to take the address of a procedure?
  • How to convert MySQL Blob field to string for insert statement
  • Correct way to add Items to Verticle List?
  • Disable close icons on editor tabs?
  • Filter similar records in a table using Dblookupcombobox
  • Continuing the 'for' where you left off
  • Is there a way to temporarily suspend VCL styles when redrawing a form?
  • How to add a row to a DBGrid?
  • Thread count increasing when clients connect to TIdTCPServer
  • Division confusion in Delphi
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk