DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: fiscan1
今日帖子: 1
在线用户: 2
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 bcc2cc (bcc2cc) ▲▲▲▲△ -
普通会员
2022/6/27 9:59:59
标题:
各位大神,这种控件怎么实现最方便 ? 浏览:1609
加入我的收藏
楼主: 想自己做个实用控制工具, 控制亮度, 用一个线条图来设置一天中,不同时间的亮度, 每个钟点对应一个圆点, 圆点可以上下滑动来设置这个钟点的亮度值

不是商业项目, 所以没太多时间精力可以分配在上面, 
有现成的控件可以用不 ?   

tchart的话, 还要绘制上面的点,设法控制点的上下滑动, 似乎比自己用画布画还麻烦
也想过动态生成24个tprogress, 但是不太美观, 要的不是那种视觉效果
此帖子包含附件:
JPEG 图像
大小:20.1K
----------------------------------------------
-
作者:
男 pcplayer (pcplayer) ★☆☆☆☆ -
普通会员
2022/6/27 10:49:33
1楼: 看了你这个图,感觉自己实现挺复杂。看了你说画布,想起自己曾经做过在 TPaint 上面画鼠标轨迹图,好像又很简单。
----------------------------------------------
-
作者:
男 pcplayer (pcplayer) ★☆☆☆☆ -
普通会员
2022/6/27 10:50:48
2楼: 当然我说的是在 PC 上。如果在手机上用 MFX 做,还不清楚该怎么搞。
----------------------------------------------
-
作者:
男 pcplayer (pcplayer) ★☆☆☆☆ -
普通会员
2022/6/27 10:53:07
3楼: 用 FMX 来做的话,还可以做成 3D 的,效果更酷。不过我不会做。
----------------------------------------------
-
作者:
男 bcc2cc (bcc2cc) ▲▲▲▲△ -
普通会员
2022/6/27 11:49:35
4楼: @pcplayer
是的, 想想似乎画一下也很简单, 但是往仔细里想想,如果想用起来丝滑顺手,需要考虑的细节还不少
如果没现成的控件用, 只好等某个假期自己慢慢再做了
----------------------------------------------
-
作者:
男 pcplayer (pcplayer) ★☆☆☆☆ -
普通会员
2022/6/27 13:27:48
5楼: 支持楼上大假7天那种,安排时间做一个。
----------------------------------------------
-
作者:
男 go_on (go_on) ★☆☆☆☆ -
盒子活跃会员
2022/6/27 18:09:47
6楼: teechart可以控制点移动的,应该集成例程里都有例子
----------------------------------------------
-
作者:
男 hujiacheng ( 旺财) ★☆☆☆☆ -
普通会员
2022/6/27 18:29:27
7楼: 这个好像发过。。太久了。
记不住了
(部分功能)
----------------------------------------------
免费的FTPhttps://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019>http://delphi-z.ruhttps://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019>http://delphi.icm.edu.pl/ftp/https://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019>http://delphi-z.ruhttps://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
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
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
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.
此帖子包含附件:
PNG 图像
大小:29.4K
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 wr960204 (武稀松) ★☆☆☆☆ -
盒子活跃会员
2022/6/28 11:29:27
10楼: 灵活的方法是自绘。
简单死板的做法是放一堆控件做圆点,再用线连起来
----------------------------------------------
武稀松http://www.raysoftware.cn
作者:
男 bcc2cc (bcc2cc) ▲▲▲▲△ -
普通会员
2022/6/28 13:22:50
11楼: 感谢楼上几位大师的建议

初步计划选用自绘的方案, 
就等放假了, 到时自己实现一下
----------------------------------------------
-
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
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
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行97.65625毫秒 RSS