导航:
论坛 -> DELPHI技术
斑竹:liumazi,sephil
作者:
2022/6/27 9:59:59
标题:
各位大神,这种控件怎么实现最方便 ?
浏览:1368
加入我的收藏
楼主:
想自己做个实用控制工具, 控制亮度, 用一个线条图来设置一天中,不同时间的亮度, 每个钟点对应一个圆点, 圆点可以上下滑动来设置这个钟点的亮度值 不是商业项目, 所以没太多时间精力可以分配在上面, 有现成的控件可以用不 ? tchart的话, 还要绘制上面的点,设法控制点的上下滑动, 似乎比自己用画布画还麻烦 也想过动态生成24个tprogress, 但是不太美观, 要的不是那种视觉效果
此帖子包含附件: 大小: 20.1K
----------------------------------------------
-
作者:
2022/6/27 10:49:33
1楼:
看了你这个图,感觉自己实现挺复杂。看了你说画布,想起自己曾经做过在 TPaint 上面画鼠标轨迹图,好像又很简单。
----------------------------------------------
-
作者:
2022/6/27 10:50:48
2楼:
当然我说的是在 PC 上。如果在手机上用 MFX 做,还不清楚该怎么搞。
----------------------------------------------
-
作者:
2022/6/27 10:53:07
3楼:
用 FMX 来做的话,还可以做成 3D 的,效果更酷。不过我不会做。
----------------------------------------------
-
作者:
2022/6/27 11:49:35
4楼:
@pcplayer 是的, 想想似乎画一下也很简单, 但是往仔细里想想,如果想用起来丝滑顺手,需要考虑的细节还不少 如果没现成的控件用, 只好等某个假期自己慢慢再做了
----------------------------------------------
-
作者:
2022/6/27 13:27:48
5楼:
支持楼上大假7天那种,安排时间做一个。
----------------------------------------------
-
作者:
go_on (go_on)
★☆☆☆☆
-
盒子活跃会员
2022/6/27 18:09:47
6楼:
teechart可以控制点移动的,应该集成例程里都有例子
----------------------------------------------
www.eudn.cn工程师联合开发网
作者:
2022/6/28 6:22:10
8楼:
maybe a simple "Drag and Drop" usage will be enough? or not? 1-on Form put a "TLayout" to easy Drag-n-Drop events ... 1.1- DragMode=automatic to easy usage! 1.2- or use "OnMouseDown, OnMouseUp, OnMouseOver" to move the objects on screen... 2-create your objects, likes "TCircles" 3-if needs usar a "Lines" between circles, try draw it in "OnPaint" event ... MyCircle1 ------- MyCircle2 ---------- MyCircle3...
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
2022/6/28 8:12:11
9楼:
some like this... implementation {$R *.fmx} uses FMX.Platform; var MyCurrentCircleClicked: TCircle = nil; MyStrokeBrush : TStrokeBrush; MyPointF : TPointF; MyMoving : boolean = false; // // MyCurrentCircleClicked.LocalRect.CenterPoint // MyCurrentCircleClicked.AbsoluteRect.CenterPoint procedure TForm1.FormCreate(Sender: TObject); begin MyStrokeBrush := TStrokeBrush.Create(TBrushKind.Solid, TAlphaColorRec.Red); MyStrokeBrush.Thickness := 2; end; procedure TForm1.MyCircleMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); begin MyCurrentCircleClicked := TCircle(Sender); MyMoving := true; end; procedure TForm1.MyCircleMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); // = ...FormMouseUp(...) begin MyMoving := false; MyCurrentCircleClicked := nil; end; procedure TForm1.MyFormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single); begin if MyMoving and not(MyCurrentCircleClicked = nil) then begin // re-positioning the circle on mouse-pointer... MyCurrentCircleClicked.Position.X := X - (MyCurrentCircleClicked.Width / 2); MyCurrentCircleClicked.Position.Y := Y - (MyCurrentCircleClicked.Height / 2); MyPointF := TPointF.Create(X, Y); // (* Caption := Format('Mouse: X=%f, Y=%f - Circle: X=%f, Y=%f', [X, Y, { } MyCurrentCircleClicked.LocalToAbsolute(MyCurrentCircleClicked.Position.Point).X, { } MyCurrentCircleClicked.LocalToAbsolute(MyCurrentCircleClicked.Position.Point).Y { } ]); *) // invalidate; end; end; procedure TForm1.MyFormPaint(Sender: TObject; Canvas: TCanvas; const ARect: TRectF); var MyPointF01: TPointF; MyPointF02: TPointF; MyPointF03: TPointF; begin if MyMoving and not(MyCurrentCircleClicked = nil) then begin // found the center to draw the line... MyPointF01 := TPointF.Create(Circle1.Position.X + (Circle1.Width / 2), Circle1.Position.Y + (Circle1.Height / 2)); MyPointF02 := TPointF.Create(Circle2.Position.X + (Circle2.Width / 2), Circle2.Position.Y + (Circle2.Height / 2)); MyPointF03 := TPointF.Create(Circle3.Position.X + (Circle2.Width / 2), Circle3.Position.Y + (Circle3.Height / 2)); // Canvas.DrawLine(MyPointF01, MyPointF02, 1, MyStrokeBrush); Canvas.DrawLine(MyPointF02, MyPointF03, 1, MyStrokeBrush); end; end; end.
此帖子包含附件: 大小: 29.4K
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
2022/6/28 11:29:27
10楼:
灵活的方法是自绘。 简单死板的做法是放一堆控件做圆点,再用线连起来
----------------------------------------------
武稀松http://www.raysoftware.cn
作者:
2022/6/28 13:22:50
11楼:
感谢楼上几位大师的建议 初步计划选用自绘的方案, 就等放假了, 到时自己实现一下
----------------------------------------------
-
作者:
2022/6/29 8:57:08
12楼:
updates... NOTE: you can use a "Panel" or other with "CANVAS" object to paint your points...!
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3