public Form1() { InitializeComponent(); label1 = new System.Windows.Forms.Label(); this.SuspendLayout(); this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 23F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1401, 462); this.Controls.Add(this.label1); this.Font = new System.Drawing.Font("Times New Roman", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); this.PerformLayout(); int borderThickness = 5; Color borderColor = Color.Cyan; CustomPanel panel1 = new CustomPanel(borderThickness, borderColor); panel1.BackColor = Color.Yellow; panel1.Location = new Point(400, 30); panel1.Size = new Size(300, 300); panel1.Parent = this; this.Controls.Add(panel1); label1.Name = "label1"; label1.TabIndex = 0; label1.AutoSize = true; label1.ForeColor = Color.Black; label1.Text = "this is the text whose center I want to align"; label1.Location = new Point(panel1.Location.X + panel1.Width / 2 - label1.Width / 2, 80); if (this.Controls.Contains(label1)) { label1.BringToFront(); } }
public virtual void actionPerformed(System.Object event_sender, System.EventArgs event_Renamed) { if (event_sender.Equals(openMenu)) { chooser.ShowDialog(this); if (new System.IO.FileInfo(chooser.FileName) == null) { return; } try { sourceImage = ImageIO.read(new System.IO.FileInfo(chooser.FileName)); } catch (System.Exception e) { SupportClass.WriteStackTrace(e, Console.Error); } } else if (SupportClass.CommandManager.GetCommand(event_sender).Equals("Open from URL")) { try { //UPGRADE_TODO: Class 'java.net.URL' was converted to a 'System.Uri' which does not throw an exception if a URL specifies an unknown protocol. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1132'" sourceImage = ImageIO.read(new System.Uri(url.Text)); } catch (System.Exception e) { SupportClass.WriteStackTrace(e, Console.Error); } } else { return; } if (sourceImageLabel != null) { //UPGRADE_TODO: Method 'javax.swing.JFrame.getContentPane' was converted to 'System.Windows.Forms.Form' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJFramegetContentPane'" ((System.Windows.Forms.ContainerControl) this).Controls.Remove(sourceImageLabel); } System.Windows.Forms.Label temp_label; temp_label = new System.Windows.Forms.Label(); temp_label.Image = (System.Drawing.Image)sourceImage.Clone(); sourceImageLabel = temp_label; //UPGRADE_TODO: Method 'javax.swing.JFrame.getContentPane' was converted to 'System.Windows.Forms.Form' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJFramegetContentPane'" //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent_javalangObject'" ((System.Windows.Forms.ContainerControl) this).Controls.Add(sourceImageLabel); sourceImageLabel.Dock = System.Windows.Forms.DockStyle.Left; sourceImageLabel.BringToFront(); QRCodeDecoder decoder = new QRCodeDecoder(); if (canvas != null) { //UPGRADE_TODO: Method 'javax.swing.JFrame.getContentPane' was converted to 'System.Windows.Forms.Form' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJFramegetContentPane'" ((System.Windows.Forms.ContainerControl) this).Controls.Remove(canvas); //canvas.setImage(null); } canvas = new J2SEDebugCanvas(); QRCodeDecoder.setCanvas(canvas); //UPGRADE_TODO: Method 'javax.swing.JFrame.getContentPane' was converted to 'System.Windows.Forms.Form' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJFramegetContentPane'" //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent_javalangObject'" ((System.Windows.Forms.ContainerControl) this).Controls.Add(canvas); canvas.Dock = System.Windows.Forms.DockStyle.Right; canvas.BringToFront(); System.String decodedString = null; try { decodedString = new String(decoder.decode(new J2SEImage(this, sourceImage))); } catch (DecodingFailedException e) { canvas.println(e.getMessage()); canvas.println("--------"); return; } decodedString = ContentConverter.convert(decodedString); canvas.println("\nDecode result:"); canvas.println(decodedString); canvas.println("--------"); if (decodedText != null) { //UPGRADE_TODO: Method 'javax.swing.JFrame.getContentPane' was converted to 'System.Windows.Forms.Form' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJFramegetContentPane'" ((System.Windows.Forms.ContainerControl) this).Controls.Remove(decodedText); } System.Windows.Forms.TextBox temp_TextBox; temp_TextBox = new System.Windows.Forms.TextBox(); temp_TextBox.Multiline = true; temp_TextBox.WordWrap = false; temp_TextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; temp_TextBox.Text = decodedString; decodedText = temp_TextBox; decodedText.WordWrap = true; //UPGRADE_ISSUE: Method 'javax.swing.JTextArea.setRows' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingJTextAreasetRows_int'" decodedText.setRows(decodedString.Length / 20 + 1); if (decodedString.Length < 20) { //UPGRADE_ISSUE: Method 'javax.swing.JTextArea.setColumns' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingJTextAreasetColumns_int'" decodedText.setColumns(decodedString.Length); } else { //UPGRADE_ISSUE: Method 'javax.swing.JTextArea.setColumns' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingJTextAreasetColumns_int'" decodedText.setColumns(20); } //decodedText.setSize(sourceImageLabel.getSize().width,100); //UPGRADE_TODO: Method 'javax.swing.JFrame.getContentPane' was converted to 'System.Windows.Forms.Form' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJFramegetContentPane'" //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent_javalangObject'" ((System.Windows.Forms.ContainerControl) this).Controls.Add(decodedText); decodedText.Dock = System.Windows.Forms.DockStyle.Bottom; decodedText.SendToBack(); //UPGRADE_ISSUE: Method 'java.awt.Window.pack' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaawtWindowpack'" pack(); }