1. WebView Form Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | using System; using System.Drawing; using System.Windows.Forms; namespace CsLib { class FormWebViewer : Form { CsWebView webView; CsTextBox textBox; CsStatusBar statusBar; public FormWebViewer() { Initialize(); } private void Initialize() { this.Name = "Window"; this.Text = "Window"; this.Size = new Size(800, 400); this.StartPosition = FormStartPosition.CenterScreen; makeStatusBar(); makePanel(); makeToolBar(); makeMenuBar(); this.Controls.Add(new CsButton("Hello", MyButtonClick)); } private void makeMenuBar() { CsMenuBar menu = new CsMenuBar(); menu.addMenu("File"); menu.addMenuItem("Exit", showExitPopup); menu.addMenu("Help"); menu.addMenuItem("About", showAboutPopup); this.Controls.Add(menu.get()); } private void makeToolBar() { CsToolBar tool = new CsToolBar(); tool.addToolItem("Exit", showExitPopup); this.Controls.Add(tool.get()); } private void makeStatusBar() { statusBar = new CsStatusBar(); statusBar.addPanel("Ready"); statusBar.setText(0, "Ready"); this.Controls.Add(statusBar.get()); } private void makePanel() { webView = new CsWebView(true); webView.loadUrl("https://www.google.com"); textBox = new CsTextBox(); textBox.enableMultiLine(); textBox.enableScrollBar(); textBox.addText("Test"); CsSplitContainer split = new CsSplitContainer(); split.addLeftPanel(webView.get()); split.addRightPanel(textBox.get()); this.Controls.Add(split.get()); } private void MyButtonClick(object source, EventArgs e) { MessageBox.Show("My First WinForm Application"); } private void showExitPopup(object source, EventArgs e) { Application.Exit(); } private void showAboutPopup(object source, EventArgs e) { MessageBox.Show("Windows Form Demo V0.1"); } } } |
댓글 없음:
댓글 쓰기