When I use zooming with mouse on a chart (TeeChart) (left button and drag bottom right) cursor draws a marquee rectangle for zoom area. Marquee line is barely visible in light-grey color. Is there any way to change the color of marquee line (something like black, red etc) to make it more contrast and easy to see?
I'm using VCL TChart 4.04.
I think this is not possible in TChart v.4.04, or at least haven't found any property which might do this.
At least in TChart v.8.03 (the one shipped with Delphi 2009) there are properties TChart.Zoom.Brush and TChart.Zoom.Pen where you can set the colors and other properties for the selection rectangle. So, if you would have the newer version of TChart you might use something like this:
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.Zoom.Pen.Width := 2;
Chart1.Zoom.Pen.Color := clRed;
end;
Related
I am using TeeChart (Build 2020.30.200525) in a Delphi XE3 VCL-Application.
In that application I am setting up a Gantt series and I would like to style an individual row label on the left axis to set it apart from the others.
Something like changing the color or font-style of the label or highlighting it by using a background.
How could I achieve this?
I have found the OnGetAxisLabel event which I ca use to change the text of the labels.
And I have also tried Axes.Left.Items, but that only has a single element even after I have added several Values to the Gantt-Series.
You need to force a chart repaint to populate the axis items. Ie:
uses VclTee.GanttCh;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.AddSeries(TGanttSeries).FillSampleValues;
Chart1.Draw; // Force a repaint to populate Axis Items
Chart1.Axes.Left.Items.Automatic:=False;
Chart1.Axes.Left.Items[2].Format.Font.Color:=clRed;
end;
I used the following code to add margins to RichEdit. How can I change their background color?
procedure TForm1.Button1Click(Sender: TObject);
var
LRect: TRect;
begin
LRect := RichEdit1.ClientRect;
InflateRect(LRect, -25, -25);
RichEdit1.Perform(EM_SETRECT, 0, Integer(#LRect));
end;
EM_SETRECT merely tells the RichEdit the rectangle where it is allowed to render its text. To change the background color of the margin you are reserving space for, you will have to subclass the RichEdit to handle WM_PAINT messages directly, then you can draw whatever you want in that space.
I'm not sure if this will work, but you could send an EM_SETEDITSTYLE message to set SES_EXTENDBACKCOLOR, which I have used in the past - this causes whatever the background colour is to extend into the margins. See this MSDN page for a bit more detail.
SpTBX panels have X close buttons, which have 2 state: usual and mouse-over. I want to draw same bitmaps on my canvas, on TPageControl (owner-drawn).
Left yellow X icon is SpTBX (when Office Silver theme is used). Right X icon is my current one. I want to draw the same as on the left. How to get these bitmaps?
The 'X'-close button is one of the four built-in patterns which you can summon by calling SpDrawGlyphPattern. Starting with '0', the four patterns are 'close', 'maximize', 'minimize' and 'restore', as you can also see in the procedure's source code.
The background is a toolbar button background as you'd guess, since the glyphs are used on internal toolbars attached to dockable panels. That you can draw with SpDrawXPToolbarButton.
The below code will generate the glyph as shown in your picture (if the currently selected skin is 'Office 2007 Silver') on the form's canvas. Note that when the state is not hot, the button background is clear.
In general, if you want to find out how an 'item' gets painted in sptbxlib, put a breakpoint at the start of TSpTBXItemViewer.Paint in 'sptbxitem.pas' and follow the code path.
procedure TForm1.Button1Click(Sender: TObject);
var
R: TRect;
begin
R := Rect(20, 20, 35, 35);
SpDrawXPToolbarButton(Canvas, R, sknsHotTrack, sknSkin, cpNone);
SpDrawGlyphPattern(Canvas, R, 0,
CurrentSkin.GetTextColor(skncToolbarItem, sknsNormal));
end;
I am using a DBMemo (TPPDBMemo) component in reportbuilder within delphi. The Stretch property is true but the control doesn't always stretch itself out correctly within the region.
For example if there is lower case text, that dips downward, eg, chars like p,g,q... The bottom part of the text will get cut off if it's on the last line.
I tried adding an event to the onPrint to slightly grow the DBMemo when it prints,
procedure Tfrm.ppDBMemPrint(Sender: TObject);
begin
ppDBMem.Height := ppDBMem.Height + 10;
end;
But this didn't work.
Any thoughts on how this can be achieved. If I could simply add a border to the DBMemo that would be ideal, although I do not see that property anywhere.
Thank you!
I've narrowed a problem I have drawing on TImage.Canvas in Delphi 2009 down to the following reproducible case:
Given: a form, a TImage, TLabel and TButton on it. The TImage is anchored to all four edges so that resizing the form will resize the TImage. What I want to be able to do is draw on the maximal area of Image1 available to me after resizing. So in my test case I have the following code in my the Button's OnClick handler:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:= IntToStr (Image1.Width)+' x '+IntToStr(Image1.Height);
Image1.Canvas.Pen.Color:= 0;
Image1.Canvas.Rectangle(0,0,Image1.Width, Image1.Height);
end;
You'll see that if the form is resized, Image1.Width and .Height change as expected, however the rectangle that is drawn if the resized form is larger than the original one, will be incomplete, only drawing on the same area that was there previously.
How do I get it do use the entire resized area?
For what it's worth, in my original problem I had played with Image1.Stretch, which allows me to use more of the area upon resizing but will result in my drawings being distorted (not desired). If I also use Image1.Proportional, then it's better but I still can't use the full area available. Image1.AutoSize doesn't seem to be doing anything useful to me either.
Any help appreciated.
Add an OnResize-event to your form:
procedure TForm1.FormResize(Sender: TObject);
begin
Image1.Picture.Bitmap.Width := Image1.Width;
Image1.Picture.Bitmap.Height := Image1.Height;
end;
Also, if you are using the component to draw on, rather than displaying images from file etc, consider using the TPaintBox rather than TImage.
Maybe you have to also adjust Image1.Picture.Width/Height or Image1.Picture.Bitmap.Width/Height.