F
freeia
Unregistered / Unconfirmed
GUEST, unregistred user!
请大家帮我把下面两句Delphi翻译成对应的C++Builder,谢谢.
property ColorHighLight: TColor index 0 read FColorHighlight write SetColors default $008396A0;
property ColorShadow: TColor index 1 read FColorShadow write SetColors default $008396A0;
如果有兴趣,都翻译一遍也不错
type
TFlatPanel = class(TCustomPanel)
private
FTransparent: Boolean;
FColorHighlight: TColor;
FColorShadow: TColor;
procedure SetColors (Index: Integer; Value: TColor);
procedure CMEnabledChanged (var Message: TMessage); message CM_ENABLEDCHANGED;
procedure CMTextChanged (var Message: TWmNoParams); message CM_TEXTCHANGED;
procedure SetTransparent (const Value: Boolean);
protected
procedure Paint; override;
public
constructor Create (AOwner: TComponent); override;
published
property Transparent: Boolean read FTransparent write SetTransparent default false;
property Caption;
property Font;
property Color;
property ParentColor;
property Enabled;
property Visible;
property ColorHighLight: TColor index 0 read FColorHighlight write SetColors default $008396A0;
property ColorShadow: TColor index 1 read FColorShadow write SetColors default $008396A0;
我翻译的结果目前如下:
//---------------------------------------------------------------------------
#ifndef FlatPanelH
#define FlatPanelH
//---------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <Controls.hpp>
#include <ExtCtrls.hpp>
#include <Messages.hpp>
//---------------------------------------------------------------------------
class PACKAGE TFlatPanel : public TCustomPanel
{
private:
bool FTransparent;
TColor FColorHighlight;
TColor FColorShadow;
void __fastcall SetColors(int nIndex, TColor Value);
void __fastcall CMEnabledChanged (TMessage& Message);
void __fastcall CMTextChanged (TWmNoParams& Message);
void __fastcall SetTransparent(const bool Value);
private:
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(CM_ENABLEDCHANGED, TMessage, CMEnabledChanged)
VCL_MESSAGE_HANDLER(CM_TEXTCHANGED, TWmNoParams, CMTextChanged)
END_MESSAGE_MAP(TCustomPanel)
protected:
void __fastcall Paint(void);
public:
__fastcall TFlatPanel(TComponent* Owner);
__published:
__property bool Transparent = {read=FTransparent, write=SetTransparent, default=false};
__property Caption;
__property Font;
__property Color;
__property ParentColor;
__property Enabled;
__property Visible;
__property TColor ColorHighLight = {index=0, read=FColorHighlight, write=SetColors, default=008396A0};
__property TColor ColorShadow = {index=1, read=FColorShadow, write=SetColors, default=008396A0};
但提示TWmNoParams找不到,我明明包含了Messages.hpp文件啊.
property ColorHighLight: TColor index 0 read FColorHighlight write SetColors default $008396A0;
property ColorShadow: TColor index 1 read FColorShadow write SetColors default $008396A0;
如果有兴趣,都翻译一遍也不错
type
TFlatPanel = class(TCustomPanel)
private
FTransparent: Boolean;
FColorHighlight: TColor;
FColorShadow: TColor;
procedure SetColors (Index: Integer; Value: TColor);
procedure CMEnabledChanged (var Message: TMessage); message CM_ENABLEDCHANGED;
procedure CMTextChanged (var Message: TWmNoParams); message CM_TEXTCHANGED;
procedure SetTransparent (const Value: Boolean);
protected
procedure Paint; override;
public
constructor Create (AOwner: TComponent); override;
published
property Transparent: Boolean read FTransparent write SetTransparent default false;
property Caption;
property Font;
property Color;
property ParentColor;
property Enabled;
property Visible;
property ColorHighLight: TColor index 0 read FColorHighlight write SetColors default $008396A0;
property ColorShadow: TColor index 1 read FColorShadow write SetColors default $008396A0;
我翻译的结果目前如下:
//---------------------------------------------------------------------------
#ifndef FlatPanelH
#define FlatPanelH
//---------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <Controls.hpp>
#include <ExtCtrls.hpp>
#include <Messages.hpp>
//---------------------------------------------------------------------------
class PACKAGE TFlatPanel : public TCustomPanel
{
private:
bool FTransparent;
TColor FColorHighlight;
TColor FColorShadow;
void __fastcall SetColors(int nIndex, TColor Value);
void __fastcall CMEnabledChanged (TMessage& Message);
void __fastcall CMTextChanged (TWmNoParams& Message);
void __fastcall SetTransparent(const bool Value);
private:
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(CM_ENABLEDCHANGED, TMessage, CMEnabledChanged)
VCL_MESSAGE_HANDLER(CM_TEXTCHANGED, TWmNoParams, CMTextChanged)
END_MESSAGE_MAP(TCustomPanel)
protected:
void __fastcall Paint(void);
public:
__fastcall TFlatPanel(TComponent* Owner);
__published:
__property bool Transparent = {read=FTransparent, write=SetTransparent, default=false};
__property Caption;
__property Font;
__property Color;
__property ParentColor;
__property Enabled;
__property Visible;
__property TColor ColorHighLight = {index=0, read=FColorHighlight, write=SetColors, default=008396A0};
__property TColor ColorShadow = {index=1, read=FColorShadow, write=SetColors, default=008396A0};
但提示TWmNoParams找不到,我明明包含了Messages.hpp文件啊.