📄 taolun.pas
字号:
unit TaoLun;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons,wsocket, ExtCtrls, SkinForm, XPMenu, LMDCustomControl,
LMDCustomPanel, LMDCustomBevelPanel, LMDCustomStatusBar, LMDStatusBar,
Volumes, MMObj, MMWheel, XP_Button;
type
TTaoLunf = class(TForm)
Memo1: TMemo;
Label1: TLabel;
Label2: TLabel;
TalkSocket: TWSocket;
Panel1: TPanel;
Memo3: TMemo;
Memo2: TMemo;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
SpeedButton1: TSpeedButton;
Label3: TLabel;
SkinForm1: TSkinForm;
XPMenu1: TXPMenu;
LMDStatusBar1: TLMDStatusBar;
Memo4: TMemo;
MMWheel1: TMMWheel;
VolumeControl1: TVolumeControl;
XP_Button1: TXP_Button;
procedure BitBtn2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure TalkSocketDataAvailable(Sender: TObject; Error: Word);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Memo3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure MMWheel1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
TaoLunf: TTaoLunf;
implementation
uses main;
{$R *.DFM}
procedure TTaoLunf.BitBtn2Click(Sender: TObject);
begin
close;
end;
procedure TTaoLunf.FormShow(Sender: TObject);
begin
memo2.Clear;
memo3.Clear;
memo3.SetFocus;
TalkSocket.Proto := 'udp';
TalkSocket.Addr := '0.0.0.0';
TalkSocket.Port := '555';
TalkSocket.Listen;
end;
procedure TTaoLunf.BitBtn1Click(Sender: TObject);
begin
if memo3.Text =''then
begin
lmdstatusbar1.SimpleText:=' 请填入你要发送的内容!';
end
else
if (memo3.text=memo4.text) then
begin
lmdstatusbar1.SimpleText:=' 不允许发送相同的内容!';
memo3.text:='';
end
else
begin
TalkSocket.Close;
TalkSocket.Proto := 'udp';
TalkSocket.Addr := '255.255.255.255';
TalkSocket.Port := '555';
TalkSocket.LocalPort := '0';
TalkSocket.Connect;
Talksocket.SendStr(s_computername+':>'+ memo3.Lines.Text);
TalkSocket.Close;
TalkSocket.Proto := 'udp';
TalkSocket.Addr := '0.0.0.0';
TalkSocket.Port := '555';
TalkSocket.Listen;
memo2.Lines.Append(s_computername+':>'+ memo3.Lines.Text);
memo3.SetFocus;
memo4.text:=memo3.text;
memo3.text:='';
lmdstatusbar1.SimpleText:=' 已发送';
end;
end;
procedure TTaoLunf.TalkSocketDataAvailable(Sender: TObject; Error: Word);
var
s_taolun:string;
begin
s_taolun:=TalkSocket.ReceiveStr;
if s_taolun='/*csh*/:' + #13 + #10+'关闭讨论' then close;
memo2.Lines.Append(s_taolun);
end;
procedure TTaoLunf.FormClose(Sender: TObject; var Action: TCloseAction);
begin
//关闭语音
form1.SoundOut1.Close;
form1.Soundin1.Close;
//关闭窗口
TalkSocket.Close;
TalkSocket.Proto := 'udp';
TalkSocket.Addr := '255.255.255.255';
TalkSocket.Port := '555';
TalkSocket.LocalPort := '0';
TalkSocket.Connect;
Talksocket.SendStr(s_computername+':>'+'我已退出讨论!!!' );
TalkSocket.Close;
end;
procedure TTaoLunf.Memo3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (key = VK_RETURN) and (ssCtrl in Shift) then //发送文章
BitBtn1Click(sender);
end;
procedure TTaoLunf.MMWheel1Change(Sender: TObject);
begin
volumecontrol1.waveVolume:=round(mmwheel1.value);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -