//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "U_Edit.h"
#include "U_Main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
template <class T>
T __fastcall Min(T v1, T v2)
{
if( v1<v2 )
return v1;
return v2;
}
//---------------------------------------------------------------------------
template <class T>
T __fastcall Max(T v1, T v2)
{
if( v1>v2 )
return v1;
return v2;
}
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormCreate(TObject *Sender)
{
SetWindowLong(Edit2->Handle, GWL_STYLE, GetWindowLong(Edit2->Handle, GWL_STYLE) | ES_NUMBER);
SetWindowLong(Edit3->Handle, GWL_STYLE, GetWindowLong(Edit3->Handle, GWL_STYLE) | ES_NUMBER);
SetWindowLong(Edit4->Handle, GWL_STYLE, GetWindowLong(Edit4->Handle, GWL_STYLE) | ES_NUMBER);
OneCharOnly(Edit5);
OneCharOnly(Edit6);
Edit1->OnChange = InputChange;
Edit2->OnChange = InputChange;
Edit3->OnChange = InputChange;
Edit4->OnChange = InputChange;
Edit5->OnChange = InputChange;
Edit6->OnChange = InputChange;
Edit5->Enabled = false;
Edit6->Enabled = false;
RadioButton1->OnClick = OnRadioButtonClick;
RadioButton2->OnClick = OnRadioButtonClick;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::NumberOnly(TEdit *pE)
{
SetWindowLong(pE->Handle, GWL_STYLE, GetWindowLong(pE->Handle, GWL_STYLE) | ES_NUMBER);
}
//---------------------------------------------------------------------------
void __fastcall TForm2::EditOnKeyPress(TObject *Sender, char &Key)
{
if( !((Key>='a' && Key<='z') || (Key>='A' && Key<='Z')) )
Key = 0;
//TEdit *pE = dynamic_cast<TEdit *>(Sender);
//if( !pE->Text.IsEmpty() )
// Key = 0;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::OneCharOnly(TEdit *pE)
{
//SetWindowLong(pE->Handle, GWL_STYLE, GetWindowLong(pE->Handle, GWL_STYLE) | ES_NUMBER);
pE->OnKeyPress = EditOnKeyPress;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
ButtonFlag = BUTTON1;
if( Edit1->Text.Trim().IsEmpty() )
{
Edit1->SetFocus();
return;
}
Form1->Memo1->Clear();
if( RadioButton1->Checked )
{
char buf[32];
String sUrl, tmp;
idx1 = Edit2->Text.ToInt();
idx2 = Edit3->Text.ToInt();
max = Max(idx1, idx2);
min = Min(idx1, idx2);
if( max==min )
{
tmp.sprintf("%d", max);
sUrl = "[img]" + Edit1->Text.Trim() + tmp + ComboBox1->Text.Trim() + "[/img]";
Form1->Memo1->Text = sUrl;
}
else
{
for(int i=min; i<=max; ++i)
{
sprintf(buf, "%%0%dd", Edit4->Text.ToInt());
tmp.sprintf(buf, max);
tmp.sprintf("%d", i);
sUrl = "[img]" + Edit1->Text.Trim() + tmp + ComboBox1->Text.Trim() + "[/img]";
Form1->Memo1->Lines->Add(sUrl + "\n");
}
}
}
else if( RadioButton2->Checked )
{
//
}
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button2Click(TObject *Sender)
{
ButtonFlag = BUTTON2;
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::InputChange(TObject *Sender)
{
if( Edit1->Text.Trim().IsEmpty() )
return;
Memo1->Clear();
if( RadioButton1->Checked )
{
char buf[32];
String sUrl, tmp;
idx1 = Edit2->Text.ToInt();
idx2 = Edit3->Text.ToInt();
max = Max(idx1, idx2);
min = Min(idx1, idx2);
if( max==min )
{
tmp.sprintf("%d", max);
sUrl = "[img]" + Edit1->Text.Trim() + tmp + ComboBox1->Text.Trim() + "[/img]";
Memo1->Text = sUrl;
}
else
{
sprintf(buf, "%%0%dd", Edit4->Text.ToInt());
tmp.sprintf(buf, min);
sUrl = "[img]" + Edit1->Text.Trim() + tmp + ComboBox1->Text.Trim() + "[/img]";
Memo1->Lines->Add(sUrl + "\n");
Memo1->Lines->Add("...\n");
tmp.sprintf(buf, max);
sUrl = "[img]" + Edit1->Text.Trim() + tmp + ComboBox1->Text.Trim() + "[/img]";
Memo1->Lines->Add(sUrl + "\n");
}
}
else if( RadioButton2->Checked )
{
//
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::OnRadioButtonClick(TObject *Sender)
{
Edit2->Enabled = RadioButton1->Checked;
Edit3->Enabled = RadioButton1->Checked;
Edit4->Enabled = RadioButton1->Checked;
Edit5->Enabled = RadioButton2->Checked;
Edit6->Enabled = RadioButton2->Checked;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormCloseQuery(TObject *Sender, bool &CanClose)
{
if( ButtonFlag==BUTTON1 )
if( Memo1->Text.Trim().IsEmpty() )
CanClose = false;
}
//---------------------------------------------------------------------------
网络图片浏览器
需积分: 21 80 浏览量
2008-04-20
10:59:20
上传
评论
收藏 358KB RAR 举报
踏岸寻柳
- 粉丝: 80
- 资源: 10
最新资源
- 基于opencv的dnn模块实现Yolo-Fastest的目标检测python源码+模型+说明(高分项目).zip
- 使用Python调用微信本地ocr服务.zip
- 【精品推荐】人工智能在医疗中的应用.pptx
- 【精品推荐】电子医疗仪器人机接口-(1).ppt
- 【精品推荐】电子医疗仪器人机接口.ppt
- ubuntu镜像ubuntu镜像01
- 基于paddle搭建神经网络实现5种水果识别分类python源码+数据集(高分毕设).zip
- 【精品推荐】电子商务网店类型介绍.ppt
- 基于paddle搭建神经网络实现水果识别分类python源码+数据集(高分项目).zip
- 三菱plc编程口通信学习笔记.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