以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 大红叉的错误 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=172076) |
-- 作者:newsun2k -- 发布时间:2021/9/22 14:04:00 -- 大红叉的错误 窗口有个图片框,里面放图片。 mouseenter、mouseleave里面有个换图片的动作。 结果间歇性在鼠标进入时显示大红叉。 何解。
|
-- 作者:有点蓝 -- 发布时间:2021/9/22 14:09:00 -- http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=150626 |
-- 作者:newsun2k -- 发布时间:2022/1/20 13:38:00 -- 情况:窗口中设置一个picturebox,其中 mouse_enter事件中的代码是:e.sender.Image = getimage("功能按钮2.png") mouse_leave事件中的代码是:e.sender.Image = getimage("功能按钮1.png") 故障现象: 大部分情况下都很正常,鼠标进入会切换图片 偶尔会发生出现上图的大红叉现象。非常影响使用感受。 何解???
|
-- 作者:有点蓝 -- 发布时间:2022/1/20 13:49:00 -- 我测试没有问题,请上传实例测试 |
-- 作者:newsun2k -- 发布时间:2022/2/7 16:47:00 -- 关于C# winform中使用pictureBox显示大红叉的原因 - 寒夜美美 - 博客园 (cnblogs.com) 后来解决方案:在可以直接读取流文件的时候,直接使用Image.fromfile(fs) fs为图片流,这样可以避免出现这种问题。 我的问题是:怎么读取流文件,给picturebox赋值啊? 求教
|
-- 作者:有点蓝 -- 发布时间:2022/2/7 17:01:00 -- 试试 e.sender.Image = new bitmap(projectpath & "images/功能按钮2.png")
|
-- 作者:newsun2k -- 发布时间:2022/2/7 17:46:00 -- 还是偶然有这个问题。 ![]() ![]() |
-- 作者:newsun2k -- 发布时间:2022/2/7 17:53:00 -- FileStream fs = new FileStream(ofd.FileName, FileMode.Open,FileAccess.Read); byte[] imageByte =new byte[ofd.FileName.Length]; BinaryReader br = new BinaryReader(fs); imageByte = br.ReadBytes(Convert.ToInt32(fs.Length)); MemoryStream ms = new MemoryStream(imageByte); Bitmap bm = new Bitmap(ms); pictureBox1.Image = bm; 貌似这一段代码可以,不过是C#的,foxtable里面咋用,求指导。 |
-- 作者:newsun2k -- 发布时间:2022/2/7 17:55:00 -- 有关调用实时(JIT)调试而不是此对话框的详细信息, 请参见此消息的结尾。 ************** 异常文本 ************** System.ArgumentException: 参数无效。 在 System.Drawing.Image.get_RawFormat() 在 System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y, Int32 width, Int32 height) 在 System.Drawing.Graphics.DrawImage(Image image, Rectangle rect) 在 System.Windows.Forms.PictureBox.OnPaint(PaintEventArgs pe) 在 System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer) 在 System.Windows.Forms.Control.WmPaint(Message& m) 在 System.Windows.Forms.Control.WndProc(Message& m) 在 C1.Win.C1Input.C1PictureBox.WndProc(Message& m) 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ... 启用 JIT 调试后,任何未经处理的异常 都将被发送到在此计算机上注册的 JIT 调试程序, 而不是由此对话框处理。 |
-- 作者:有点蓝 -- 发布时间:2022/2/7 20:04:00 -- 参数无效是指图片不存在,路径有问题。有时候图片本身有问题也会这样。 C#转换:http://converter.telerik.com/
|