//int iOffsetTop = 30; public Form1() { InitializeComponent(); drawUniPanel = new DrawUniMap(); //is this a VGA screen? HI_RES_AWARE if (Screen.PrimaryScreen.WorkingArea.Width > 240) { drawUniPanel.Location = new Point(0, 100); } else { drawUniPanel.Location = new Point(0, 50); } drawUniPanel.Size = new Size(this.Width, this.Height - 50); this.Controls.Add(drawUniPanel); //combo to select 'codepage' cboUnicodePlane.Items.Clear(); for (int i = 0; i < 0xff; i++) { cboUnicodePlane.Items.Insert(i, i.ToString("x02")); } cboUnicodePlane.SelectedIndex = 0x04; //combo to select font cboFont.Items.Clear(); //get a list of available fonts FontClass fontClass = new FontClass(); string[] sFonts = fontClass.getFontList(); for (int iF = 0; iF < sFonts.Length; iF++) { cboFont.Items.Insert(0, sFonts[iF]); } //add a fantasy font name to show what happens for non-existing fonts: //windows replaces the font request with a 'matching' existing font cboFont.Items.Insert(cboFont.Items.Count, "Fanatasie"); cboFont.SelectedIndex = 1; drawUniPanel._bCurrCodepage = (byte)cboUnicodePlane.SelectedIndex; this.FormBorderStyle = FormBorderStyle.Sizable; drawUniPanel.NewMessageHandler += new DrawUniMap.KlickedEventHandler(drawUni_NewMessageHandler); this.ResumeLayout(); }
private void InitializeComponent() { this.Width = 480; this.Height = 640; this.Text = "My Dialog"; this.SuspendLayout(); drawUniPanel = new DrawUniMap(); drawUniPanel.Location = new Point(0, 50); drawUniPanel.Size = new Size(this.Width, this.Height - 50); this.Controls.Add(drawUniPanel); Button btnOK = new Button(); btnOK.Text = "OK"; btnOK.Location = new System.Drawing.Point(4, 4); btnOK.Size = new System.Drawing.Size(80, 24); this.Controls.Add(btnOK); btnOK.Click += new EventHandler(btnOK_Click); //combo to select 'codepage' cboUnicodePlane = new ComboBox(); cboUnicodePlane.DropDownStyle = ComboBoxStyle.DropDownList; cboUnicodePlane.Items.Clear(); for (int i = 0; i < 0xff; i++) { cboUnicodePlane.Items.Insert(i, i.ToString("x02")); } cboUnicodePlane.SelectedIndex = 0x04; cboUnicodePlane.Location = new Point(100, 4); cboUnicodePlane.Size = new System.Drawing.Size(80, 60); cboUnicodePlane.SelectedIndexChanged += new EventHandler(lb_SelectedIndexChanged); this.Controls.Add(cboUnicodePlane); //combo to select font lbFont = new ComboBox(); lbFont.DropDownStyle = ComboBoxStyle.DropDownList; lbFont.Items.Clear(); lbFont.Items.Insert(0, "Arial"); lbFont.Items.Insert(1, "Arial Unicode MS"); lbFont.Items.Insert(2, "Times New Roman"); lbFont.Items.Insert(3, "Fanatasie"); lbFont.SelectedIndex = 1; lbFont.Location = new Point(190, 4); lbFont.Size = new Size(120, 60); lbFont.SelectedIndexChanged += new EventHandler(lbFont_SelectedIndexChanged); this.Controls.Add(lbFont); lblFontName = new Label(); lblFontName.Text = lbFont.SelectedItem.ToString(); lblFontName.Size = new Size(120, 24); lblFontName.Location = new Point(330, 4); this.Controls.Add(lblFontName); txtUniChar = new System.Windows.Forms.TextBox(); // // txtUniChar // this.txtUniChar.Location = new System.Drawing.Point(240, 32); this.txtUniChar.Name = "txtUniChar"; this.txtUniChar.ReadOnly = true; this.txtUniChar.Size = new System.Drawing.Size(23, 21); this.Controls.Add(txtUniChar); this.mainMenu1 = new System.Windows.Forms.MainMenu(); this.mnuExit = new System.Windows.Forms.MenuItem(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.mnuZoomIn = new System.Windows.Forms.MenuItem(); this.mnuZoomOut = new System.Windows.Forms.MenuItem(); // // mnuExit // this.mnuExit.Text = "Exit"; this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click); // // menuItem1 // this.menuItem1.MenuItems.Add(this.mnuZoomIn); this.menuItem1.MenuItems.Add(this.mnuZoomOut); this.menuItem1.Text = "Options"; // // mnuZoomIn // this.mnuZoomIn.Text = "Zoom In"; this.mnuZoomIn.Click += new System.EventHandler(this.mnuZoomIn_Click); // // mnuZoomOut // this.mnuZoomOut.Text = "Zoom Out"; this.mnuZoomOut.Click += new System.EventHandler(this.mnuZoomOut_Click); this.Menu = this.mainMenu1; // // mainMenu1 // this.mainMenu1.MenuItems.Add(this.mnuExit); this.mainMenu1.MenuItems.Add(this.menuItem1); this.Load += new System.EventHandler(this.Form1_Load); drawUniPanel._bCurrCodepage = (byte)cboUnicodePlane.SelectedIndex; this.FormBorderStyle = FormBorderStyle.Sizable; drawUniPanel.NewMessageHandler += new DrawUniMap.KlickedEventHandler(drawUni_NewMessageHandler); this.ResumeLayout(); }