Inheritance: ContainerControl, IResizableControl
コード例 #1
2
        public BeneficioCadastro(
            ButtonBase botaoSalvar,
            ButtonBase botaoCancelar,
            Form tela,
            DataGridView beneficioGridView
            )
        {
            this.Botao_Salvar = botaoSalvar;
            this.Botao_Cancelar = botaoCancelar;
            this.Tela = tela;
            Beneficios = TiposBeneficio.ObterListaAssociada();
            beneficioGridView.AutoGenerateColumns = false;
            beneficioGridView.DataSource = Beneficios;
            Botao_Salvar.Click += new EventHandler(Botao_Salvar_Click);
            Botao_Cancelar.Click += new EventHandler(Botao_Cancelar_Click);

            Beneficios.AddingNew += (sender, args) =>
            {
                if (beneficioGridView.Rows.Count == Beneficios.Count)
                {
                    Beneficios.RemoveAt(Beneficios.Count - 1);
                    return;
                }
            };

            AoCancelar += () =>
            {
                beneficioGridView.DataSource = Beneficios;
            };
            AoSalvar += () =>
            {
                TiposBeneficio.DispararAtualizacao();
            };
        }
コード例 #2
1
ファイル: Options.cs プロジェクト: RazDynamics/XrmToolBox
        public void ApplyFormSize(Form form)
        {
            var size = new Size(Width, Height);

            if (Screen.PrimaryScreen.WorkingArea.Height < size.Height)
            {
                size.Height = Screen.PrimaryScreen.WorkingArea.Height;
            }

            if (Screen.PrimaryScreen.WorkingArea.Width < size.Width)
            {
                size.Width = Screen.PrimaryScreen.WorkingArea.Width;
            }

            if (form.MinimumSize.Width > size.Width)
            {
                size.Width = form.MinimumSize.Width;
            }

            if (form.MinimumSize.Height > size.Height)
            {
                size.Height = form.MinimumSize.Height;
            }

            if (size.Height != 0)
            {
                form.Size = size;
                form.Top = (Screen.PrimaryScreen.WorkingArea.Height - size.Height) / 2;
                form.Left = (Screen.PrimaryScreen.WorkingArea.Width - size.Width) / 2;
            }
        }
コード例 #3
1
 protected override void OnKeyDown(KeyEventArgs e)
 {
     base.OnKeyDown(e);
     switch (e.KeyCode)
     {
         case Keys.D:
             if (form == null)
             {
                 form = new Form();
                 form.Text = "Undocked Control";
                 form.Width = Width;
                 form.Height = Height;
                 form.FormBorderStyle = FormBorderStyle.SizableToolWindow;
                 this.Controls.Remove(control);
                 form.Controls.Add(control);
                 form.FormClosed += delegate (object sender,FormClosedEventArgs ee)
                 {
                     form.Controls.Remove(control);
                     this.Controls.Add(control);
                     form = null;
                 };
                 form.Show();
             }
             else
             {
                 form.Close();
             }
             break;
     }
 }
コード例 #4
1
ファイル: Util.cs プロジェクト: Terricide/WebRtc.NET
        public static void OnMainForm(bool param)
        {
            if (param)
            {
                if (f == null)
                {
                    AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                }
                else
                {
                    CloseForm();
                }

                //using (var p = Process.GetCurrentProcess())
                //{
                //    if (p.MainWindowTitle.Contains("Chrome"))
                //    {
                //        MainWindowHandle = p.MainWindowHandle;
                //        p.PriorityClass = ProcessPriorityClass.Idle;
                //    }
                //}
                
                var thread = new Thread(delegate ()
                {
                    f = new MainForm();
                    Application.Run(f);
                });
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
            else
            {
                CloseForm();
            }
        }
コード例 #5
1
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider provider)
        {
            using (Form form1 = new Form())
            {
                form1.Text = "FormCollection Visualizer";
                form1.StartPosition = FormStartPosition.WindowsDefaultLocation;
                form1.SizeGripStyle = SizeGripStyle.Auto;
                form1.ShowInTaskbar = false;
                form1.ShowIcon = false;

                DataTable dt;

                using (Stream stream = provider.GetData())
                {
                    BinaryFormatter bformatter = new BinaryFormatter();

                    dt = (DataTable)bformatter.Deserialize(stream);

                    stream.Close();
                }

                DataGridView gridView = new DataGridView();
                gridView.Dock = DockStyle.Fill;

                form1.Controls.Add(gridView);

                gridView.DataSource = dt;

                windowService.ShowDialog(form1);
            }
        }
コード例 #6
0
ファイル: MonoWorkarounds.cs プロジェクト: miracle2k/keepass2
        public static void Release(Form f)
        {
            if(!MonoWorkarounds.IsRequired) return;
            if(f == null) { Debug.Assert(false); return; }

            ApplyToControlsRec(f.Controls, f, MonoWorkarounds.ReleaseControl);
        }
コード例 #7
0
        static void Main(string[] args)
        {
            int n = 4;

            int[] nizBrojeva;  // deklaracija reference na niz

            // TODO: nizBrojeva inicijalizirati kao niz duljine n (pojedine èlanove ostaviti neinicijaliziranima) te ispisati sve èlanove takvog neinicijaliziranog niza




            Control[] nizKontrola;  // deklaracija reference na niz 

            // TODO: nizKontrola inicijalizirati kao niz duljine n (pojedine èlanove ostaviti neinicijaliziranima) te ispisati sve èlanove takvog neinicijaliziranog niza




            // TODO: Pokrenuti program te ispis prekopirati u datoteku "InicijalizacijaNiza.txt" u ovom projektu. Obrazložiti ispise u gornja dva sluèaja.

            // inicijalizacija pojedinih èlanova
            nizKontrola[0] = new Button();
            nizKontrola[1] = new Form();
            nizKontrola[2] = nizKontrola[0];
            nizKontrola[3] = new TextBox();

            for (int i = 0; i < n; ++i)
            {
                Console.WriteLine(string.Format("{0}. kontrola: {1}", i, nizKontrola[i]));
            }

            Console.WriteLine("GOTOVO!!!");
            Console.ReadKey();
        }
コード例 #8
0
 public frmBusquedaCategorias(Form Owner,String tipo)
 {
     this.Owner = Owner;
     InitializeComponent();
     this.cboTipo.Text=tipo;
     cboTipo.Enabled = false;
 }
コード例 #9
0
        public MasterForm(Form parentForm, CNNProjectHolder cnnProjectHolder)
        {
            InitializeComponent();

            _parentForm = parentForm;
            _cnnProjectHolder = cnnProjectHolder;
        }
