一个有趣的问题,图形高手,思想开拓者,请进!!300相送!!upz者有分!!参与有分!!解决高分!!谢谢!

waxi 2003-02-20 07:13:53
1,一个工资系统,给定数据90元或其他的。现有三个人a,b,c分得此数据。
用户的操作可以是象调节音量大小那样,可用鼠标拖拽的。


如图:
* *
---------|----------|------------
* *
当有一方数据增大,就有一方减少.总和不变.

2,考虑可动态给定数据,动态给定人数.
若有其他想法可解决的,同样有分!!!
http://expert.csdn.net/Expert/topic/1444/1444741.xml?temp=.1634027
http://expert.csdn.net/Expert/topic/1444/1444732.xml?temp=1.562136E-02
在这解决的,分数可到这拿,,呵呵..
...全文
47 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
ly_liuyang 2003-02-23
  • 打赏
  • 举报
回复
Up
chenfeng3000 2003-02-23
  • 打赏
  • 举报
回复
up,这里高手如云啊
cgh1970 2003-02-23
  • 打赏
  • 举报
回复
up
waxi 2003-02-23
  • 打赏
  • 举报
回复
代码奉献:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, jpeg;

type
TForm1 = class(TForm)
Button1: TButton;
Image2: TImage;
Button2: TButton;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
procedure Button1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Button1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Button2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
started : Boolean;
ox : Integer;
implementation

{$R *.dfm}

procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button<>mbLeft then exit;
started := True;
ox := X;
end;

procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
t : Integer;
begin
if not started then exit;
t := Button1.Left + X -ox;
if t>Button2.Left-10 then
t:=Button2.Left-10;
edit5.Text:=FloatToStr((Button1.Left-Image2.Left)/100*30);
edit6.Text:= FloatToStr((Button2.Left-Button1.Left-10)/100*30);

if t<Image2.Left then t:=Image2.Left;
Button1.Left := t;
end;


procedure TForm1.Button1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
s : Single;
begin
started := False;
s := (Button1.Left - Image2.Left)/Image2.Width ;

end;


procedure TForm1.Button2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button<>mbLeft then exit;
started := True;
ox := X;
end;

procedure TForm1.Button2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
t : Integer;
begin
if not started then exit;
t := Button2.Left + X -ox;
if t>Image2.Left+Image2.Width-Button2.Width then
t:=Image2.Left+Image2.Width-Button2.Width;
edit6.Text:= FloatToStr((Button2.Left-Button1.Left-10)/100*30);
edit7.Text:= FloatToStr((Image2.Width+Image2.Left-Button2.Left-10)/100*30);
if t<Button1.Left+10 then t:=Button1.Left+10;
Button2.Left := t;
end;

procedure TForm1.Button2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
started := False;
end;

end.
waxi 2003-02-23
  • 打赏
  • 举报
回复
问题已经解决..呵呵...大家快到.
http://expert.csdn.net/Expert/topic/1444/1444741.xml?temp=.5607111
http://expert.csdn.net/Expert/topic/1444/1444732.xml?temp=.7902338
这里还有200分,今晚结贴!!!
taxi 2003-02-22
  • 打赏
  • 举报
回复
UP
beata88 2003-02-22
  • 打赏
  • 举报
回复
学习
wwnwnl 2003-02-22
  • 打赏
  • 举报
回复
up
haojie 2003-02-22
  • 打赏
  • 举报
回复
就是看TTrackBar的原代码
waxi 2003-02-22
  • 打赏
  • 举报
回复
lxpbuaa(桂枝香在故国晚秋) :
vcl源代码????具体的书名.谢谢!!
lxpbuaa 2003-02-21
  • 打赏
  • 举报
回复
从TrackBar继承是可以的,你看:
TTrackBar = class(TWinControl)
它上面的拖动块是通过调用方法InitCommonControl 实现的。具体怎么做,一会儿也弄不清楚。你可以参考vcl源代码。但是有一点:继承是绝对可以实现的。

—————————————————————————————————
宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
—————————————————————————————————
waxi 2003-02-21
  • 打赏
  • 举报
回复
outer2000(天外流星) :
我的意思是象TrackBar那样,不过有多个拖拽点.也可画出来.
1,可以继承改变TrackBar吗?
2,画的话,不过怎么拖动?如何得到鼠标的位置?……
outer2000 2003-02-20
  • 打赏
  • 举报
回复
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
ScrollBar1: TScrollBar;
ScrollBar2: TScrollBar;
ScrollBar3: TScrollBar;
procedure FormCreate(Sender: TObject);
procedure ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
procedure ScrollBar2Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
procedure ScrollBar3Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
scrollbar1.Position:=90 div 3;
scrollbar2.Position:=90 div 3;
scrollbar3.Position:=90 div 3;
end;

procedure TForm1.ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
scrollbar2.Position:=(90-scrollpos) div 2;
scrollbar3.Position:=(90-scrollpos) div 2;
end;

procedure TForm1.ScrollBar2Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
scrollbar1.Position:=(90-scrollpos) div 2;
scrollbar3.Position:=(90-scrollpos) div 2;
end;

procedure TForm1.ScrollBar3Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
scrollbar2.Position:=(90-scrollpos) div 2;
scrollbar1.Position:=(90-scrollpos) div 2;
end;

end.

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