一个PB的messagebox显示小问题

qq28385587 2017-04-27 06:06:24

要求点执行按钮后,根据选择的单选按钮显示弹窗.
我写的代码如下,始终报错.求指点.

string ls_pic, ls_cb
int value
// 图标选择
if rb_infomation.checked = true then
ls_pic="Infomation!"
elseif rb_stopsign.checked = true then
ls_pic="StopSign!"
elseif rb_Exclamation.checked = true then
ls_pic="Exclamation!"
elseif rb_Question.checked = true then
ls_pic="Question!"
elseif rb_None.checked = true then
ls_pic=""
//按键选择
elseif rb_OK.checked = true then
ls_cb="OK!"
elseif rb_OKCancel.checked = true then
ls_cb="OKCancel!"
elseif rb_YesNo.checked = true then
ls_cb="YesNo!"
elseif rb_YesNoCancel.checked = true then
ls_cb="YesNoCancel!"
elseif rb_RetryCancel.checked = true then
ls_cb="RetryCancel!"
elseif rb_AbortRetryIgnore.checked = true then
ls_cb="AbortRetryIgnore!"
end if

value=integer(em_value.text)
//Messagebox(sle_title.text,sle_text.text)

Messagebox(sle_title.text,sle_text.text,ls_pic,ls_cb,value)

报错如下;
Error C0052: Bad argument list for function: messagebox
...全文
838 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
eclat2299 2017-04-28
  • 打赏
  • 举报
回复
樓上正解 button 與 icon 是pb的enumerated datatype 不是字串
sbks 2017-04-28
  • 打赏
  • 举报
回复
pb的help简洁明了,可以解决很多问题的,除了只有英文版这个缺点 button a icon b b=question! a=yesno! messagebox('','',b,a)
qq28385587 2017-04-28
  • 打赏
  • 举报
回复
引用 1 楼 sbks 的回复:
pb的help简洁明了,可以解决很多问题的,除了只有英文版这个缺点

button a
icon b

b=question!
a=yesno!

messagebox('','',b,a)



试过了,这个枚举类型的定义写在哪里呢?

