[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to prevent the user from editing COM objects in TRxRichEdit?

Posted on 2004-11-12
3
Medium Priority
?
361 Views
Last Modified: 2010-04-05
I use TRxRichEdit component in my application to make a chat with emoticon. Everything looks fine but the user can click the emoticon image and resize it using anchors on the image borders or doubleclick the image and edit it. I want to prevent the user from this (like in MSN Messenger). I discovered MSDN and didn't find any help yet.

Many thanks
msa
0
Comment
Question by:msa2003
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
Imthiyaz_ph earned 1000 total points
ID: 12583359
could plz explain how u r inserting the emoticons?
0
 
LVL 5

Author Comment

by:msa2003
ID: 12585444
Now I use the following code to generate RTF-encoded DIB from bitmap (like it is described in Rich Text Format reference from Microsoft):

unit URTF;

{
  Source:   http://www.delphi3000.com/articles/article_1819.asp
}

interface
uses
  SysUtils,
  Classes,
  Graphics;

  function BitmapToRTF(pict: TBitmap): String;

implementation

function BitmapToRTF;
var
  bi,bb,rtf: string;
  bis,bbs: Cardinal;
  achar: ShortString;
  hexpict: string;
  I: Integer;
begin
  GetDIBSizes(pict.Handle,bis,bbs);
  SetLength(bi,bis);
  SetLength(bb,bbs);
  GetDIB(pict.Handle,pict.Palette,PChar(bi)^,PChar(bb)^);
  rtf := '{\rtf1 {\pict\dibitmap0 ';
  SetLength(hexpict,(Length(bb) + Length(bi)) * 2);
  I := 2;
  for bis := 1 to Length(bi) do
  begin
    achar := IntToHex(Integer(bi[bis]), 2);
    hexpict[I-1] := achar[1];
    hexpict[I] := achar[2];
    Inc(I,2);
  end;
  for bbs := 1 to Length(bb) do
  begin
    achar := IntToHex(Integer(bb[bbs]), 2);
    hexpict[I-1] := achar[1];
    hexpict[I] := achar[2];
    Inc(I,2);
  end;
  rtf := rtf + hexpict + ' }}';
  Result := rtf;
end;

end.

Then I use TStringStream and TRichEdit.LoadFromStream to replace the selection with emoticon.

Previously I tried to use RTF's encoded by WordPad with inline object (MS Paint). When I use DIB instead of inline object, there is no opportunity to edit image with Paint but the user still can drag the picture's bounds resizing it.
0
 
LVL 5

Author Comment

by:msa2003
ID: 12585480
Now the question title should look like "How to prevent the user from resizing DIBs in TRxRichEdit?", so I'll accept the Imthiyaz_ph's comment and repost the question.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question