🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.language.delphi.dotnet
1 messages
1 total messages Started by ziddiri40 Thu, 05 Jun 2008 13:46
Class Helpers and Field Definations
#138
Author: ziddiri40
Date: Thu, 05 Jun 2008 13:46
33 lines
2289 bytes
Hi,
I'm trying to add some properties and functions to
System.Drawing.Bitmap class. My code is below:

type
  [StructLayout(LayoutKind.Sequential)]
  TPixelData = record
    Blue: Byte;
    Green: Byte;
    Red: Byte;
  end;

  BitmapHelper = class helper for System.Drawing.Bitmap
  strict private
    FRegionTransparentColor: System.Drawing.Color;
    function GetRegionTransparentColor: Color;
    procedure SetRegionTransparentColor(const Value: Color);
    function GetRegionPath: GraphicsPath;
    {$UNSAFECODE ON}function GetPixelFromPointer(Base: IntPtr; X, Y:
Integer): TPixelData; unsafe;{$UNSAFECODE OFF}
  public
    property RegionTransparentColor: Color read
GetRegionTransparentColor
      write SetRegionTransparentColor;
    property RegionPath: GraphicsPath read GetRegionPath;
  end;

Compiler says "Field definition not allowed after methods or
properties" in this line:
    FRegionTransparentColor: System.Drawing.Color;

But I think, there is no methods or properties before this field. Does
the class helper supports field definitions?
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads