Hello I am moving from 20 years with VB6 to Delphi.
Trying to simply fill rect of an image control. It draws on the form not in the imageControl. Using FireMonkey.
procedure TForm1.ImageControl1MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Single);
beginMyRect := TRectF.Create(ImageControl1.Position.x , ImageControl1.Position.y , x, ImageControl1.Height);ImageControl1.Canvas.BeginScene();ImageControl1.Canvas.Fill.Color := claBlue;imagecontrol1.Canvas.Clear(claWhite);ImageControl1.Canvas.FillRect(MyRect,0, 0, , 1.0);ImageControl1.Canvas.EndScene;end;
Welcome to the wonderful world of Delphi. I am speaking as a C++ man here! But Embarcadero C++ Builder and Delphi are so closely related that there is a lot of cross over help around!
The Canvas that is available through ImageControl1 is the canvas on which the control draws itself. Although this seems a little counter intuitive at first it does mean your code has complete control over the rendering of the actual control.
If (as in your simple example) you just want to fill rectangles on the form client area you might just as well use the form's Canvas (no doubt you already realise this).
If you want to draw in the ImageControl using co-ordinates relative to the ImageControl you can use the function
Minor hitch is that this requires a TPointF parameter (ie an X,Y co-ordinate pair). But not to worry, because you can also create your TRectF from a pair of TPointF parameters, rather than the four separate integers.
Hope this helps.
You will find the Embarcadero product SO SO SO much better than Visual Basic once you get through the "new system" pain barrier.
I guess the the fillrect may not be exactly what I am looking for.
in VB6 to achieve a modern look in my GUI I use paintPicture for instance on an pictureBOx to represent a modern slider:
I use a graidient picture and paint in on the pictureBox dependent on the slider value.
What is the best control and method to do this in delphi