Move the position of a picture in RichViewEdit
Move the position of a picture in RichViewEdit
I want to move the position of a picture in RichViewEdit . When the picture is moved,it is above the words in RichViewEdit and the position of words do not change?
I don't quite understand your question.
If you mean vertical align, create a button or key function to adjust the picture alignment to base, centered or upper.
If you want to move a picture from on location to another, make a function when rve is clicked and if the item is a picture, create a function to copy that image then delete it. On key up function paste the copied image. This is rather a tricky bit. I cannot give you every detail because it is quite a complex procedure.
I have no idea of any link to an example regarding changing location of pictures.
Hope you have the idea.
If you mean vertical align, create a button or key function to adjust the picture alignment to base, centered or upper.
If you want to move a picture from on location to another, make a function when rve is clicked and if the item is a picture, create a function to copy that image then delete it. On key up function paste the copied image. This is rather a tricky bit. I cannot give you every detail because it is quite a complex procedure.
I have no idea of any link to an example regarding changing location of pictures.
Hope you have the idea.
Thank you very much!
http://www.trichview.com/forums/viewtop ... op+picture
It gives a example in Delphi,but I only Known C++.So I have difficulties to change it to c++.Could you give me some help! Thank you!
http://www.trichview.com/forums/viewtop ... op+picture
It gives a example in Delphi,but I only Known C++.So I have difficulties to change it to c++.Could you give me some help! Thank you!
I am so absent minded that I sounded foolish.
The drag and drop have already implemented. Otherwise you have different version of rve, you do not actually need to translate the drag demo. All you have to do is focus on the picture then drag it. The drag demo automatically select the button upon clicking on it. That is all it does.
I guess the automatic selection can also be done for images.
The drag and drop have already implemented. Otherwise you have different version of rve, you do not actually need to translate the drag demo. All you have to do is focus on the picture then drag it. The drag demo automatically select the button upon clicking on it. That is all it does.
I guess the automatic selection can also be done for images.
shmp:
Thank you very much!
I want to move the picture,and the position of the words do not change,and the picture can cover on the words.But in the rve ,when moving the picture ,the position of the words changed.
In the example above,I have some difficulties :
TButton(ctrl).OnMouseDown := ControlMouseDown;
TButton(ctrl).OnMouseMove := ControlMouseMove;
TButton(ctrl).OnClick := ButtonClick;
I do not known how to change them into c++Builder.
Thank you very much!
I want to move the picture,and the position of the words do not change,and the picture can cover on the words.But in the rve ,when moving the picture ,the position of the words changed.
In the example above,I have some difficulties :
TButton(ctrl).OnMouseDown := ControlMouseDown;
TButton(ctrl).OnMouseMove := ControlMouseMove;
TButton(ctrl).OnClick := ButtonClick;
I do not known how to change them into c++Builder.
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Thank you very much!
Now,I think I can put a TImage on the TPanel over the rve,so I want change TPanel into transparent . But I do not know how to do. I have some codes ,when compile them,there are some errors.Could you give me some help! Thank you!
class TTransPanel :public TPanel
{
void __fastcall CreateParams(Controls::TCreateParams &Params)
{
TPanel::CreateParams(Params);
Params.ExStyle += WS_EX_TRANSPARENT;
}
void __fastcall AdjustColors(TPanelBevel Bevel,TColor& TopColor,TColor& BottomColor)
{
TopColor = clBtnHighlight;
if (Bevel == bvLowered) TopColor = clBtnShadow;
BottomColor = clBtnShadow;
if (Bevel == bvLowered) BottomColor = clBtnHighlight;
}
void __fastcall Paint()
{
DynamicArray<int> Alignments;
Alignments.set_length(3);
Alignments[taLeftJustify] = DT_LEFT;
Alignments[taCenter] = DT_CENTER;
Alignments[taRightJustify] = DT_RIGHT;
TRect Rect;
TColor TopColor, BottomColor;
int FontHeight;
Longint Flags;
Rect = GetClientRect();
if (BevelOuter != bvNone)
{
AdjustColors(BevelOuter,TopColor, BottomColor);
Frame3D(Canvas, Rect, TopColor, BottomColor, BevelWidth);
}
Frame3D(Canvas, Rect, Color, Color, BorderWidth);
if (BevelInner != bvNone)
{
AdjustColors(BevelInner,TopColor, BottomColor);
Frame3D(Canvas, Rect, TopColor, BottomColor, BevelWidth);
}
Canvas->Brush->Color = Color;
// Canvas->FillRect(Rect);
Canvas->Brush->Style = bsClear;
Canvas->Font = this->Font;
FontHeight = Canvas->TextHeight('W');
Rect.Top = ((Rect.Bottom + Rect.Top) - FontHeight) / 2;
Rect.Bottom = Rect.Top + FontHeight;
Flags = DT_EXPANDTABS | DT_VCENTER | Alignments[Alignment];
Flags = DrawTextBiDiModeFlags(Flags);
DrawText(Canvas->Handle, Caption.c_str(), -1, &Rect, Flags);
}
public:
__fastcall virtual TTransPanel(TComponent* AOwner):TPanel(AOwner)
{
ControlStyle >> csOpaque;
Width = 185;
Height = 41;
}
};
Now,I think I can put a TImage on the TPanel over the rve,so I want change TPanel into transparent . But I do not know how to do. I have some codes ,when compile them,there are some errors.Could you give me some help! Thank you!
class TTransPanel :public TPanel
{
void __fastcall CreateParams(Controls::TCreateParams &Params)
{
TPanel::CreateParams(Params);
Params.ExStyle += WS_EX_TRANSPARENT;
}
void __fastcall AdjustColors(TPanelBevel Bevel,TColor& TopColor,TColor& BottomColor)
{
TopColor = clBtnHighlight;
if (Bevel == bvLowered) TopColor = clBtnShadow;
BottomColor = clBtnShadow;
if (Bevel == bvLowered) BottomColor = clBtnHighlight;
}
void __fastcall Paint()
{
DynamicArray<int> Alignments;
Alignments.set_length(3);
Alignments[taLeftJustify] = DT_LEFT;
Alignments[taCenter] = DT_CENTER;
Alignments[taRightJustify] = DT_RIGHT;
TRect Rect;
TColor TopColor, BottomColor;
int FontHeight;
Longint Flags;
Rect = GetClientRect();
if (BevelOuter != bvNone)
{
AdjustColors(BevelOuter,TopColor, BottomColor);
Frame3D(Canvas, Rect, TopColor, BottomColor, BevelWidth);
}
Frame3D(Canvas, Rect, Color, Color, BorderWidth);
if (BevelInner != bvNone)
{
AdjustColors(BevelInner,TopColor, BottomColor);
Frame3D(Canvas, Rect, TopColor, BottomColor, BevelWidth);
}
Canvas->Brush->Color = Color;
// Canvas->FillRect(Rect);
Canvas->Brush->Style = bsClear;
Canvas->Font = this->Font;
FontHeight = Canvas->TextHeight('W');
Rect.Top = ((Rect.Bottom + Rect.Top) - FontHeight) / 2;
Rect.Bottom = Rect.Top + FontHeight;
Flags = DT_EXPANDTABS | DT_VCENTER | Alignments[Alignment];
Flags = DrawTextBiDiModeFlags(Flags);
DrawText(Canvas->Handle, Caption.c_str(), -1, &Rect, Flags);
}
public:
__fastcall virtual TTransPanel(TComponent* AOwner):TPanel(AOwner)
{
ControlStyle >> csOpaque;
Width = 185;
Height = 41;
}
};
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
For printing, use OnPagePostPaint event for drawing these pictures.
In this event use RV_PictureToDevice procedure (from the unit RVFuncs) to draw images.
procedure RV_PictureToDevice(Canvas: TCanvas; x,y, width, height: Integer; sad:TRVScreenAndDevice; gr: TGraphic; ToScreen: Boolean);
Though gr is TGraphic, it must be TBitmap.
Width and Height parameters may be zero, in this case the image is printed at its original size.
In this event use RV_PictureToDevice procedure (from the unit RVFuncs) to draw images.
procedure RV_PictureToDevice(Canvas: TCanvas; x,y, width, height: Integer; sad:TRVScreenAndDevice; gr: TGraphic; ToScreen: Boolean);
Though gr is TGraphic, it must be TBitmap.
Width and Height parameters may be zero, in this case the image is printed at its original size.