コード例 #10
0
ファイル: Game1.cs プロジェクト: ChadyG/MUGE-GLEED2D
        public Game1(IntPtr drawSurface)
        {
            Logger.Instance.log("Game1 creation started.");

            Instance = this;

            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 600;

            Content.RootDirectory = "Content";

            Logger.Instance.log("Creating Winform.");
            this.drawSurface = drawSurface;
            graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
            winform = (Forms.Form)Forms.Form.FromHandle(Window.Handle);
            winform.VisibleChanged += new EventHandler(Game1_VisibleChanged);
            winform.Size = new System.Drawing.Size(10, 10);
            Mouse.WindowHandle = drawSurface;
            resizebackbuffer(MainForm.Instance.pictureBox1.Width, MainForm.Instance.pictureBox1.Height);
            winform.Hide();
            Logger.Instance.log("Winform created.");

            Logger.Instance.log("Game1 creation ended.");
        }
コード例 #11
0
        public RechercheContactsForm(Users SuperU,Form precedtForm)
        {
            InitializeComponent();
            this.SuperUser = SuperU;
            this.precedente = precedtForm;

        }
コード例 #12
0
 public static ConfirmSaveLPSResult ShowConfirm(Form parent, string caption)
 {
     if (FrameworkParams.wait != null) FrameworkParams.wait.Finish();
     frmConfirmSaveReplaceLPS frm = new frmConfirmSaveReplaceLPS(caption);
     frm.ShowDialog(parent);
     return frm.Result;
 }
コード例 #13
0
        public void TestShowWithEvents()
        {
            //---------------Set up test pack-------------------
            System.Windows.Forms.DateTimePicker dateTimePicker = new System.Windows.Forms.DateTimePicker();
            dateTimePicker.ShowCheckBox = true;
            System.Windows.Forms.Form form = new System.Windows.Forms.Form();
            System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox();
            form.Controls.Add(textBox);
            textBox.Dock = System.Windows.Forms.DockStyle.Fill;
            textBox.Multiline = true;
            form.Controls.Add(dateTimePicker);
            dateTimePicker.Dock = System.Windows.Forms.DockStyle.Top;
            dateTimePicker.ValueChanged += delegate
                                               {
                                                   textBox.Text += "EventFired";
                                               };
            System.Windows.Forms.Button button = new System.Windows.Forms.Button();
            form.Controls.Add(button);
            button.Dock = System.Windows.Forms.DockStyle.Bottom;
            button.Click += delegate
                                {
                                    dateTimePicker.Checked = !dateTimePicker.Checked;
                                };
            //-------------Assert Preconditions -------------

            //---------------Execute Test ----------------------
            form.ShowDialog();
            //---------------Test Result -----------------------

        }
コード例 #14
0
ファイル: frmAbout.cs プロジェクト: vjohnson01/Tools
 private void centerFormTo(Form form, Form containerForm)
 {
     Point point = new Point();
     Size formSize = form.Size;
     Rectangle workingArea = Screen.GetWorkingArea(containerForm);
     Rectangle rect = containerForm.Bounds;
     point.X = ((rect.Left + rect.Right) - formSize.Width) / 2;
     if (point.X < workingArea.X)
     {
         point.X = workingArea.X;
     }
     else if ((point.X + formSize.Width) > (workingArea.X + workingArea.Width))
     {
         point.X = (workingArea.X + workingArea.Width) - formSize.Width;
     }
     point.Y = ((rect.Top + rect.Bottom) - formSize.Height) / 2;
     if (point.Y < workingArea.Y)
     {
         point.Y = workingArea.Y;
     }
     else if ((point.Y + formSize.Height) > (workingArea.Y + workingArea.Height))
     {
         point.Y = (workingArea.Y + workingArea.Height) - formSize.Height;
     }
     form.Location = point;
 } 
コード例 #15
0
ファイル: main.cs プロジェクト: Kolo93/z0r-desktop
 // Constructor
 public void GlobalHotkey(int modifier, Keys key, Form form)
 {
     this.modifier = modifier;
     this.key = (int)key;
     this.hWnd = form.Handle;
     id = this.GetHashCode();
 }
コード例 #16
0
ファイル: ClipboardMonitor.cs プロジェクト: Remo/MediaData
 public void Dispose()
 {
     if (this._nextClipboardViewer.HasValue)
     {
         try
         {
             if (this._control != null)
             {
                 ClipboardMonitor.ChangeClipboardChain(this._control.Handle, this._nextClipboardViewer.Value);
             }
         }
         catch
         { }
         this._nextClipboardViewer = null;
     }
     if (this._control != null)
     {
         try
         { this._control.Dispose(); }
         catch
         { }
         this._control = null;
     }
     if (this._listener != null)
     {
         try
         {
             this._listener.Closed -= this.ListenerClosed;
         }
         catch
         { }
         this._listener = null;
     }
 }
コード例 #17
0
		/*
		 * StoreFormState
		 */

		/// <summary>
		/// </summary>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="formToStore"/> is <see langword="null"/>.
		/// </exception>
		public void StoreFormState(Form formToStore)
		{
			if (formToStore == null)
			{
				throw new ArgumentNullException("formToStore");
			}

			NuGenFormStateDescriptor stateDescriptor = new NuGenFormStateDescriptor();

			stateDescriptor.BackColor = formToStore.BackColor;
			stateDescriptor.Padding = formToStore.Padding;

			ControlStyles[] formControlStyles = NuGenEnum.ToArray<ControlStyles>();
			Debug.Assert(formControlStyles != null, "formControlStyles != null");

			for (int i = 0; i < formControlStyles.Length; i++)
			{
				stateDescriptor.Styles.Add(
					formControlStyles[i],
					NuGenControlPaint.GetStyle(formToStore, formControlStyles[i])
				);
			}

			Debug.Assert(this.StoredForms != null, "this.StoredForms != null");

			if (this.StoredForms.ContainsKey(formToStore))
			{
				this.StoredForms[formToStore] = stateDescriptor;
			}
			else
			{
				this.StoredForms.Add(formToStore, stateDescriptor);
			}
		}
コード例 #18
0
 public MainController(Form frm)
 {
     main = frm;
     controls = new Dictionary<FATabStripItem, PlistEditControl>();
     Drop = new DropFileControl(frm);
     Drop.DropNotice+=drop_DropNotice;
 }
コード例 #19
0
        public RightClickTitleBarDialog(Form frm)
        {
            this.form = frm;
            try
            {
                m_SystemMenu = SystemMenu.FromForm(frm);

                m_SystemMenu.AppendSeparator();

                if (FrameworkParams.isSupportDeveloper)
                    m_SystemMenu.AppendMenu(m_FormInfo, MENU_TITLE_FORM_INFO_TEXT);
                if (this is IFormRefresh)
                {
                    m_SystemMenu.AppendMenu(m_RefreshForm, MENU_TITLE_FORM_REFRESH_TEXT);
                }
                if (this is IFormFURL)
                {
                    m_SystemMenu.AppendMenu(m_FURL, MENU_TITLE_FORM_FURL_TEXT);
                }

                m_SystemMenu.AppendSeparator();
            }
            catch (NoSystemMenuException /* err */ )
            {
                // Do some error handling
            }
        }
コード例 #20
0
ファイル: FrmSplash.cs プロジェクト: elopezglez/KodakRogers
 public FrmSplash(FrmAnalysisList mainForm)
 {
     InitializeComponent();
     backgroundWorker1.WorkerReportsProgress = true;
     _mainForm = mainForm;
     CustomInitialize();
 }
コード例 #21
0
ファイル: Form3.cs プロジェクト: DiegoAguiar/GuessingGame
 public Form3(Form formPai,Arvore arvore)
 {
     InitializeComponent();
     this.formPai = formPai;
     this.formPai.Hide();
     this.arvore = arvore;
 }
コード例 #22
0
ファイル: NuiBlueMessageBox.cs プロジェクト: yienit/KST
 /// <summary>
 /// 显示QQMessageBox消息框
 /// </summary>
 /// <param name="owner">父窗体,默认为null,设置此参数可更改消息框的背景图与父窗体一致</param>
 /// <param name="msgText">提示文本</param>
 /// <param name="caption">消息框的标题</param>
 /// <param name="msgBoxIcon">消息框的图标枚举</param>
 /// <param name="msgBoxButtons">消息框的按钮,此值可为MessageBoxButtons.OK,MessageBoxButtons.OKCancelMessageBoxButtons.RetryCancel</param>
 public static DialogResult Show(
     Form owner = null,
     string msgText = "请输入提示信息",
     NuiBlueMessageBoxIcon msgBoxIcon = NuiBlueMessageBoxIcon.Information,
     NuiBlueMessageBoxButtons msgBoxButtons = NuiBlueMessageBoxButtons.OK,
     string caption = "提示")
 {
     using (NuiBlueMessageBox msgBox = new NuiBlueMessageBox(msgText, caption, msgBoxIcon, msgBoxButtons))
     {
         if (owner != null)
         {
             msgBox.StartPosition = FormStartPosition.CenterParent;
             if (owner.BackgroundImage != null)
             {
                 //使用父窗体的背景图片
                 MsgBoxBackgroundImg = owner.BackgroundImage;
             }
             if (owner.Icon != null)
             {
                 msgBox.Icon = owner.Icon;
                 msgBox.IsDrawIcon = true;
             }
         }
         else
         {
             msgBox.StartPosition = FormStartPosition.CenterScreen;
         }
         msgBox.ShowDialog();
         return msgBox.DialogResult;
     }
 }
コード例 #23
0
        /// <summary>
        /// Imports the toolStripContainer with all his nice controls into the given form
        /// also adds the controls from this.pnlContentHolder to masterFormContents.pnlContentHolder
        /// </summary>
        public static void InitializeContent(Form newForm,
            Label lblTooltip,
            ToolStripContainer toolStripContainer,
            Panel pnlContentHolder,
            CNNProjectHolder cnnProjectHolder)
        {
            MasterForm masterFormContents = new MasterForm(newForm, cnnProjectHolder);

            // import
            toolStripContainer = masterFormContents.toolStripContainer1;
            newForm.Controls.Add(toolStripContainer);

            // control replacement
            newForm.Controls.Remove(pnlContentHolder);
            newForm.Controls.Remove(lblTooltip);
            masterFormContents.pnlContentHolder.Controls.Clear();

            foreach (Control control in pnlContentHolder.Controls)
            {
                masterFormContents.pnlContentHolder.Controls.Add(control);
            }

            int time = (cnnProjectHolder.CNNProject.ExpertMode) ? 1 : 5000;

            masterFormContents.ShowPictureBoxBalloon(lblTooltip.Text, time, newForm, true);
            masterFormContents.lblHeading.Text = newForm.Text;
        }
コード例 #24
0
ファイル: Video.cs プロジェクト: hatori/GameBoy-Revolution
        public Video(Form _form1_reference)
        {
            form1_reference = _form1_reference;
            critical_failure = false;

            Load_Window_Size();

            if (!initialize_directx())
            {
                MessageBox.Show("problem with directx initialization");
                fatal_error = true;
                return;
            }

            try
            {
                texture = new Texture(device, 256, 256, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default);
                data_copy = new int[256 * 256];
            }
            catch (Direct3D9Exception e)
            {
                MessageBox.Show("Gameboy Revolution failed to create rendering surface. \nPlease report this error. \n\nDirectX Error:\n" + e.ToString(), "Error!", MessageBoxButtons.OK);
                fatal_error = true;
                return;
            }

            setup_screen();
            setup_colors();
        }
コード例 #25
0
ファイル: frmMain.cs プロジェクト: minhkhong1369/PthOrder
        // Kiem tra form da mo len hay chua
        public static bool IsFocusForm(Type type, Form frmParent)
        {
            int i = 0;
            if (frmParent == null) return false;
            foreach (Form frm in frmParent.MdiChildren)
            {
                if (frm.GetType() == type)
                {
                    if (frm.MinimizeBox)
                    {
                        frm.Focus();
                        frm.WindowState = FormWindowState.Maximized;
                    }
                    frm.Focus();
                    return true;
                }
                else
                {
                    i++;
                }

            }
            if (i != 0)
                return false;
            return false;
        }
コード例 #26
0
ファイル: DocEdit.cs プロジェクト: WinWrap/ClassicExamples
 public DocEdit(Form parent, Document doc)
 {
     MdiParent = parent;
     InitializeComponent();
     m_doc = doc;
     doc.AddView(this);
 }
コード例 #27
0
ファイル: SysManMain.cs プロジェクト: Davincier/openpetra
        /// <summary>
        /// this function allows to store the content of the whole database
        /// as a text file, and import it somewhere else, across database types etc
        /// </summary>
        /// <param name="AParentForm"></param>
        public static void ExportAllData(Form AParentForm)
        {
            MessageBox.Show(Catalog.GetString("This may take a while. Please just wait!"));

            string zippedYml = TRemote.MSysMan.ImportExport.WebConnectors.ExportAllTables();
            TImportExportDialogs.ExportWithDialogYMLGz(zippedYml, Catalog.GetString("Save Database into File"));
        }
コード例 #28
0
    protected override void Initialize()
    {
      base.Initialize();

      // Get the standard XNA window.
      _gameForm = Control.FromHandle(Window.Handle) as Form;

#if MONOGAME
      // Create a "virtual file system" for reading game assets.
      var titleStorage = new TitleStorage("Content");
      var assetsStorage = new ZipStorage(titleStorage, "Content.zip");
      var drStorage = new ZipStorage(titleStorage, "DigitalRune.zip");
      var vfsStorage = new VfsStorage();
      vfsStorage.MountInfos.Add(new VfsMountInfo(titleStorage, null));
      vfsStorage.MountInfos.Add(new VfsMountInfo(assetsStorage, null));
      vfsStorage.MountInfos.Add(new VfsMountInfo(drStorage, null));

      Content = new StorageContentManager(Services, vfsStorage);
#else
      Content.RootDirectory = "Content";
#endif
      // Create the DigitalRune GraphicsManager.
      _graphicsManager = new GraphicsManager(GraphicsDevice, Window, Content);

      // Add graphics service to service provider
      Services.AddService(typeof(IGraphicsService), _graphicsManager);

      // Add a few GraphicsScreens that draw stuff.
      _graphicsManager.Screens.Add(new BackgroundGraphicsScreen(_graphicsManager));
      _graphicsManager.Screens.Add(new TriangleGraphicsScreen(_graphicsManager));
      _graphicsManager.Screens.Add(new TextGraphicsScreen(_graphicsManager, Content));
    }
