-
Notifications
You must be signed in to change notification settings - Fork 0
/
reference_win.cpp
82 lines (64 loc) · 1.98 KB
/
reference_win.cpp
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
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
#include "resource.h"
#include "reference_win.h"
using namespace System;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using namespace System::Drawing;
ReferenceWin::ReferenceWin() {
InitializeComponent();
}
ReferenceWin::~ReferenceWin() {
if (components) {
delete components;
}
}
void ReferenceWin::InitializeComponent() {
this->SuspendLayout();
Size = ::Size(600, 700);
Text = "BatchEdit v1.0.0 Reference";
this->Load += gcnew System::EventHandler(this, &ReferenceWin::onReferenceWinLoad);
reference_browser = gcnew WebBrowser();
reference_browser->Size = ::Size(600, 630);
reference_browser->Location = ::Point(0, 0);
reference_browser->BackColor = SystemColors::ControlDark;
forward = gcnew Button();
forward->Size = ::Size(60, 50);
forward->Location = ::Point(520, 620);
forward->BackColor = ::Color::Red;
forward->Text = "-->";
forward->Click += gcnew System::EventHandler(this, &ReferenceWin::onForwardBtnClick);
back = gcnew Button();
back->Size = ::Size(60, 50);
back->Location = ::Point(0, 620);
back->BackColor = ::Color::Red;
back->Text = "<--";
back->Click += gcnew System::EventHandler(this, &ReferenceWin::onBackBtnClick);
array<Control^>^ ctrls = (gcnew array<Control^>(3) {
reference_browser,
forward,
back
});
Controls->AddRange(ctrls);
this->ResumeLayout(false);
this->PerformLayout();
}
void ReferenceWin::onReferenceWinLoad(System::Object^ sender, System::EventArgs^ e)
{
reference_browser->Navigate("https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands");
reference_browser->Show();
}
void ReferenceWin::onForwardBtnClick(System::Object^ sender, System::EventArgs^ e)
{
if (!reference_browser->GoForward()) {
// do something ...
}
}
void ReferenceWin::onBackBtnClick(System::Object^ sender, System::EventArgs^ e)
{
if (!reference_browser->GoBack()) {
// do something ...
}
}