Powerbuilder 9.0实用教程》源代码 1.本源代码包括以下章节源代码: 第01章 认识PowerBuilder 9.0、第05章 创建应用程序、第06章 创建窗体、第07章 创建菜单和工具栏、第10章 应用程序的调试和发布、第11章 典型小型实例赏析、第12章 图书管理系统实例和第13章 学生选课系统实例。 2.源代码使用方法参见《附录A 源代码的使用方法》文件。 __________________________________________________________________ 注意: 1.建议读者下载源文件后,将该源文件进行备份,读者使用副本源文件进行学习,这样一但出问题就不用再从网上下载了。 2.将源文件中“数据库文件”文件夹一定要复制到C盘根目录下,这样才能保证您连接数据库文件成功,具体方法参见《附录A 源代码的使用方法》。 对于书中源代码除了数据库外其他都能正常使用,而示例中数据库需要用户在自己的计算机上注册后才能使用,如果不注册数据源就运行应用程序是检索不到任何数据的,下面以连接学生选课系统数据库为例具体介绍如何连接数据库文件。 第1章 认识PowerBuilder 9.0 1 1.1 PowerBuilder 9.0简介 1 1.1.1 中国软件业现状 1 1.1.2 为什么要学习PowerBuilder 9.0 2 1.1.3 PowerBuilder的概述 2 1.1.4 PowerBuilder的特点 3 1.1.5 PowerBuilder 9.0的新特性 6 1.2 安装PowerBuilder 9.0软硬件需求 9 1.2.1 软件环境需求 9 1.2.2 硬件环境需求 9 1.3 PowerBuilder 9.0功能界面介绍 10 1.3.1 PowerBuilder 9.0界面简介 10 1.3.2 常用功能菜单 10 1.4 工作环境设置 16 1.4.1 工具栏的设置 16 1.4.2 窗口排列 19 1.4.3 快捷键设置 20 1.4.4 系统选项设置 21 1.5 用5分钟制作一个简单实例 22 1.5.1 实例运行界面 22 1.5.2 新建一个工作空间对象 22 1.5.3 新建一个应用程序对象 23 1.5.4 创建窗体 23 1.5.5 为应用程序添加open事件代码 25 1.6 小结 27 1.7 习题 27 第2章 编程基础知识 28 2.1 PowerScript脚本语言书写规则 28 2.1.1 忽略大小写 28 2.1.2 语句的断行、续行和分割 28 2.1.3 注释 29 2.2 数据类型 29 2.3 变量和作用域 30 2.3.1 定义变量 30 2.3.2 引用变量 30 2.3.3 变量的作用域 30 2.4 操作符 31 2.5 标识符 32 2.5.1 标识符的构成 32 2.5.2 匈牙利命名法 32 2.6 常用代词 33 2.7 控制语句 34 2.7.1 判断语句 34 2.7.2 循环语句 36 2.8 结构 38 2.8.1 创建结构 38 2.8.2 使用结构 40 2.9 函数 40 2.9.1 Open()和Close()函数 41 2.9.2 MessageBox()函数 41 2.9.3 类型转换函数 41 2.9.4 类型判断函数 42 2.9.5 其他函数 42 2.10 ODBC数据源与专用数据库接口 43 2.10.1 什么是ODBC数据源 43 2.10.2 专用数据库接口 43 2.10.3 连接数据库 44 2.10.4 配置ODBC 48 2.11 SQL语言 49 2.11.1 SQL语言的格式 49 2.11.2 在PowerBuilder 9中使用SQL语句 51 2.12 类和对象的概念 56 2.12.1 继承 57 2.12.2 重载和多态性 57 2.12.3 封装 57 2.12.4 属性、事件和函数 57 2.13 在PowerBuilder 9.0中实现面向对象编程 58 2.13.1 创建对象 58 2.13.2 设置对象属性 59 2.13.3 编写事件代码 59 2.13.4 实现继承对象 60 2.14 用户对象和用户事件 61 2.14.1 用户对象分类 61 2.14.2 定义用户对象 62 2.14.3 使用用户对象 64 2.14.4 用户事件 66 2.15 小结 67 2.16 习题 68 第3章 创建数据库 69 3.1 数
可以轻松给图片加文字水印 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; namespace WindowsApplication7 { public partial class FrmAddWave : Form { public FrmAddWave() { InitializeComponent(); } private void MakeWaterMark(string IconImg) { //定义输出位图 Bitmap bmp = new Bitmap(1000, 700); //定义绘图对象 Graphics g = Graphics.FromImage(bmp); //描述绘图矩形区域 Rectangle newRect = new Rectangle(0, 0, 1000, 700); //设置背景色 g.FillRectangle(new SolidBrush(Color.White), newRect); //获取要生成水印的图片 Bitmap newBitmap = new Bitmap(IconImg); g.DrawImage(newBitmap, 16, 16); //定义水印字的字体 Font font = new Font( "Arial", 12, FontStyle.Bold ); //定义水印字的格式刷 LinearGradientBrush brush = new LinearGradientBrush( new Rectangle(600, 600, 71, 23), Color.Red, Color.Blue, 30f, true ); //给照片打上水印 g.DrawString("copyright by test. " + System.DateTime.Now.ToShortDateString(), font, brush, 0, 0); //保存为新的输出图片 System.IO.MemoryStream ms = new System.IO.MemoryStream(); bmp.Save(@"c:\a1.jpg", ImageFormat.Jpeg); ////输出图片 //Response.ClearContent(); //Response.ContentType = "image/jpeg"; //Response.BinaryWrite(ms.ToArray()); } private void button1_Click(object sender, EventArgs e) { string strsavepath = txtsavepath.Text.ToString(); string strfilepath =textBox1.Text; if (textBox2.Text.Trim() == "") { MessageBox.Show("请输入要显示的文字"); textBox2.Focus(); return; } if (textBox1.Text.Trim() == "") { MessageBox.Show("请选择要处理的图片路径,图片必须是JPG格式"); return; } if (txtsavepath.Text.Trim() == "") { MessageBox.Show("请选择处理后的图片保存路径"); return; } if (textBox1.Text == strsavepath) { MessageBox.Show("处理后的图片保存目录不能和原目录相同"); txtsavepath.Text = ""; return ; } try { string[] font1 = txtfont.Text.Split(','); DirectoryInfo TheFolder = new DirectoryInfo(textBox1.Text); //遍历文件夹 int count = TheFolder.GetFiles().Length; int scount = 1; if (count > 0) { pb1.Maximum = count; pb1.Minimum = 1; pb1.Visible = true; } //遍历文件 foreach (FileInfo NextFile in TheFolder.GetFiles()) { pb1.Value = scount; string[] p1 = NextFile.Name.ToString().Split('.'); if (p1[1].ToString().ToLower() == "jpg" || p1[1] == "jpeg") { Makewatermark(NextFile.FullName, strsavepath + "\\" + NextFile.Name.ToString(), textBox2.Text, font1[0].ToString(), float.Parse(font1[1])); } scount++; } MessageBox.Show("处理完成!"); pb1.Visible = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } } public void Makewatermark(string FilePath, string SavePath, string watermarkText,string fontname,float fontsize) { try { System.Drawing.Image image = System.Drawing.Image.FromFile(FilePath); int x = image.Width; int y = image.Height; Graphics g = Graphics.FromImage(image); g.DrawImage(image, 0, 0, image.Width, image.Height); Font f = new Font(fontname, fontsize ); Brush b = new SolidBrush(Color.Red ); string addText = watermarkText.Trim(); //g.DrawString(addText, f, b, x - 500, y - 50); g.DrawString(addText, f, b, x /4, y /2); g.Dispose(); image.Save(SavePath); image.Dispose(); //if (File.Exists(SavePath)) //{ // File.Delete(SavePath); //} } catch (Exception ex) { throw ex; } } private void butpath_Click(object sender, EventArgs e) { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK ) { textBox1.Text = folderBrowserDialog1.SelectedPath; } } private void butsave_Click(object sender, EventArgs e) { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { txtsavepath.Text = folderBrowserDialog1.SelectedPath; } } private void button2_Click(object sender, EventArgs e) { if (fontDialog1.ShowDialog() == DialogResult.OK) { txtfont.Text = fontDialog1.Font.Name.ToString()+","+ fontDialog1.Font.Size.ToString(); } } private void button3_Click(object sender, EventArgs e) { this.Close(); } } }

1,072

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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