コード例 #29
0
ファイル: Login.cs プロジェクト: stevesloka/bvcms
		private void onLoginLoad(object sender, EventArgs e)
		{
			this.CenterToScreen();
			this.Location = new Point(this.Location.X, this.Location.Y / 2);

			updateViews();

			//if (Program.settings.popupForVersion < 1) {
			//	MessageBox.Show("The Check-In program has been updated,\nplease verify the following settings:\n\n" +
			//		"Login Page\n\n- Server name (e.g. <yourchurch>.tpsdb.com)\n- Username\n- Password\n- Printer\n- Advanced Page Size (Optional)\n\n" +
			//		"Settings Page\n\n- Campus\n- Early Checkin Hours\n- Late Checkin Minutes\n- Checkboxes at the bottom", "New Version", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

			//	Program.settings.setPopupForVersion(1);
			//}

			keyboard = new CommonKeyboard(this);
			keyboard.Show();
			attachKeyboard();

			URL.Text = Program.settings.subdomain;
			username.Text = Program.settings.user;

			if (username.Text.Length > 0) {
				current = password;
				this.ActiveControl = password;
			} else {
				current = URL;
				this.ActiveControl = URL;
			}
		}
コード例 #30
0
		/*
		 * RestoreFormState
		 */

		/// <summary>
		/// </summary>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="formToRestore"/> is <see langword="null"/>.
		/// </exception>
		public void RestoreFormState(Form formToRestore)
		{
			if (formToRestore == null)
			{
				throw new ArgumentNullException("formToRestore");
			}

			Debug.Assert(this.StoredForms != null, "this.StoredForms != null");

			if (this.StoredForms.ContainsKey(formToRestore))
			{
				NuGenFormStateDescriptor stateDescriptor = this.StoredForms[formToRestore];
				ControlStyles[] formControlStyles = NuGenEnum.ToArray<ControlStyles>();

				for (int i = 0; i < formControlStyles.Length; i++)
				{
					NuGenControlPaint.SetStyle(
						formToRestore,
						formControlStyles[i],
						stateDescriptor.Styles[formControlStyles[i]]
					);

					formToRestore.BackColor = stateDescriptor.BackColor;
					formToRestore.Padding = stateDescriptor.Padding;
				}
			}
		}
コード例 #31
0
        public DataTable FindBillData()
        {
            DataTable data = new DataTable();

            System.Windows.Forms.Form f = System.Windows.Forms.Application.OpenForms["_frmFindBillData"];
            string SoHD = ((_frmFindBillData)f).tbFindbillData.Text;

            if (IsNumber(SoHD) == true)
            {
                string FindQuery = "SELECT SOHD AS N'Số Hoá Đơn' ,MAKH AS N'Mã Khách Hàng', MANV AS N'Mã Nhân Viên' ," +
                                   "TRIGIA AS N'Trị Giá',NGHD AS N'Ngày Hoá Đơn' FROM HOADON " +
                                   "WHERE SOHD = '" + SoHD + "' ";
                data = DataProvider.Instance.ExecuteQuery(FindQuery);
                return(data);
            }
            else
            {
                MessageBox.Show("Số hoá đơn phải là chuỗi sô", "Thông báo", MessageBoxButtons.OK);
            }
            return(data);
        }
コード例 #32
0
        public void InstantiateMenu(object FormToInsantiateOn)
        {
            System.Windows.Forms.Form formToInsantiateOn = (System.Windows.Forms.Form)FormToInsantiateOn;
            formToInsantiateOn.Menu = new MainMenu();
            MenuItem shapesItem = new MenuItem("Shapes");

            formToInsantiateOn.Menu.MenuItems.Add(shapesItem);
            shapesItem.MenuItems.Add("Polygon", delegate(object sender, EventArgs e) { SwitchScreen(new PolygonCalculator()); });
            shapesItem.MenuItems.Add("Circle", delegate(object sender, EventArgs e) { SwitchScreen(new CircleCalculator()); });
            MenuItem algebraItem = new MenuItem("Graphing");

            algebraItem.MenuItems.Add("Linear", delegate(object sender, EventArgs e) { SwitchScreen(new LinearGraphing()); });
            algebraItem.MenuItems.Add("Quadratic", delegate(object sender, EventArgs e) { SwitchScreen(new QuadraticGraphing()); });
            algebraItem.MenuItems.Add("Cubic", delegate(object sender, EventArgs e) { SwitchScreen(new CubicGraphing()); });
            algebraItem.MenuItems.Add("Quartic", delegate(object sender, EventArgs e) { SwitchScreen(new QuarticGraphing()); });
            formToInsantiateOn.Menu.MenuItems.Add(algebraItem);
            MenuItem practiceItem = new MenuItem("Practice");

            practiceItem.MenuItems.Add("Factorise", delegate(object sender, EventArgs e) { SwitchScreen(new FactorisePractice()); });
            formToInsantiateOn.Menu.MenuItems.Add(practiceItem);
        }
コード例 #33
0
        /// <summary>
        /// Manage Expection
        /// </summary>
        /// <param name="ex">The ex.</param>
        /// <param name="actionType">Type of the action.</param>
        /// <param name="source">The source.</param>
        public static void ManageException(Exception ex, ActionType actionType, System.Windows.Forms.Form source)
        {
            if (ex != null)
            {
                ExceptionPolicy.HandleException(ex, ConfigurationWrapper.UIPolicyName);
                Application.UseWaitCursor = false;

                //// If Soap Exception override action type to close current Form.
                if (ex.GetType().Equals(new SoapException()))
                {
                    ShowExceptionViewer(ConfigurationWrapper.ExceptionMessage, ActionType.CloseCurrentForm, source);
                }
                else
                {
                    if (actionType != ActionType.JustLog)
                    {
                        ShowExceptionViewer(ConfigurationWrapper.ExceptionMessage, actionType, source);
                    }
                }
            }
        }
コード例 #34
0
ファイル: Game.cs プロジェクト: FlashZX/WinFormsGame
        /// <summary>
        /// Инициализация обьектов текущей формы
        /// </summary>
        /// <param name="form"></param>
        public static void Init(System.Windows.Forms.Form form)
        {
            //Граф.устройсто для вывода графики
            Graphics g;

            //Предоставляет доступ к главному буферу графического контекста для текущего приложения
            _context = BufferedGraphicsManager.Current;
            // Создаем объект (поверхность рисования) и связываем его с формой
            g = form.CreateGraphics();
            // Запоминаем размеры формы
            Width  = form.ClientSize.Width;
            Height = form.ClientSize.Height;
            // Связываем буфер в памяти с графическим объектом, чтобы рисовать в буфере
            Buffer           = _context.Allocate(g, new Rectangle(0, 0, Width, Height));
            Ship.MessageDie += Finish;
            Ship.MessageWin += Win;
            _timer.Start();
            _timer.Tick  += Timer_Tick;
            form.KeyDown += Form_KeyDown;
            Load();
        }
