我正在创建一个允许您复制文本的自定义消息框,但我希望它看起来与标准消息框完全相同,所以我想将按钮文本设置为系统语言,就像MessageBox类一样.有谁知道如何获得该文本("是","否","取消"等)?
我需要为Linux(SDL)应用程序实现一个简单的图形消息框,类似于C++中的Windows MessageBox(gcc/g ++ 4.4.0).它需要做的只是显示标题,消息和确定或关闭按钮,并在单击该按钮时返回到调用功能.
SDL只使用X(11)打开(OpenGL)渲染窗口.
我查看了一个关于GTK实现的类似线程,但该实现似乎无法正常工作.
我也尝试了wxWidgets的wxMessageBox函数,但编译头文件会使编译器在include/c ++/4.4.0/bits/stl_algobase.h(openSuSE 11.1 32位上的gcc 4.4.0 32位)中抛出有关语法错误的错误消息.使用wxWidgets还意味着必须链接大量的库,将STL添加到我的应用程序(否则不需要)以及谁知道还有什么,所以我不想使用wxWidgets.
X11/motif(openmotif)有我需要的东西(XmCreate {Error | Warning | InfoDialog),但是这些需要一个我没有的父窗口小部件(例如顶层窗口),并且不接受这些的NULL参数.
所以我现在很难过.有一种简单的方法可以做我想要的吗?或者至少有一半的简单/简单/直接的?如果是,哪一个(尽可能多地提供详细信息将受到高度赞赏).
如何在C#Win Forms应用程序中生成一个消息框,该应用程序显示一个组合框,其中包含一系列要选择的值以及通常的"确定"按钮?
我希望能够在调用MessageBox.Show()方法时触发它.我假设某种覆盖是必要的,但我还没有看到任何预先存在的例子.
我想创建一个模式对话框,其控件比标准.NET MessageBox提供的控件多.我创建了自己的Windows窗体,将使用ShowDialog()调用它来提供模态行为.但是,我想利用MessageBox通过的图形MesageBoxIcon.这可能吗?是否也可以复制播放与消息框图标关联的错误/警告窗口声音(因为它们是在用户的窗口设置中设置的)?
我发现,当顶级小部件调用消息框对话框(例如“ showinfo”)时,将在顶级之上显示根窗口。有没有一种方法可以将“顶级”窗口设置为消息框对话框的主窗口?
这是一个重现此内容的脚本:
# -*- coding:utf-8 -*-
# PYTHON 3 ONLY
from tkinter import *
from tkinter import messagebox
root = Tk()
root.title('ROOT WINDOW')
Label(root, text = 'Place the toplevel window over the root window\nThen, push the button and you will see that the root window is again over the toplevel').grid()
topWindow = Toplevel(root)
topWindow.title('TOPLEVEL WINDOW')
Label(topWindow, text = 'This button will open a messagebox but will\ndo a "focus_force()" thing on the root window').grid()
Button(topWindow, text = '[Push me !]', …Run Code Online (Sandbox Code Playgroud) 如何在MessageBox c ++中显示变量?
string name = "stackoverflow";
MessageBox(hWnd, "name is: <string name here?>", "Msg title", MB_OK | MB_ICONQUESTION);
Run Code Online (Sandbox Code Playgroud)
我想以下面的方式展示它(#1):
"name is: stackoverflow"
Run Code Online (Sandbox Code Playgroud)
还有这个?
int id = '3';
MessageBox(hWnd, "id is: <int id here?>", "Msg title", MB_OK | MB_ICONQUESTION);
Run Code Online (Sandbox Code Playgroud)
我想以下面的方式展示它(#2):
id is: 3
Run Code Online (Sandbox Code Playgroud)
如何用c ++做到这一点?
我正在使用WPF NotifyIcon来创建系统托盘服务.当我显示一个消息框时,它会显示半秒钟然后立即消失而不等待输入.
之前发生过这种情况,通常的建议是使用接受Window参数的重载.但是,作为系统托盘服务,没有窗口可用作父级,并且null不会在其位置接受.
有没有办法让MessageBox等待用户输入自己创建一个自定义MessageBox窗口?
是否可以在消息框中添加超链接?我正在尝试做这样的事情:
MsgBox "Sorry, but you have an out-of-date database version. Please redownload via the batch file to ensure that you have the latest version. Contact the administrator of this database or your manager if you need help." & vbCr _
& vbCr _
& "Your current database version is " & CurrentVer & " which may be out of date. The current database version prescribed on the network share is " & FileVer & ". They must match in order …Run Code Online (Sandbox Code Playgroud) 有一种方法可以使MessageBox居中而不进行子类化或挂钩?
我正在寻找VB.NET代码.
我想在程序中添加一个简单的消息框,但看起来你无法在 python 3 中调整字体大小。这很烦人,但也不算太糟糕 - 我将制作自己的窗口并克服它。我不明白的是为什么字体在 python 2 中可以调整,但在 python 3 中不再可以调整?
python 3 中的消息框示例:
import tkinter
from tkinter import *
from tkinter import messagebox
root = Tk()
def Help(self):
messagebox.showinfo("Window title", "Sample text")
test_button = Button(root, text="Test Button", font=("Helvetica", 25), command=self.Help)
test_button.grid(row = 2, column =0)
root.mainloop()
Run Code Online (Sandbox Code Playgroud)
这是解决 python 2 中字体调整的问题:Control Font in tkMessageBox
这是一个解决python 3 中缺乏字体调整的问题: How to set font of a messagebox with Python tkinter?
谁能解释明显的功能损失?为什么我们会在看似改进的 python 版本中失去这个选项?
编辑:看起来 Python 2 中应用的解决方案将在运行 python 3 的 …
messagebox ×10
c# ×3
winforms ×3
.net ×2
c++ ×2
python-3.x ×2
tkinter ×2
.net-3.5 ×1
access-vba ×1
c ×1
hyperlink ×1
linux ×1
notifyicon ×1
position ×1
python ×1
python-2.7 ×1
tk-toolkit ×1
vb.net ×1
vba ×1
windows ×1
wpf ×1
wxwidgets ×1
x11 ×1