導航:首頁 > 編程語言 > 編程序窗口

編程序窗口

發布時間:2022-02-13 11:16:05

Ⅰ c語言,窗口編程怎麼搞

看下《windows程序設計》

Ⅱ 用什麼軟體編WINDOWS窗口程序

c#上手簡單
記事本 計算器啦等等 之類的這些小程序是winform程序

都比較簡單的

java 編寫一個帶有窗口的應用程序

這樣:

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.awt.Graphics;

public class MainClass extends JFrame {

public JComboBox box;

int flag = 0;

jpNewPanel jpNewPanel;

public static void main(String[] args) {

MainClass frame = new MainClass();

frame.setBounds(650,300,550,550);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setTitle("信號燈");

frame.setVisible(true);

}

public MainClass() {

box = new JComboBox();

box.addItem("請選擇");

box.addItem("紅燈");

box.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

flag = box.getSelectedIndex();

jpNewPanel.repaint();

}

});

box.addItem("黃燈");

box.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

flag = box.getSelectedIndex();

jpNewPanel.repaint();

}

});

box.addItem("綠燈");

box.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

flag = box.getSelectedIndex();

jpNewPanel.repaint();

}

});

add(box, BorderLayout.NORTH);

jpNewPanel = new jpNewPanel();

add(jpNewPanel, BorderLayout.CENTER);

}

class jpNewPanel extends JPanel {

protected void paintComponent(Graphics g) {

super.paintComponent(g);

g.drawOval(150, 0, 120, 120);

if (flag == 1) {

g.setColor(Color.RED);

g.fillOval(150, 0, 120, 120);

} else if (flag == 2) {

g.setColor(Color.YELLOW);

g.fillOval(150, 0, 120, 120);

} else if (flag == 3) {

g.setColor(Color.GREEN);

g.fillOval(150, 0, 120, 120);

}

}

}

}

(3)編程序窗口擴展閱讀:

注意事項

每個Road對象都有一個name成員變數來代表方向,有一個vehicles成員變數來代表方向上的車輛集合。

在Road對象的構造方法中啟動一個線程每隔一個隨機的時間向vehicles集合中增加一輛車(用一個「路線名_id」形式的字元串進行表示)。

在Road對象的構造方法中啟動一個定時器,每隔一秒檢查該方向上的燈是否為綠,是則列印車輛集合和將集合中的第一輛車移除掉。

Ⅳ 編寫窗口界面應用程序

//咱也是初學者,可是用心給你答題的哦,能不能酌情追加點分,30分?
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class test03
{
JFrame jFrame =new JFrame("簡單計算器");
JPanel jContentPane = (JPanel) jFrame.getContentPane();
JTextField jTextField = new JTextField(3);
JTextField jTextField1 = new JTextField(3);
JLabel jLabel = new JLabel("+");
JLabel jLabel1 = new JLabel("結果未顯示");
JButton jButton = new JButton("計算");
JButton jButton1 = new JButton("清除");
public test03() {
jContentPane.setLayout(new FlowLayout());
//計算按鈕
jButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

jLabel1.setText("= "+getresult());
}});
//清除按鈕
jButton1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

jTextField.setText("");
jTextField1.setText("");
jLabel1.setText("結果未顯示");
}});
jContentPane.add(jTextField);
jContentPane.add(jLabel);
jContentPane.add(jTextField1);
jContentPane.add(jLabel1);
jContentPane.add(jButton);
jContentPane.add(jButton1);

jFrame.setSize(100,50);
jFrame.pack();
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.setLocation(100, 50);
jFrame.setVisible(true);
}
float getvalue(JTextField textField) {
float value = Float.valueOf(textField.getText());
return value;
}
String getresult() {
float f= getvalue(jTextField)+getvalue(jTextField1);
String result=String.valueOf(f);
return result;
}
public static void main(String[] args) {
new test03();

}

}

Ⅳ c語言這樣編寫窗口

你用的什麼編譯器?
TC下不可能寫出調動API的程序,也就是說,在TC下不可能編出窗口程序。 TC繼承的是DOS。
VC可以。

能夠獨立運行是因為沒有用動態庫。
象QQ比較高深了,我現在的能力還沒法給你詳細解釋。

Ⅵ c語言怎麼編輯可視窗口程序

C語言是編輯程序

可視窗口程序是就是軟體了,C語言介於匯編語言和高級語言之間是不能直接編輯成軟體的

學通了C語言,其他語言還在話下嗎?

Ⅶ 請問,我想編一個簡單的具有窗口界面的程序,用什麼軟體編好

VB6.0

VB的優越性在於提供了一個十分簡便的GUI程序設計環境。用它。准備錯

Ⅷ 如何用VC++編C窗口程序

你要的win32窗口程序嗎?
#include <windows.h>
#include <stdio.h>
LRESULT CALLBACK WinSunProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
); //窗口過程函數聲明
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
//設計一個窗口類
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hbrBackground=CreateSolidBrush(RGB(12,172,59));//畫刷
wndcls.hCursor=NULL;
wndcls.hIcon=NULL;
wndcls.hInstance=hInstance; //應用程序實例句柄由WinMain函數傳進來
wndcls.lpfnWndProc=WinSunProc; //定義窗口處理函數
wndcls.lpszClassName="windowclass";
wndcls.lpszMenuName=NULL;
wndcls.style=CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wndcls);

//創建窗口,定義一個變數用來保存成功創建窗口後返回的句柄
HWND hwnd;
hwnd=CreateWindow("windowclass","first window",
WS_OVERLAPPEDWINDOW,0,0,600,400,NULL,NULL,hInstance,NULL);
//顯示及刷新窗口
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
//定義消息結構體,開始消息循環
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}

//編寫窗口過程函數
LRESULT CALLBACK WinSunProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
switch(uMsg)
{
case WM_CLOSE:
DestroyWindow(hwnd); //銷毀窗口,並發送WM_DESTROY消息給自身窗口
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}

Ⅸ .C++怎麼去編寫那種有窗口界面的程序

1、首先打開QtCreator應用程序,新建一個qt工程。

Ⅹ 用c++編寫的程序的windows窗口化

當你點windows下的執行按鈕,windows只不過是發送了一個按鈕被按下的的消息,然後消息處理循環case語句調用相應的進程(處理函數),完成你所謂的c++程序(這個概念是不對的,應該是進程。)的功能。
在unix系統(各類基於unix,linux的系統)中,都是以消息槽(slot)的方式,消息對應處理函數(需要在程序開發時程序員定義)。

閱讀全文

與編程序窗口相關的資料

熱點內容
編譯怎麼學 瀏覽:329
數碼管顯示0到9plc編程 瀏覽:665
伺服器是為什麼服務的 瀏覽:765
java定義數據類型 瀏覽:874
安卓pdf手寫 瀏覽:427
什麼是app開發者 瀏覽:284
android鬧鍾重啟 瀏覽:101
程序員失職 瀏覽:518
在雲伺服器怎麼改密碼 瀏覽:586
伺服器pb什麼意思 瀏覽:940
51駕駛員的是什麼app 瀏覽:670
php靜態變數銷毀 瀏覽:886
編程買蘋果電腦 瀏覽:760
flac演算法 瀏覽:497
reactnative與android 瀏覽:663
程序員是干什麼的工作好嗎 瀏覽:258
kbuild編譯ko 瀏覽:469
條件編譯的宏 瀏覽:564
韓語編程語言 瀏覽:646
小程序開發如何租用伺服器 瀏覽:80