コード例 #35
0
ファイル: MainForm.cs プロジェクト: whuacn/CJia
 // 瓶贴生成按钮单击事件
 private void btnNoPrintLabel_Click(object sender, EventArgs e)
 {
     //string pageTitle = "瓶贴生成";//获得tabpage名称
     //this.MenuShowPage(pageTitle);
     CJia.PIVAS.App.UI.NoPrintLabel noPrintLabel = new UI.NoPrintLabel(this.NoPrintLabel);
     frmBase.Dispose();
     frmBase      = new System.Windows.Forms.Form();
     frmBase.Text = "未打印的瓶贴";
     //frmBase.MaximizeBox = false;
     //frmBase.MinimizeBox = false;
     frmBase.Size = new System.Drawing.Size(noPrintLabel.Width + 15, noPrintLabel.Height + 30);
     //frmBase.AutoSize = true;
     frmBase.StartPosition = FormStartPosition.CenterScreen;
     frmBase.KeyPreview    = true;
     //UControl.Dock = DockStyle.Fill;
     frmBase.Controls.Add(noPrintLabel);
     //UControl.Parent = frmBase;
     noPrintLabel.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Top);
     //frmBase.TopMost = true;
     frmBase.Show();
 }
コード例 #36
0
 public void Bindings()
 {
     System.Windows.Forms.Form f = System.Windows.Forms.Application.OpenForms["_frmSalesManage"];
     ((_frmSalesManage)f).tbNameSp.DataBindings.Clear();
     ((_frmSalesManage)f).tbCodeSp.DataBindings.Clear();
     ((_frmSalesManage)f).tbDateSp.DataBindings.Clear();
     ((_frmSalesManage)f).tbHsd.DataBindings.Clear();
     ((_frmSalesManage)f).tbNcc.DataBindings.Clear();
     ((_frmSalesManage)f).tbPrice.DataBindings.Clear();
     ((_frmSalesManage)f).tbDonvi.DataBindings.Clear();
     ((_frmSalesManage)f).tbCTKM.DataBindings.Clear();
     ((_frmSalesManage)f).tbNameSp.DataBindings.Add(new Binding("Text", ((_frmSalesManage)f).dtgvSanpham.DataSource, "TENSP"));
     ((_frmSalesManage)f).tbCodeSp.DataBindings.Add(new Binding("Text", ((_frmSalesManage)f).dtgvSanpham.DataSource, "MASP"));
     ((_frmSalesManage)f).tbDateSp.DataBindings.Add(new Binding("value", ((_frmSalesManage)f).dtgvSanpham.DataSource, "NSX"));
     ((_frmSalesManage)f).tbHsd.DataBindings.Add(new Binding("value", ((_frmSalesManage)f).dtgvSanpham.DataSource, "HSD"));
     ((_frmSalesManage)f).tbNcc.DataBindings.Add(new Binding("Text", ((_frmSalesManage)f).dtgvSanpham.DataSource, "NCC"));
     ((_frmSalesManage)f).tbPrice.DataBindings.Add(new Binding("Text", ((_frmSalesManage)f).dtgvSanpham.DataSource, "GIA"));
     ((_frmSalesManage)f).tbDonvi.DataBindings.Add(new Binding("Text", ((_frmSalesManage)f).dtgvSanpham.DataSource, "DVT"));
     ((_frmSalesManage)f).tbCTKM.DataBindings.Add(new Binding("Text", ((_frmSalesManage)f).dtgvSanpham.DataSource, "CTKM"));
     ((_frmSalesManage)f).DataBindings.Clear();
 }
コード例 #37
0
        //string checklangCA;
        public _frmUseTerm()
        {
            InitializeComponent();
            System.Windows.Forms.Form f = System.Windows.Forms.Application.OpenForms["_frmLogin"];
            checklang = ((_frmLogin)f).lbTitle.Text;
            culture   = CultureInfo.CurrentCulture;
            if (checklang == "Đăng nhập")
            {
                SetLanguage("vi-VN");
            }
            else
            {
                SetLanguage("en-US");
            }

            /*System.Windows.Forms.Form fCA = System.Windows.Forms.Application.OpenForms["_frmCreateAcc"];
             * checklangCA = ((_frmCreateAcc)fCA).rbElse.Text;
             * culture = CultureInfo.CurrentCulture;
             * if (checklangCA == "Khác") SetLanguage("vi-VN");
             * else SetLanguage("en-US");*/
        }
コード例 #38
0
        private void ShowMainForm()
        {
            if (mainForm == null)
            {
                mainForm = new MainForm();
                UpdateLabelTime();
                mainForm.Show();
                mainForm.Activate();

                ((MainForm)mainForm).upTimeLabel.DoubleClick           += new System.EventHandler(this.upTimeLabel_DoubleClick);
                ((MainForm)mainForm).usageLabel.DoubleClick            += new System.EventHandler(this.usageLabel_DoubleClick);
                ((MainForm)mainForm).totalLabel.DoubleClick            += new System.EventHandler(this.totalLabel_DoubleClick);
                ((MainForm)mainForm).hasBeenPluggedInLabel.DoubleClick += new System.EventHandler(this.hasBeenPluggedInLabel_DoubleClick);
                mainForm.Closed += new EventHandler(mainForm_Closed);
            }
            else
            {
                mainForm.WindowState = FormWindowState.Normal;
                mainForm.Activate();
            }
        }
コード例 #39
0
        public static void InitHotkeys(System.Windows.Forms.Form form, ScintillaNET.Scintilla editor)
        {
            // register the hotkeys with the form
            //HotKeyManager.AddHotKey(form, OpenSearch, Keys.F, true);
            //HotKeyManager.AddHotKey(form, OpenFindDialog, Keys.F, true, false, true);
            //HotKeyManager.AddHotKey(form, OpenReplaceDialog, Keys.R, true);
            //HotKeyManager.AddHotKey(form, OpenReplaceDialog, Keys.H, true);
            //HotKeyManager.AddHotKey(form, Uppercase, Keys.U, true);
            //HotKeyManager.AddHotKey(form, Lowercase, Keys.L, true);
            HotKeyManager.AddHotKey(form, editor.ZoomIn, Keys.Oemplus, true);
            HotKeyManager.AddHotKey(form, editor.ZoomOut, Keys.OemMinus, true);
            HotKeyManager.AddHotKey(form, () => editor.Zoom = 0, Keys.D0, true);
            //HotKeyManager.AddHotKey(form, CloseSearch, Keys.Escape);

            // remove conflicting hotkeys from scintilla
            //editor.ClearCmdKey(Keys.Control | Keys.F);
            //editor.ClearCmdKey(Keys.Control | Keys.R);
            //editor.ClearCmdKey(Keys.Control | Keys.H);
            //editor.ClearCmdKey(Keys.Control | Keys.L);
            //editor.ClearCmdKey(Keys.Control | Keys.U);
        }
コード例 #40
0
        public static String CallHelp(System.Windows.Forms.Form thisFrm, DataTable dt, String selectedText)
        {
            String str;


            Objfrm.Select(dt, selectedText, uptoIndex);


            Objfrm.ShowDialog(thisFrm);
            thisFrm.Activate();
            if (Objfrm.outStr != null)
            {
                str = Objfrm.outStr;
            }
            else
            {
                str = "";
            }

            return(str);
        }
コード例 #41
0
 /// <summary>
 /// 静态方法。
 /// </summary>
 /// <param name="ctl"></param>
 /// <returns></returns>
 private static System.Windows.Forms.Form getCtlParentForm(System.Windows.Forms.Control ctl)
 {
     if (ctl == null)
     {
         return(null);
     }
     System.Windows.Forms.Form frm = ctl as System.Windows.Forms.Form;
     if (frm != null)
     {
         return(frm);
     }
     System.Windows.Forms.ContainerControl conCtl = ctl as System.Windows.Forms.ContainerControl;
     if (conCtl != null)
     {
         return(conCtl.ParentForm);
     }
     else
     {
         return(getCtlParentForm(ctl.Parent));
     }
 }
コード例 #42
0
        internal static bool IsFormMinimized(SimpleControlProvider provider)
        {
            if (provider == null)
            {
                return(false);
            }

            if (provider.AssociatedControl == null)
            {
                Log.Warn(string.Format("IsFormMinized: {0} returns null", provider.GetType()));
                return(false);
            }

            SWF.Form form = provider.AssociatedControl.FindForm();
            if (form == null)
            {
                return(false);
            }

            return(form.WindowState == SWF.FormWindowState.Minimized);
        }
コード例 #43
0
        public static String ComboDt1(System.Windows.Forms.Form thisFrm, DataTable dt, int uptoIndex)
        {
            string str = "";

            Objfrm.row = "row";
            Objfrm.Select(dt, "", uptoIndex);

            Objfrm.ShowDialog();
            Objfrm.Visible = false;

            thisFrm.Activate();
            if (Objfrm.outStr != null)
            {
                str = Objfrm.outStr;
            }
            else
            {
                str = "";
            }
            return(str);
        }
コード例 #44
0
ファイル: WindowStyle.cs プロジェクト: rsfc/LemonadeWin
 /// <summary>
 /// 设置窗体
 /// </summary>
 /// <param name="TargetForm"></param>
 /// <param name="Manager"></param>
 public virtual bool SetWindows(System.Windows.Forms.Form TargetForm, ILayoutManager Manager)
 {
     try
     {
         Form mf = (Form)Lemon.GetMainForm();
         if (TargetForm != mf)
         {
             mf.Invoke(new SetWindowStyle(WinStyle), TargetForm, mf, Manager);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         Lemon.SendMsgError(ex);
         return(false);
     }
 }
コード例 #45
0
ファイル: Game1.cs プロジェクト: mohammedmjr/GLib
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            arrows      = new SpriteManager(spriteBatch);
            ts          = new TextSprite(spriteBatch, new Vector2(12), Content.Load <SpriteFont>("ScaleFont"), "Current Scale: 1\r\n(Use arrow keys to adjust)", Color.Black);
            arrows.AddNewSprite(new Vector2(75), Content.Load <Texture2D>("arrowincircle"));
            arrows[0].Updated          += new EventHandler(arrow_Updated);
            arrows[0].Rotation          = new SpriteRotation(90);
            arrows[0].UseCenterAsOrigin = true;
            //arrows[0].Center = new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2);
            //Enable drag-n-drop support

            System.Windows.Forms.Form underlyingForm = (System.Windows.Forms.Form)System.Windows.Forms.Form.FromHandle(Window.Handle);
            underlyingForm.AllowDrop  = true;
            underlyingForm.DragEnter += new System.Windows.Forms.DragEventHandler(underlyingForm_DragEnter);
            underlyingForm.DragDrop  += new System.Windows.Forms.DragEventHandler(underlyingForm_DragDrop);
            //base.Initialize();
            InitializeComponent(ref underlyingForm);
            IsMouseVisible = true;
        }
コード例 #46
0
        public Main(string file)
        {
            initialFile = file;

            Window.Title = "Binmap " + Version;

            Forms.Form frm = (Forms.Form)Forms.Form.FromHandle(Window.Handle);
            //frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
            frm.AllowDrop  = true;
            frm.DragEnter += new Forms.DragEventHandler(windowDragEnter);
            frm.DragDrop  += new Forms.DragEventHandler(windowDragDrop);

            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            IsMouseVisible = true;

            //Window.IsBorderless = true;
            Window.AllowUserResizing  = true;
            Window.ClientSizeChanged += Window_ClientSizeChanged;
        }
コード例 #47
0
ファイル: StringOperate.cs プロジェクト: xiaoquanamm/shouzhu
        /// <summary>
        /// 如果设置为繁体,把窗体的所有字符转换为繁体
        /// </summary>
        internal static void Big5Convert(System.Windows.Forms.Form frm)
        {
            if (frm == null)
            {
                return;
            }
            if (PSetUp.bIsBig5Encoding)
            {
                if (frm.Text.Length > 0)
                {
                    frm.Text = StringOperate.ToTraditional(frm.Text);
                }

                if (frm.Controls.ContainsKey("lblNotEncoding"))
                {
                    return;//说明此窗口禁止繁体编码
                }

                Big5ConvertForm_Ref(frm.Controls);
            }
        }
コード例 #48
0
ファイル: MDI.cs プロジェクト: PaulNichols/Old-Projects
        private void MakeControlsTransparent(System.Windows.Forms.Form FormToManipulate)
        {
            VbPowerPack.BlendPanel BlendPanel = new  VbPowerPack.BlendPanel();
            BlendPanel.Dock = System.Windows.Forms.DockStyle.Fill;

            for (int i = 0; i < FormToManipulate.Controls.Count; i++)
            {
                if (FormToManipulate.Controls[i].GetType().Equals(typeof(Label)) || FormToManipulate.Controls[i].GetType().Equals(typeof(System.Windows.Forms.CheckBox)))
                {
                    FormToManipulate.Controls[i].BackColor = System.Drawing.Color.Transparent;
                }
            }

            while (FormToManipulate.Controls.Count > 0)
            {
                BlendPanel.Controls.Add(FormToManipulate.Controls[0]);
            }

            BlendPanel.Blend = new VbPowerPack.BlendFill(VbPowerPack.BlendStyle.Vertical, System.Drawing.Color.LightSkyBlue, System.Drawing.SystemColors.HotTrack);
            FormToManipulate.Controls.Add(BlendPanel);
        }
