Active控件按钮的提示框SetTooltipText正常大小好使,但是Active控件全屏后SetTooltipText失效

kingkingking 2015-05-09 03:35:37
Active控件按钮的提示框SetTooltipText正常大小好使,但是Active控件全屏后SetTooltipText失效
为什么啊,大神们??????
...全文
87 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
#ifndef _BTNST_H #define _BTNST_H // Uncomment the following line to enable support for sound effects #define BTNST_USE_SOUND #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 // Return values #ifndef BTNST_OK #define BTNST_OK 0 #endif #ifndef BTNST_INVALIDRESOURCE #define BTNST_INVALIDRESOURCE 1 #endif #ifndef BTNST_FAILEDMASK #define BTNST_FAILEDMASK 2 #endif #ifndef BTNST_INVALIDINDEX #define BTNST_INVALIDINDEX 3 #endif #ifndef BTNST_INVALIDALIGN #define BTNST_INVALIDALIGN 4 #endif #ifndef BTNST_BADPARAM #define BTNST_BADPARAM 5 #endif #ifndef BTNST_INVALIDPRESSEDSTYLE #define BTNST_INVALIDPRESSEDSTYLE 6 #endif // Dummy identifier for grayscale icon #ifndef BTNST_AUTO_GRAY #define BTNST_AUTO_GRAY (HICON)(0xffffffff - 1L) #endif class CXPButton : public CButton { public: CXPButton(); ~CXPButton(); enum { ST_ALIGN_HORIZ = 0, // Icon/bitmap on the left, text on the right ST_ALIGN_VERT, // Icon/bitmap on the top, text on the bottom ST_ALIGN_HORIZ_RIGHT, // Icon/bitmap on the right, text on the left ST_ALIGN_OVERLAP // Icon/bitmap on the same space as text }; enum { BTNST_COLOR_BK_IN = 0, // Background color when mouse is INside BTNST_COLOR_FG_IN, // Text color when mouse is INside BTNST_COLOR_BK_OUT, // Background color when mouse is OUTside BTNST_COLOR_FG_OUT, // Text color when mouse is OUTside BTNST_COLOR_BK_FOCUS, // Background color when the button is focused BTNST_COLOR_FG_FOCUS, // Text color when the button is focused BTNST_MAX_COLORS }; enum { BTNST_PRESSED_LEFTRIGHT = 0, // Pressed style from left to right (as usual) BTNST_PRESSED_TOPBOTTOM // Pressed style from top to bottom }; // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CXPButton) public: virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); virtual BOOL PreTranslateMessage(MSG* pMsg); protected: virtual void PreSubclassWindow(); //}
public class ChatClient extends JFrame implements ActionListener{ String ip = "127.0.0.1";//连接到服务端的ip地址 int port = 8888;//连接到服务端的端口号 String userName = "匆匆过客";//用户名 int type = 0;//0表示未连接,1表示已连接 Image icon;//程序图标 JComboBox combobox;//选择发送消息的接受者 JTextArea messageShow;//客户端的信息显示 JScrollPane messageScrollPane;//信息显示的滚动条 JLabel express,sendToLabel,messageLabel ; JTextField clientMessage;//客户端消息的发送 JCheckBox checkbox;//悄悄话 JComboBox actionlist;//表情选择 JButton clientMessageButton;//发送消息 JTextField showStatus;//显示用户连接状态 Socket socket; ObjectOutputStream output;//网络套接字输出流 ObjectInputStream input;//网络套接字输入流 ClientReceive recvThread; //建立菜单栏 JMenuBar jMenuBar = new JMenuBar(); //建立菜单组 JMenu operateMenu = new JMenu ("操作(O)"); //建立菜单项 JMenuItem loginItem = new JMenuItem ("用户登录(I)"); JMenuItem logoffItem = new JMenuItem ("用户注销(L)"); JMenuItem exitItem=new JMenuItem ("退出(X)"); JMenu conMenu=new JMenu ("设置(C)"); JMenuItem userItem=new JMenuItem ("用户设置(U)"); JMenuItem connectItem=new JMenuItem ("连接设置(C)"); JMenu helpMenu=new JMenu ("帮助(H)"); JMenuItem helpItem=new JMenuItem ("帮助(H)"); //建立工具栏 JToolBar toolBar = new JToolBar(); //建立工具栏中的按钮组件 JButton loginButton;//用户登录 JButton logoffButton;//用户注销 JButton userButton;//用户信息的设置 JButton connectButton;//连接设置 JButton exitButton;//退出按钮 //框架的大小 Dimension faceSize = new Dimension(400, 600); JPanel downPanel ; GridBagLayout girdBag; GridBagConstraints girdBagCon; public ChatClient(){ init();//初始化程序 //添加框架的关闭事件处理 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.pack(); //设置框架的大小 this.setSize(faceSize); //设置运行时窗口的位置 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation( (int) (screenSize.width - faceSize.getWidth()) / 2, (int) (screenSize.height - faceSize.getHeight()) / 2); this.setResizable(false); this.setTitle("聊天室客户端"); //设置标题 //程序图标 icon = getImage("icon.gif"); this.setIconImage(icon); //设置程序图标 show(); //为操作菜单栏设置热键'V' operateMenu.setMnemonic('O'); //为用户登录设置快捷键为ctrl+i loginItem.setMnemonic ('I'); loginItem.setAccelerator (KeyStroke.getKeyStroke (KeyEvent.VK_I,InputEvent.CTRL_MASK)); //为用户注销快捷键为ctrl+l logoffItem.setMnemonic ('L'); logoffItem.setAccelerator (KeyStroke.getKeyStroke (KeyEvent.VK_L,InputEvent.CTRL_MASK)); //为退出快捷键为ctrl+x exitItem.setMnemonic ('X'); exitItem.setAccelerator (KeyStroke.getKeyStroke (KeyEvent.VK_X,InputEvent.CTRL_MASK)); //为设置菜单栏设置热键'C' conMenu.setMnemonic('C'); //为用户设置设置快捷键为ctrl+u userItem.setMnemonic ('U'); userItem.setAccelerator (KeyStroke.getKeyStroke (KeyEvent.VK_U,InputEvent.CTRL_MASK)); //为连接设置设置快捷键为ctrl+c connectItem.setMnemonic ('C'); connectItem.setAccelerator (KeyStroke.getKeyStroke (KeyEvent.VK_C,InputEvent.CTRL_MASK)); //为帮助菜单栏设置热键'H' helpMenu.setMnemonic('H'); //为帮助设置快捷键为ctrl+p helpItem.setMnemonic ('H'); helpItem.setAccelerator (KeyStroke.getKeyStroke (KeyEvent.VK_H,InputEvent.CTRL_MASK)); } /** * 程序初始化函数 */ public void init(){ Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //添加菜单栏 operateMenu.add (loginItem); operateMenu.add (logoffItem); operateMenu.add (exitItem); jMenuBar.add (operateMenu); conMenu.add (userItem); conMenu.add (connectItem); jMenuBar.add (conMenu); helpMenu.add (helpItem); jMenuBar.add (helpMenu); setJMenuBar (jMenuBar); //初始化按钮 loginButton = new JButton("登录"); logoffButton = new JButton("注销"); userButton = new JButton("用户设置" ); connectButton = new JButton("连接设置" ); exitButton = new JButton("退出" ); //当鼠标放上显示信息 loginButton.setToolTipText("连接到指定的服务器"); logoffButton.setToolTipText("与服务器断开连接"); userButton.setToolTipText("设置用户信息"); connectButton.setToolTipText("设置所要连接到的服务器信息"); //将按钮添加到工具栏 toolBar.add(userButton); toolBar.add(connectButton); toolBar.addSeparator();//添加分隔栏 toolBar.add(loginButton); toolBar.add(logoffButton); toolBar.addSeparator();//添加分隔栏 toolBar.add(exitButton); contentPane.add(toolBar,BorderLayout.NORTH); checkbox = new JCheckBox("悄悄话"); checkbox.setSelected(false); actionlist = new JComboBox(); actionlist.addItem("微笑地"); actionlist.addItem("高兴地"); actionlist.addItem("轻轻地"); actionlist.addItem("生气地"); actionlist.addItem("小心地"); actionlist.addItem("静静地"); actionlist.setSelectedIndex(0); //初始时 loginButton.setEnabled(true); logoffButton.setEnabled(false); //为菜单栏添加事件监听 loginItem.addActionListener(this); logoffItem.addActionListener(this); exitItem.addActionListener(this); userItem.addActionListener(this); connectItem.addActionListener(this); helpItem.addActionListener(this); //添加按钮的事件侦听 loginButton.addActionListener(this); logoffButton.addActionListener(this); userButton.addActionListener(this); connectButton.addActionListener(this); exitButton.addActionListener(this); combobox = new JComboBox(); combobox.insertItemAt("所有人",0); combobox.setSelectedIndex(0); messageShow = new JTextArea(); messageShow.setEditable(false); //添加滚动条 messageScrollPane = new JScrollPane(messageShow, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); messageScrollPane.setPreferredSize(new Dimension(400,400)); messageScrollPane.revalidate(); clientMessage = new JTextField(23); clientMessage.setEnabled(false); clientMessageButton = new JButton(); clientMessageButton.setText("发送"); //添加系统消息的事件侦听 clientMessage.addActionListener(this); clientMessageButton.addActionListener(this); sendToLabel = new JLabel("发送至:"); express = new JLabel(" 表情: "); messageLabel = new JLabel("发送消息:"); downPanel = new JPanel(); girdBag = new GridBagLayout(); downPanel.setLayout(girdBag); girdBagCon = new GridBagConstraints(); girdBagCon.gridx = 0; girdBagCon.gridy = 0; girdBagCon.gridwidth = 5; girdBagCon.gridheight = 2; girdBagCon.ipadx = 5; girdBagCon.ipady = 5; JLabel none = new JLabel(" "); girdBag.setConstraints(none,girdBagCon); downPanel.add(none); girdBagCon = new GridBagConstraints(); girdBagCon.gridx = 0; girdBagCon.gridy = 2; girdBagCon.insets = new Insets(1,0,0,0); //girdBagCon.ipadx = 5; //girdBagCon.ipady = 5; girdBag.setConstraints(sendToLabel,girdBagCon); downPanel.add(sendToLabel); girdBagCon = new GridBagConstraints(); girdBagCon.gridx =1; girdBagCon.gridy = 2; girdBagCon.anchor = GridBagConstraints.LINE_START; girdBag.setConstraints(combobox,girdBagCon); downPanel.add(combobox); girdBagCon = new GridBagConstraints(); girdBagCon.gridx =2; girdBagCon.gridy = 2; girdBagCon.anchor = GridBagConstraints.LINE_END; girdBag.setConstraints(express,girdBagCon); downPanel.add(express); girdBagCon = new GridBagConstraints(); girdBagCon.gridx = 3; girdBagCon.gridy = 2; girdBagCon.anchor = GridBagConstraints.LINE_START; //girdBagCon.insets = new Insets(1,0,0,0); //girdBagCon.ipadx = 5; //girdBagCon.ipady = 5; girdBag.setConstraints(actionlist,girdBagCon); downPanel.add(actionlist); girdBagCon = new GridBagConstraints(); girdBagCon.gridx = 4; girdBagCon.gridy = 2; girdBagCon.insets = new Insets(1,0,0,0); //girdBagCon.ipadx = 5; //girdBagCon.ipady = 5; girdBag.setConstraints(checkbox,girdBagCon); downPanel.add(checkbox); girdBagCon = new GridBagConstraints(); girdBagCon.gridx = 0; girdBagCon.gridy = 3; girdBag.setConstraints(messageLabel,girdBagCon); downPanel.add(messageLabel); girdBagCon = new GridBagConstraints(); girdBagCon.gridx = 1; girdBagCon.gridy = 3; girdBagCon.gridwidth = 3; girdBagCon.gridheight = 1; girdBag.setConstraints(clientMessage,girdBagCon); downPanel.add(clientMessage); girdBagCon = new GridBagConstraints(); girdBagCon.gridx = 4; girdBagCon.gridy = 3; girdBag.setConstraints(clientMessageButton,girdBagCon); downPanel.add(clientMessageButton);

64,637

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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