Visible
How do I use Visible
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: FormThongKe.cs
Copy
51 private void cmbThongKeTheo_SelectedValueChanged(object sender, EventArgs e)
52 {
53 if (cmbThongKeTheo.SelectedIndex == 0)
54 {
55 loadCmbLop();
56 lblMa.Text = "Mã Lớp";
57 cmbMa.Visible = true;
58 lblMa.Visible = true;
59 }
60 if (cmbThongKeTheo.SelectedIndex == 1)
61 {
62 loadCmbKhoiLop();
63 lblMa.Text = "Mã Khối Lớp";
64 cmbMa.Visible = true;
65 lblMa.Visible = true;
66 }
67 }
File name: FormXemDiem.cs
Copy
32 private void btnXem_Click(object sender, EventArgs e)
33 {
34 string sql1 = "select TenSV from SinhVien where MaSV='" + txtMaSV.Text + "'";
35 if (business.ShowData_where(sql1).Rows.Count!=0)
36 {
37 lblTenSV.Text= business.ShowData_where(sql1).Rows[0][0].ToString();
38 lblTenSV.Visible = true;
39 }
40 if (chbXemTatCaHocKy.Checked == true)
41 {
42 string sql = "select HocPhan.MaHP,NhomHocPhan.MaNhomHP,HocPhan.TenHP,KetQua.DiemQT,KetQua.DiemThi,KetQua.DiemXepLoai " +
43 " From KetQua,HocPhan,NhomHocPhan,KeHoachGiangDay " +
44 " Where KetQua.MaSV='" + txtMaSV.Text + "' " +
45 " and KetQua.MaNhomHP=NhomHocPhan.MaNhomHP " +
46 " and NhomHocPhan.MaHP=HocPhan.MaHP " +
47 " and NhomHocPhan.MaKHGD=KeHoachGiangDay.MaKHGD ";
48 dgvKetQua.DataSource = business.ShowData_where(sql);
49 if (dgvKetQua.RowCount > 0)
50 {
51 string test = business.TinhDiemTB(txtMaSV.Text);
52 txtHe10.Text = test.Split(',')[0];
53 txtHe4.Text = test.Split(',')[1];
54 }
55 else
56 {
57 txtHe10.Text = "";
58 txtHe4.Text = "";
59 }
60 }
61 else
62 {
63 string sql = "select HocPhan.MaHP,NhomHocPhan.MaNhomHP,HocPhan.TenHP,KetQua.DiemQT,KetQua.DiemThi,KetQua.DiemXepLoai " +
64 " From KetQua,HocPhan,NhomHocPhan,KeHoachGiangDay " +
65 " Where KetQua.MaSV='" + txtMaSV.Text + "' " +
66 " and KetQua.MaNhomHP=NhomHocPhan.MaNhomHP " +
67 " and NhomHocPhan.MaHP=HocPhan.MaHP " +
68 " and NhomHocPhan.MaKHGD=KeHoachGiangDay.MaKHGD " +
69 " and KeHoachGiangDay.MaHK='" + cmbMaHK.SelectedValue.ToString() + "'";
70 dgvKetQua.DataSource = business.ShowData_where(sql);
71 if (dgvKetQua.RowCount > 0)
72 {
73 string test = business.TinhDiemTB(txtMaSV.Text, cmbMaHK.SelectedValue.ToString());
74 txtHe10.Text = test.Split(',')[0];
75 txtHe4.Text = test.Split(',')[1];
76 }
77 else
78 {
79 txtHe10.Text = "";
80 txtHe4.Text = "";
81 }
82 }
83 }
File name: FormXemDiem.cs
Copy
85 private void btnXuatRaExcel_Click(object sender, EventArgs e)
86 {
87 try
88 {
89
90 Excel.Application objExcelApp = new Excel.Application();
91 Excel.Workbook objExcelWorkbook = objExcelApp.Workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
92 Excel.Worksheet objSheet = (Excel.Worksheet)objExcelWorkbook.Worksheets[1];
93 //objSheet.Cells.Interior.Color.ToString() = 'blue';
94 objSheet = (Excel.Worksheet)objExcelWorkbook.Sheets[1];
95 objSheet.Cells.HorizontalAlignment = Excel.Constants.xlCenter;
96 objSheet.Cells[2, 5] = "BẢNG ĐIỂM CỦA SINH VIÊN";
97 objSheet.Cells[5, 3] = "Mã Học Phần";
98 objSheet.Cells[5, 4] = "Mã Nhóm Học Phần";
99 objSheet.Cells[5, 5] = "Tên Học Phần";
100 objSheet.Cells[5, 6] = "Điểm Thi";
101 objSheet.Cells[5, 7] = "Điểm Quá Trình";
102 objSheet.Cells[5, 8] = "Điểm Xếp Loại";
103 objSheet.Cells[3, 3] = "Mã Học Kỳ : "+cmbMaHK.SelectedValue.ToString()+"";
104 objSheet.Cells[4, 3] = "Mã SV : " + txtMaSV.Text + "";
105 objSheet.Cells[9,10] = "ĐIỂM TỔNG KẾT";
106 objSheet.Cells[10,10] = "Hệ 10 : "+txtHe10.Text+"";
107 objSheet.Cells[11,10] = "Hệ 4 : "+txtHe4.Text+"";
108 for (int i = 0; i < dgvKetQua.Rows.Count ; i++)
109 {
110 for (int j = 0; j < dgvKetQua.Columns.GetColumnCount(DataGridViewElementStates.Displayed); j++)
111 {
112 objSheet.Cells[i + 6, j + 3] = dgvKetQua.Rows[i].Cells[j].Value.ToString();
113 objSheet.Columns.AutoFit();
114 }
115 }
116 objExcelApp.Visible = true;
117 }
118 catch (Exception ex)
119 {
120 MessageBox.Show(ex.Message);
121 }
122 }
File name: FormXemDiemLop.cs
Copy
77 private void btnXuatRaExcel_Click(object sender, EventArgs e)
78 {
79 try
80 {
81
82 Excel.Application objExcelApp = new Excel.Application();
83 Excel.Workbook objExcelWorkbook = objExcelApp.Workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
84 Excel.Worksheet objSheet = (Excel.Worksheet)objExcelWorkbook.Worksheets[1];
85 //objSheet.Cells.Interior.Color.ToString() = 'blue';
86 objSheet = (Excel.Worksheet)objExcelWorkbook.Sheets[1];
87 objSheet.Cells.HorizontalAlignment = Excel.Constants.xlCenter;
88 objSheet.Cells[2, 5] = "BẢNG ĐIỂM CỦA LỚP";
89 objSheet.Cells[3, 3] = "Mã Học Kỳ : "+cmbMaHK.SelectedValue.ToString()+"";
90 objSheet.Cells[4, 3] = "Mã Lớp : " + cmbMaLop.SelectedValue.ToString() + "";
91 objSheet.Cells[5, 4] = "Mã Sinh Viên";
92 objSheet.Cells[5, 5] = "Tên Sinh Viên";
93 objSheet.Cells[5, 6] = "Điểm Trung Bình";
94 //select sv.MaSV,TenSV,TrungBinhCuoiKyHe10
95
96 for (int i = 0; i < dgvKetQua.Rows.Count ; i++)
97 {
98 for (int j = 0; j < dgvKetQua.Columns.GetColumnCount(DataGridViewElementStates.Displayed); j++)
99 {
100 objSheet.Cells[i + 6, j + 4] = dgvKetQua.Rows[i].Cells[j].Value.ToString();
101 objSheet.Columns.AutoFit();
102 }
103 }
104 objExcelApp.Visible = true;
105 }
106 catch (Exception ex)
107 {
108 MessageBox.Show(ex.Message);
109 }
110 }
File name: ChatGui.cs
Copy
103 public void OnGUI()
104 {
105 if (!this.IsVisible)
106 {
107 return;
108 }
109
110 GUI.skin.label.wordWrap = true;
111 //GUI.skin.button.richText = true; // this allows toolbar buttons to have bold/colored text. nice to indicate new msgs
112 //GUILayout.Button("lala"); // as richText, html tags could be in text
113
114
115 if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.KeypadEnter || Event.current.keyCode == KeyCode.Return))
116 {
117 if ("ChatInput".Equals(GUI.GetNameOfFocusedControl()))
118 {
119 // focus on input -> submit it
120 GuiSendsMsg();
121 return; // showing the now modified list would result in an error. to avoid this, we just skip this single frame
122 }
123 else
124 {
125 // assign focus to input
126 GUI.FocusControl("ChatInput");
127 }
128 }
129
130 GUI.SetNextControlName("");
131 GUILayout.BeginArea(this.GuiRect);
132
133 GUILayout.FlexibleSpace();
134
135 if (this.chatClient.State != ChatState.ConnectedToFrontEnd)
136 {
137 GUILayout.Label("Not in chat yet.");
138 }
139 else
140 {
141 List
142 int countOfPublicChannels = channels.Count;
143 channels.AddRange(this.chatClient.PrivateChannels.Keys);
144
145 if (channels.Count > 0)
146 {
147 int previouslySelectedChannelIndex = this.selectedChannelIndex;
148 int channelIndex = channels.IndexOf(this.selectedChannelName);
149 this.selectedChannelIndex = (channelIndex >= 0) ? channelIndex : 0;
150
151 this.selectedChannelIndex = GUILayout.Toolbar(this.selectedChannelIndex, channels.ToArray(), GUILayout.ExpandWidth(false));
152 this.scrollPos = GUILayout.BeginScrollView(this.scrollPos);
153
154 this.doingPrivateChat = (this.selectedChannelIndex >= countOfPublicChannels);
155 this.selectedChannelName = channels[this.selectedChannelIndex];
156
157 if (this.selectedChannelIndex != previouslySelectedChannelIndex)
158 {
159 // changed channel -> scroll down, if private: pre-fill "to" field with target user's name
160 this.scrollPos.y = float.MaxValue;
161 if (this.doingPrivateChat)
162 {
163 string[] pieces = this.selectedChannelName.Split(new char[] {':'}, 3);
164 this.userIdInput = pieces[1];
165 }
166 }
167
168 GUILayout.Label(ChatGui.WelcomeText);
169
170 if (this.chatClient.TryGetChannel(selectedChannelName, this.doingPrivateChat, out this.selectedChannel))
171 {
172 for (int i = 0; i < this.selectedChannel.Messages.Count; i++)
173 {
174 string sender = this.selectedChannel.Senders[i];
175 object message = this.selectedChannel.Messages[i];
176 GUILayout.Label(string.Format("{0}: {1}", sender, message));
177 }
178 }
179
180 GUILayout.EndScrollView();
181 }
182 }
183
184
185 GUILayout.BeginHorizontal();
186 if (doingPrivateChat)
187 {
188 GUILayout.Label("to:", GUILayout.ExpandWidth(false));
189 GUI.SetNextControlName("WhisperTo");
190 this.userIdInput = GUILayout.TextField(this.userIdInput, GUILayout.MinWidth(100), GUILayout.ExpandWidth(false));
191 string focussed = GUI.GetNameOfFocusedControl();
192 if (focussed.Equals("WhisperTo"))
193 {
194 if (this.userIdInput.Equals("username"))
195 {
196 this.userIdInput = "";
197 }
198 }
199 else if (string.IsNullOrEmpty(this.userIdInput))
200 {
201 this.userIdInput = "username";
202 }
203
204 }
205 GUI.SetNextControlName("ChatInput");
206 inputLine = GUILayout.TextField(inputLine);
207 if (GUILayout.Button("Send", GUILayout.ExpandWidth(false)))
208 {
209 GuiSendsMsg();
210 }
211 GUILayout.EndHorizontal();
212 GUILayout.EndArea();
213 }
File name: HubGui.cs
Copy
28 void OnGUI()
29 {
30 GUI.skin = this.Skin;
31 GUILayout.Space(10);
32
33 GUILayout.BeginHorizontal();
34 GUILayout.Space(10);
35 scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.Width(320));
36
37 GUILayout.Label("Basics", m_Headline);
38 if (GUILayout.Button("Demo Boxes", GUILayout.Width(280)))
39 {
40 demoDescription = "
41 demoBtn = new DemoBtn() { Text = "Start", Link = "DemoBoxes-Scene" };
42 }
43 if (GUILayout.Button("Demo Worker", GUILayout.Width(280)))
44 {
45 demoDescription = "
46 demoBtn = new DemoBtn() { Text = "Start", Link = "DemoWorker-Scene" };
47 }
48 if (GUILayout.Button("Movement Smoothing", GUILayout.Width(280)))
49 {
50 demoDescription = "
51 demoBtn = new DemoBtn() { Text = "Start", Link = "DemoSynchronization-Scene" };
52 }
53
54 GUILayout.Label("Advanced", m_Headline);
55 if (GUILayout.Button("Ownership Transfer", GUILayout.Width(280)))
56 {
57 demoDescription = "
58 this.demoBtn = new DemoBtn() { Text = "Start", Link = "DemoChangeOwner-Scene" };
59 this.webLink = new DemoBtn();
60 }
61 if (GUILayout.Button("Pickup, Teams, Scores", GUILayout.Width(280)))
62 {
63 demoDescription = "
64 this.demoBtn = new DemoBtn() { Text = "Start", Link = "DemoPickup-Scene" };
65 this.webLink = new DemoBtn();
66 }
67
68 GUILayout.Label("Feature Demos", m_Headline);
69 if (GUILayout.Button("Chat", GUILayout.Width(280)))
70 {
71 demoDescription = "
72 this.demoBtn = new DemoBtn() { Text = "Start", Link = "DemoChat-Scene" };
73 this.webLink = new DemoBtn();
74 }
75 if (GUILayout.Button("RPG Movement", GUILayout.Width(280)))
76 {
77 demoDescription = "
78 this.demoBtn = new DemoBtn() { Text = "Start", Link = "DemoRPGMovement-Scene" };
79 this.webLink = new DemoBtn();
80 }
81 if (GUILayout.Button("Mecanim Animations", GUILayout.Width(280)))
82 {
83 demoDescription = "
84 this.demoBtn = new DemoBtn() { Text = "Start", Link = "DemoMecanim-Scene" };
85 this.webLink = new DemoBtn();
86 }
87 if (GUILayout.Button("2D Game", GUILayout.Width(280)))
88 {
89 demoDescription = "
90 this.demoBtn = new DemoBtn() { Text = "Start", Link = "Demo2DJumpAndRunWithPhysics-Scene" };
91 this.webLink = new DemoBtn();
92 }
93 if (GUILayout.Button("Friends & Authentication", GUILayout.Width(280)))
94 {
95 demoDescription = "
96 this.demoBtn = new DemoBtn() { Text = "Start", Link = "DemoFriends-Scene" };
97 this.webLink = new DemoBtn();
98 }
99
100 GUILayout.Label("Tutorial", m_Headline);
101 if (GUILayout.Button("Marco Polo Tutorial", GUILayout.Width(280)))
102 {
103 demoDescription = "
104 this.demoBtn = new DemoBtn() { Text = "Start", Link = "MarcoPolo-Scene" };
105 this.webLink = new DemoBtn() { Text = "Open Tutorial (www)", Link = "http://tinyurl.com/nmylf44" };
106 }
107 GUILayout.EndScrollView();
108
109 GUILayout.BeginVertical(GUILayout.Width(Screen.width - 345));
110 GUILayout.Label(demoDescription);
111 GUILayout.Space(10);
112 if (!string.IsNullOrEmpty(this.demoBtn.Text))
113 {
114 if (GUILayout.Button(this.demoBtn.Text))
115 {
116 Application.LoadLevel(this.demoBtn.Link);
117 }
118 }
119 if (!string.IsNullOrEmpty(this.webLink.Text))
120 {
121 if (GUILayout.Button(this.webLink.Text))
122 {
123 Application.OpenURL(this.webLink.Link);
124 }
125 }
126 GUILayout.EndVertical();
127
128
129 GUILayout.EndHorizontal();
130 }
File name: WorkerMenu.cs
Copy
206 public void OnPhotonCreateRoomFailed()
207 {
208 this.ErrorDialog = "Error: Can't create room (room name maybe already used).";
209 Debug.Log("OnPhotonCreateRoomFailed got called. This can happen if the room exists (even if not visible). Try another room name.");
210 }
File name: WorkerMenu.cs
Copy
217 public void OnPhotonRandomJoinFailed()
218 {
219 this.ErrorDialog = "Error: Can't join random room (none found).";
220 Debug.Log("OnPhotonRandomJoinFailed got called. Happens if no room is available (or all full or invisible or closed). JoinrRandom filter-options can limit available rooms.");
221 }
File name: LoadbalancingPeer.cs
Copy
86 public virtual bool OpCreateRoom(string roomName, RoomOptions roomOptions, TypedLobby lobby, Hashtable playerProperties, bool onGameServer)
87 {
88 if (this.DebugOut >= DebugLevel.INFO)
89 {
90 this.Listener.DebugReturn(DebugLevel.INFO, "OpCreateRoom()");
91 }
92
93 Dictionary
94
95 if (!string.IsNullOrEmpty(roomName))
96 {
97 op[ParameterCode.RoomName] = roomName;
98 }
99 if (lobby != null)
100 {
101 op[ParameterCode.LobbyName] = lobby.Name;
102 op[ParameterCode.LobbyType] = (byte)lobby.Type;
103 }
104
105 if (onGameServer)
106 {
107 if (playerProperties != null && playerProperties.Count > 0)
108 {
109 op[ParameterCode.PlayerProperties] = playerProperties;
110 op[ParameterCode.Broadcast] = true; // TODO: check if this also makes sense when creating a room?! // broadcast actor properties
111 }
112
113
114 if (roomOptions == null)
115 {
116 roomOptions = new RoomOptions();
117 }
118
119 Hashtable gameProperties = new Hashtable();
120 op[ParameterCode.GameProperties] = gameProperties;
121 gameProperties.MergeStringKeys(roomOptions.customRoomProperties);
122
123 gameProperties[GameProperties.IsOpen] = roomOptions.isOpen; // TODO: check default value. dont send this then
124 gameProperties[GameProperties.IsVisible] = roomOptions.isVisible; // TODO: check default value. dont send this then
125 gameProperties[GameProperties.PropsListedInLobby] = roomOptions.customRoomPropertiesForLobby;
126 if (roomOptions.maxPlayers > 0)
127 {
128 gameProperties[GameProperties.MaxPlayers] = roomOptions.maxPlayers;
129 }
130 if (roomOptions.cleanupCacheOnLeave)
131 {
132 op[ParameterCode.CleanupCacheOnLeave] = true; // this is actually setting the room's config
133 gameProperties[GameProperties.CleanupCacheOnLeave] = true; // this is only informational for the clients which join
134 }
135 }
136
137 // UnityEngine.Debug.Log("CreateGame: " + SupportClass.DictionaryToString(op));
138 return this.OpCustom(OperationCode.CreateGame, op, true);
139 }
File name: LoadbalancingPeer.cs
Copy
143 public virtual bool OpJoinRoom(string roomName, RoomOptions roomOptions, TypedLobby lobby, bool createIfNotExists, Hashtable playerProperties, bool onGameServer)
144 {
145 Dictionary
146
147 if (!string.IsNullOrEmpty(roomName))
148 {
149 op[ParameterCode.RoomName] = roomName;
150 }
151 if (createIfNotExists)
152 {
153 op[ParameterCode.CreateIfNotExists] = true;
154 if (lobby != null)
155 {
156 op[ParameterCode.LobbyName] = lobby.Name;
157 op[ParameterCode.LobbyType] = (byte)lobby.Type;
158 }
159 }
160
161 if (onGameServer)
162 {
163 if (playerProperties != null && playerProperties.Count > 0)
164 {
165 op[ParameterCode.PlayerProperties] = playerProperties;
166 op[ParameterCode.Broadcast] = true; // broadcast actor properties
167 }
168
169
170 if (createIfNotExists)
171 {
172 if (roomOptions == null)
173 {
174 roomOptions = new RoomOptions();
175 }
176
177 Hashtable gameProperties = new Hashtable();
178 op[ParameterCode.GameProperties] = gameProperties;
179 gameProperties.MergeStringKeys(roomOptions.customRoomProperties);
180
181 gameProperties[GameProperties.IsOpen] = roomOptions.isOpen;
182 gameProperties[GameProperties.IsVisible] = roomOptions.isVisible;
183 gameProperties[GameProperties.PropsListedInLobby] = roomOptions.customRoomPropertiesForLobby;
184 if (roomOptions.maxPlayers > 0)
185 {
186 gameProperties[GameProperties.MaxPlayers] = roomOptions.maxPlayers;
187 }
188 if (roomOptions.cleanupCacheOnLeave)
189 {
190 op[ParameterCode.CleanupCacheOnLeave] = true; // this is actually setting the room's config
191 gameProperties[GameProperties.CleanupCacheOnLeave] = true; // this is only informational for the clients which join
192 }
193 }
194 }
195
196 // UnityEngine.Debug.Log("JoinGame: " + SupportClass.DictionaryToString(op));
197 return this.OpCustom(OperationCode.JoinGame, op, true);
198 }
Download file with original file name:Visible
Visible 156 lượt xem
Gõ tìm kiếm nhanh...