コード例 #49
0
ファイル: Win32.dpi.cs プロジェクト: zzlvff/Eto
        public static uint GetDpi(this System.Windows.Forms.Screen screen)
        {
            if (!MonitorDpiSupported)
            {
                // fallback to slow method if we can't get the dpi from the system
                using (var form = new System.Windows.Forms.Form {
                    Bounds = screen.Bounds
                })
                    using (var graphics = form.CreateGraphics())
                    {
                        return((uint)graphics.DpiY);
                    }
            }

            var  pnt = new System.Drawing.Point(screen.Bounds.Left + 1, screen.Bounds.Top + 1);
            var  mon = MonitorFromPoint(pnt, MONITOR.DEFAULTTONEAREST);
            uint dpiX, dpiY;

            GetDpiForMonitor(mon, MDT.EFFECTIVE_DPI, out dpiX, out dpiY);
            return(dpiX);
        }
コード例 #50
0
        private void SaveWindowState(System.Windows.Forms.Form f, string Key)
        {
            if (f.WindowState == FormWindowState.Maximized)
                SaveSetting("True", "Maximized");
            else
                SaveSetting("False", "Maximized");

            if (f.WindowState == FormWindowState.Minimized)
                SaveSetting("True", "Minimized");
            else
                SaveSetting("False", "Minimized");

            //Only save it if it is visible:
            if (f.Location.X > MIN_X)
            {
                SaveSetting(f.Location.X.ToString(), Key + "_X");
                SaveSetting(f.Location.Y.ToString(), Key + "_Y");
                SaveSetting(f.Width.ToString(), Key + "_Width");
                SaveSetting(f.Height.ToString(), Key + "_Height");
            }
        }
コード例 #51
0
 public int showDialog(object obj)
 {
     System.Windows.Forms.DialogResult ret;
     if (obj == null || (obj != null && !(obj is System.Windows.Forms.Form)))
     {
         ret = base.ShowDialog();
     }
     else
     {
         System.Windows.Forms.Form form = (System.Windows.Forms.Form)obj;
         ret = base.ShowDialog(form);
     }
     if (ret == System.Windows.Forms.DialogResult.OK || ret == System.Windows.Forms.DialogResult.Yes)
     {
         return(1);
     }
     else
     {
         return(0);
     }
 }
コード例 #52
0
 /// <summary>
 /// Overloaded Constructor -- 5 --
 /// Icon = Programmer must provide,
 /// Tooltip = Programmer must provide,
 /// Visibility = Programmer must provide,
 /// </summary>
 public SystemTrayNotifyIcon(System.Windows.Forms.Form form, bool visible, string toolTip, Icon icon,
                             ContextMenuStrip contextMenu)
 {
     OnStatusChanged += new SystemTrayNotifyIcon.StatusChanged(SystemTrayNotificationHandler);
     // Setting Event Handler
     mainForm           = form;
     notifyIcon.Visible = visible;
     if (icon.Size.Height > 16 || icon.Size.Width > 16)
     {
         notifyIcon.Icon = mainForm.Icon;
     }
     else
     {
         notifyIcon.Icon = icon;
     }
     notifyIcon.Text             = toolTip;
     notifyIcon.ContextMenuStrip = contextMenu;
     iconTimer          = new Timer();
     iconTimer.Interval = timerInterval;
     iconTimer.Tick    += new EventHandler(TimerProc);
 }
コード例 #53
0
 /// <summary>
 ///     捕获退出
 /// </summary>
 /// <param name="mainForm">主窗口</param>
 /// <param name="closingFunc">窗体正在关闭事件</param>
 public static void CapturedExit(System.Windows.Forms.Form mainForm, Func <bool> closingFunc)
 {
     mainForm.FormClosing += (sender, e) =>
     {
         if (closingFunc != null)
         {
             e.Cancel = !closingFunc();
         }
         else
         {
             e.Cancel = true;
         }
     };
     mainForm.FormClosed += (sender, e) =>
     {
         Environment.Exit(Environment.ExitCode);
         var runMainForm = sender as System.Windows.Forms.Form;
         runMainForm.Dispose();
         runMainForm.Close();
     };
 }
コード例 #54
0
        static void Main()
        {
            var player = LibMPlayerCommon.PlayerFactory.Get(-1, "/usr/lib/x86_64-linux-gnu/libmpv.so.1");


            System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
            frm.Height = 600;
            frm.Width  = 800;

            var playerControl = new LibMPlayerWinform.WinFormMPlayerControl(player);

            player.SetHandle(playerControl.Handle);
            playerControl.Dock = DockStyle.Fill;

            //playerControl.MPlayerPath = @"C:\path\to\mplayer.exe";
            playerControl.VideoPath = @"/home/peter/Downloads/Die Hard 2 (1990) [1080p] {5.1}/Die.Hard.2.BluRay.1080p.x264.5.1.Judas.mp4";

            frm.Controls.Add(playerControl);

            Application.Run(frm);
        }
コード例 #55
0
        public void ControlInWinFormsWindowShouldReturnParentWindow()
        {
            Invoke(() =>
            {
                var nativeWindow  = new swf.Form();
                var panel         = new Panel();
                var winformsPanel = panel.ToNative(true);

                nativeWindow.Controls.Add(winformsPanel);

                // this ensures the hwnd is created for this form and for the element host
                var windowhandle  = nativeWindow.Handle;
                var wpfhosthandle = winformsPanel.Handle;

                // get the parent window
                var parentWindow = panel.ParentWindow;

                Assert.IsNotNull(parentWindow, "#1");
                Assert.AreEqual(windowhandle, parentWindow.NativeHandle, "#2");
            });
        }
コード例 #56
0
ファイル: Session.cs プロジェクト: wenjun001/OTGEdit
        private static void CreateProgressBar()
        {
            // Create a form and keep it running in a seperate thread.
            progressBarThread = new Thread(
                new ThreadStart(
                    (Action) delegate
            {
                Form form            = new System.Windows.Forms.Form();
                form.BackColor       = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(150)))), ((int)(((byte)(134)))));
                form.Text            = "Please wait.";
                form.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                form.StartPosition   = FormStartPosition.CenterParent;
                form.MinimizeBox     = false;
                form.MaximizeBox     = false;
                form.ControlBox      = false;

                form.ClientSize = new Size(117, 40);

                ProgressBar progressBar = new ProgressBar();
                progressBar.Minimum     = 0;
                progressBar.Maximum     = 100;
                progressBar.Text        = "Loading...";
                progressBar.Anchor      = AnchorStyles.Top | AnchorStyles.Left;
                progressBar.Location    = new Point(8, 8);
                progressBar.AutoSize    = true;
                progressBar.Style       = ProgressBarStyle.Marquee;

                form.Controls.AddRange(new Control[] { progressBar });

                form.Show();
                form.Hide();

                progressBarForm = form;

                System.Windows.Forms.Application.Run();
            }
                    )
                );
            progressBarThread.Start();
        }
コード例 #57
0
        public void UpdateTooltip(System.Windows.Forms.Form form)
        {
            if (Tooltip == null)
            {
                TooltipFont      = new System.Drawing.Font("Consolas", 10.0f);
                TooltipTitleFont = new System.Drawing.Font(TooltipFont, System.Drawing.FontStyle.Bold);

                Tooltip                = new ToolTip();
                Tooltip.OwnerDraw      = true;
                Tooltip.Draw          += ToolTip_Draw;
                Tooltip.Popup         += Tooltip_Popup;
                Tooltip.BackColor      = System.Drawing.Color.FromArgb(255, ColorBox.R, ColorBox.G, ColorBox.B);
                Tooltip.ForeColor      = System.Drawing.Color.FromArgb(255, ColorText.R, ColorText.G, ColorText.B);
                TooltipBackgroundBrush = new System.Drawing.SolidBrush(Tooltip.BackColor);
            }

            if (IsVisible)
            {
                if (!ToolTipShowing)
                {
                    Title = Box.GetPopupTitle();
                    Text  = Box.GetPopupText();

                    Tooltip.ToolTipTitle = null;
                    Tooltip.ToolTipIcon  = ToolTipIcon.None;
                    Tooltip.Show("0", form, (int)DrawPosition.X, (int)DrawPosition.Y);

                    ToolTipShowing = true;
                }
            }
            else
            {
                if (ToolTipShowing)
                {
                    Tooltip.RemoveAll();

                    ToolTipShowing = false;
                }
            }
        }
コード例 #58
0
        protected override void Initialize()
        {
            // Basic Initialize
            base.Initialize();

            // Socket binding
            #region Server Socket Connection

            m_ClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(Program.lib.Ip()), 35000);

            SocketAsyncEventArgs args = new SocketAsyncEventArgs();
            args.RemoteEndPoint = ipep;
            args.Completed     += new EventHandler <SocketAsyncEventArgs>(Connect_Complete);
            m_ClientSocket.ConnectAsync(args);

            #endregion

            // System initialize
            #region System Settings

            // 마우스 Visible
            IsMouseVisible = true;

            // Basic Form Setting...
            Mainform              = (System.Windows.Forms.Form)System.Windows.Forms.Control.FromHandle(this.Window.Handle);
            Mainform.Move        += Mainform_Move;
            Mainform.FormClosing += Mainform_FormClosing;

            // Initialize Camara
            cam     = new Camera2d();
            cam.Pos = new Vector2(400, 240);

            // Initialize Login Form
            Form_Login = new Forms.Login();
            Form_Login.Show();
            Form_Login.Location = new System.Drawing.Point(Mainform.Location.X + 280, Mainform.Location.Y + 300);

            #endregion
        }
コード例 #59
0
        protected override void Initialize(GameContext <Control> gameContext)
        {
            Control = gameContext.Control;

            // Setup the initial size of the window
            var width = gameContext.RequestedWidth;

            if (width == 0)
            {
                width = Control is Form ? GraphicsDeviceManager.DefaultBackBufferWidth : Control.ClientSize.Width;
            }

            var height = gameContext.RequestedHeight;

            if (height == 0)
            {
                height = Control is Form ? GraphicsDeviceManager.DefaultBackBufferHeight : Control.ClientSize.Height;
            }

            windowHandle = new WindowHandle(AppContextType.Desktop, Control, Control.Handle);

            Control.ClientSize = new Size(width, height);

            Control.MouseEnter += GameWindowForm_MouseEnter;
            Control.MouseLeave += GameWindowForm_MouseLeave;

            form = Control as Form;
            if (Control is GameForm gameForm)
            {
                //gameForm.AppActivated += OnActivated;
                //gameForm.AppDeactivated += OnDeactivated;
                gameForm.UserResized      += OnClientSizeChanged;
                gameForm.FullscreenToggle += OnFullscreenToggle;
                gameForm.FormClosing      += OnClosing;
            }
            else
            {
                Control.Resize += OnClientSizeChanged;
            }
        }
コード例 #60
0
        private void button2_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.Form form = new System.Windows.Forms.Form();
            Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer();
            Microsoft.Msagl.Drawing.Graph          graph  = new Microsoft.Msagl.Drawing.Graph("graph");
            List <HuffmanNode> sortedHuffman = sortHuffman(huffman);

            while (sortedHuffman.Count != 0)
            {
                if (sortedHuffman.Count == 1)
                {
                    sortedHuffman.RemoveAt(0);
                }
                else
                {
                    graph.AddNode(sortedHuffman[1].name + " | " + sortedHuffman[1].frequency.ToString());
                    graph.AddNode(sortedHuffman[0].name + " | " + sortedHuffman[0].frequency.ToString());
                    graph.FindNode(sortedHuffman[1].name + " | " + sortedHuffman[1].frequency.ToString()).Attr.FillColor = Microsoft.Msagl.Drawing.Color.Red;
                    graph.FindNode(sortedHuffman[0].name + " | " + sortedHuffman[0].frequency.ToString()).Attr.FillColor = Microsoft.Msagl.Drawing.Color.Red;
                    graph.FindNode(sortedHuffman[1].name + " | " + sortedHuffman[1].frequency.ToString()).Attr.Shape     = Microsoft.Msagl.Drawing.Shape.Circle;
                    graph.FindNode(sortedHuffman[0].name + " | " + sortedHuffman[0].frequency.ToString()).Attr.Shape     = Microsoft.Msagl.Drawing.Shape.Circle;
                    graph.AddEdge((sortedHuffman[0].name + sortedHuffman[1].name) + " | " + ((sortedHuffman[0].frequency + sortedHuffman[1].frequency)).ToString(), sortedHuffman[1].name + " | " + sortedHuffman[1].frequency.ToString());
                    graph.AddEdge((sortedHuffman[0].name + sortedHuffman[1].name) + " | " + ((sortedHuffman[0].frequency + sortedHuffman[1].frequency)).ToString(), sortedHuffman[0].name + " | " + sortedHuffman[0].frequency.ToString());
                    graph.AddNode((sortedHuffman[0].name + sortedHuffman[1].name) + " | " + ((sortedHuffman[0].frequency + sortedHuffman[1].frequency)).ToString());
                    graph.FindNode((sortedHuffman[0].name + sortedHuffman[1].name) + " | " + ((sortedHuffman[0].frequency + sortedHuffman[1].frequency)).ToString()).Attr.FillColor = Microsoft.Msagl.Drawing.Color.Red;
                    graph.FindNode((sortedHuffman[0].name + sortedHuffman[1].name) + " | " + ((sortedHuffman[0].frequency + sortedHuffman[1].frequency)).ToString()).Attr.Shape     = Microsoft.Msagl.Drawing.Shape.Circle;
                    sortedHuffman.Add(new HuffmanNode(sortedHuffman[0].name + sortedHuffman[1].name, sortedHuffman[0].frequency + sortedHuffman[1].frequency, sortedHuffman[0], sortedHuffman[1]));
                    sortedHuffman.RemoveAt(0);
                    sortedHuffman.RemoveAt(0);
                    sortedHuffman = sortHuffman(sortedHuffman);
                }
            }

            viewer.Graph = graph;
            form.SuspendLayout();
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;
            form.Controls.Add(viewer);
            form.ResumeLayout();
            form.ShowDialog();
        }