![]() ![]() ![]() When on mouse move the line sometimes disappear and don't get painted (I think it is because of drawing focus rect).If the border is too thick you get the following effect.Rectangle(DC, 1, 1, FSideColorWidth, Height - 1) Īnd you can use it like this procedure TForm15.Button1Click(Sender: TObject) Īs this is merely another hack to draw a simple rectangle on the side, do not expect it to be perfect on all situations. Pen := CreatePen(PS_SOLID, FSideColorWidth, RGB(R,G,B)) Procedure TMemo.WMPaint(var Message: TWMPaint) Procedure TMemo.SetSideColorWidth(const Value: Integer) Procedure TMemo.SetSideColor(const Value: TColor) Procedure TMemo.SetAskForAttention(const Value: Boolean) Property AskForAttension: Boolean read FAskForAttention write SetAskForAttention Property SideColorWidth: Integer read FSideColorWidth write SetSideColorWidth default 2 Property SideColor: TColor read FSideColor write SetSideColor default clRed Procedure SetAskForAttention(const Value: Boolean) Procedure SetSideColor(const Value: TColor) ![]() Procedure SetSideColorWidth(const Value: Integer) Procedure WMPaint(var Message: TWMPaint) message WM_PAINT Otherwise create a descendant of TMemo and apply the same changes below TMemo = class() You can use the WM_Paint message and a hack to do this without creating a new component, Furthermore many components will be required so grouping with TPanel will up the memory usage. Grouping of components together is also not a solution for me since many mouse events are tied to the Memo and calls to FindVCLWindow will return changing components under the mouse. KMemo, JvMemo and many other components were installed and checked for any hidden support for achieving the same but none worked. I tried making a few composite components with CustomContainersPack by combining a TShape with TMemo, even superimposing a TMemo on top of TSynMemo but didn't succeed as the paint while dragging made it look disassembled and CCPack is not that robust for my IDE. The problem with SynMemo is that it doesn't support variable width fonts like Tahoma but the TMemo does. ![]() It need not be functional as a gutter but looks like one especially like that of a SynMemo as shown in the image. I need a line to the left(inside or outside) of a TMemo whose thickness(optional) and color can be controlled just for the purposes of indication. If you need access to the specifics of the graphic class itself, you can refer to the picture's Graphic property.Need a component derived from TMemo (not TSyn components) (The only standard graphic that has a canvas is TBitmap.) Normally, when dealing with a picture, you work only with the parts of the graphic class exposed through TPicture. Keep in mind that a picture class always has a graphic, and a graphic might have a canvas. For example, the image control has a property called Picture, of type TPicture, enabling the control to display images from many kinds of graphics. That is, an item of type TPicture can contain a bitmap, an icon, a metafile, or a user-defined graphic type, and an application can access them all in the same way through the picture class. A picture is a container for a graphic, meaning it could contain any of the graphic classes.By defining a minimal standard interface for all graphics, TGraphic provides a simple mechanism for applications to use different kinds of graphics easily. You can also define your own graphic classes. Delphi defines classes TBitmap, TIcon, and TMetafile, all descended from a generic TGraphic. A graphic represents a graphic image of the sort usually found in a file or resource, such as a bitmap, icon, or metafile.A canvas is always a property of something else, never a stand-alone class. A canvas represents a bitmapped drawing surface on a form, graphic control, printer, or bitmap.There are three kinds of classes in Delphi that deal with graphics: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |