コード例 #1
0
ファイル: WavingFlags.cs プロジェクト: jpespartero/WorldWind
        private PictureBox CreatePictureBox(string imageUri, int x, int y, FormWidget parentForm)
        {
            PictureBox pictureBox = new PictureBox();
            pictureBox.Location = new System.Drawing.Point(x, y);
            pictureBox.ImageUri = imageUri;

            pictureBox.ParentWidget = parentForm;
            parentForm.ChildWidgets.Add(pictureBox);
            return pictureBox;
        }
コード例 #2
0
ファイル: WavingFlags.cs プロジェクト: jpespartero/WorldWind
        private void InitializeCiaForm()
        {
            m_ciaForm = new FormWidget("CIA World Fact Book");
            m_ciaForm.Anchor = WorldWind.NewWidgets.WidgetEnums.AnchorStyles.Right;
            m_ciaForm.ClientSize = new System.Drawing.Size(512, 384);

            // make it right aligned
            m_ciaForm.Location = new System.Drawing.Point(
                DrawArgs.ParentControl.Width - m_ciaForm.ClientSize.Width,
                DrawArgs.ParentControl.Height / 2 - m_ciaForm.ClientSize.Height / 2);

            m_ciaForm.BackgroundColor = System.Drawing.Color.FromArgb(0, 0, 0, 0);
            m_ciaForm.HeaderHeight = 0;
            m_ciaForm.HorizontalResizeEnabled = false;
            m_ciaForm.VerticalResizeEnabled = false;
            m_ciaForm.BorderEnabled = false;
            m_ciaForm.HorizontalScrollbarEnabled = false;
            m_ciaForm.VerticalScrollbarEnabled = false;

            m_bg_top = CreatePictureBox("Data\\Icons\\Interface\\bg-top.png", 0, 0, m_ciaForm);
            m_bg_middle = CreatePictureBox("Data\\Icons\\Interface\\bg-middle-extra.png", 0, 64, m_ciaForm);
            m_bg_bottom = CreatePictureBox("Data\\Icons\\Interface\\bg-bottom.png", 0, 320, m_ciaForm);

            int navOffset = 15;
            int navY = 329;

            m_nav_bar_up = CreatePictureBox("Data\\Icons\\Interface\\nav-bar-up.png", 0 * 32 + navOffset, navY, m_ciaForm);
            m_nav_bar_down = CreatePictureBox("Data\\Icons\\Interface\\nav-bar-down.png", 1 * 32 + navOffset, navY, m_ciaForm);

            m_nav_flag_up = CreatePictureBox("Data\\Icons\\Interface\\nav-flag-up.png", 2 * 32 + navOffset, navY, m_ciaForm);
            m_nav_flag_down = CreatePictureBox("Data\\Icons\\Interface\\nav-flag-down.png", 3 * 32 + navOffset, navY, m_ciaForm);
            
            int categoryOffset = 4 * 32 + navOffset + 32;

            m_category_introduction = CreatePictureBox("Data\\Icons\\Interface\\catagory-introduction.png", 0 * 32 + categoryOffset, navY, m_ciaForm);
            m_category_introduction.OnMouseUpEvent += new System.Windows.Forms.MouseEventHandler(m_category_introduction_OnMouseUpEvent);

            m_category_geography = CreatePictureBox("Data\\Icons\\Interface\\catagory-geography.png", 1 * 32 + categoryOffset, navY, m_ciaForm);
            m_category_geography.OnMouseUpEvent += new System.Windows.Forms.MouseEventHandler(m_category_geography_OnMouseUpEvent);
            
            m_category_people = CreatePictureBox("Data\\Icons\\Interface\\catagory-people.png", 2 * 32 + categoryOffset, navY, m_ciaForm);
            m_category_people.OnMouseUpEvent += new System.Windows.Forms.MouseEventHandler(m_category_people_OnMouseUpEvent);
            
            m_category_economy = CreatePictureBox("Data\\Icons\\Interface\\catagory-economy.png", 3 * 32 + categoryOffset, navY, m_ciaForm);
            m_category_economy.OnMouseUpEvent += new System.Windows.Forms.MouseEventHandler(m_category_economy_OnMouseUpEvent);
            
            m_category_communications = CreatePictureBox("Data\\Icons\\Interface\\catagory-communications.png", 4 * 32 + categoryOffset, navY, m_ciaForm);
            m_category_communications.OnMouseUpEvent += new System.Windows.Forms.MouseEventHandler(m_category_communications_OnMouseUpEvent);
            
            m_category_transportation = CreatePictureBox("Data\\Icons\\Interface\\catagory-transportation.png", 5 * 32 + categoryOffset, navY, m_ciaForm);
            m_category_transportation.OnMouseUpEvent += new System.Windows.Forms.MouseEventHandler(m_category_transportation_OnMouseUpEvent);
            
            m_category_military = CreatePictureBox("Data\\Icons\\Interface\\catagory-military.png", 6 * 32 + categoryOffset, navY, m_ciaForm);
            m_category_military.OnMouseUpEvent += new System.Windows.Forms.MouseEventHandler(m_category_military_OnMouseUpEvent);

            m_nav_left = CreatePictureBox("Data\\Icons\\Interface\\nav-left.png", 8 * 32 + categoryOffset, navY, m_ciaForm);
            m_nav_left.OnMouseUpEvent += new System.Windows.Forms.MouseEventHandler(m_nav_left_OnMouseUpEvent);
            
            m_nav_right = CreatePictureBox("Data\\Icons\\Interface\\nav-right.png", 9 * 32 + categoryOffset, navY, m_ciaForm);
            m_nav_right.OnMouseUpEvent += new System.Windows.Forms.MouseEventHandler(m_nav_right_OnMouseUpEvent);

            m_nav_close = CreatePictureBox("Data\\Icons\\Interface\\close.png", 16, 16, m_ciaForm);
            m_nav_close.OnMouseUpEvent += new System.Windows.Forms.MouseEventHandler(m_nav_close_OnMouseUpEvent);

            m_countryNameLabel = new TextLabel();
            m_countryNameLabel.Name = "CountryName";
            m_countryNameLabel.Text = "Country Name";
            m_countryNameLabel.ForeColor = System.Drawing.Color.FromArgb(37, 64, 71); // dark forest green
            m_countryNameLabel.Location = new System.Drawing.Point(75, 65);
            m_countryNameLabel.ClientSize = new System.Drawing.Size(m_ciaForm.ClientSize.Width - 100, 100);
            m_countryNameLabel.Font = new System.Drawing.Font("Ariel", 16.0f, System.Drawing.FontStyle.Bold);
            m_countryNameLabel.Alignment = Alignment.Right;

            m_currentCategoryLabel = new TextLabel();
            m_currentCategoryLabel.Name = "CurrentCategory";
            m_currentCategoryLabel.Text = "";
            m_currentCategoryLabel.ForeColor = System.Drawing.Color.FromArgb(37, 64, 71); // dark forest green
            m_currentCategoryLabel.Location = new System.Drawing.Point(75, 90);
            m_currentCategoryLabel.ClientSize = new System.Drawing.Size(m_ciaForm.ClientSize.Width - 100, 100);
            m_currentCategoryLabel.Font = new System.Drawing.Font("Ariel", 14.0f, System.Drawing.FontStyle.Regular);
            m_currentCategoryLabel.Alignment = Alignment.Right;

            m_currentBodyText = new TextLabel();
            m_currentBodyText.Name = "CurrentBodyText";
            m_currentBodyText.Text = "";
            m_currentBodyText.ForeColor = System.Drawing.Color.FromArgb(37, 64, 71); // dark forest green
            m_currentBodyText.Location = new System.Drawing.Point(25, 110);
            m_currentBodyText.ClientSize = new System.Drawing.Size(m_ciaForm.ClientSize.Width - 40, 220);
            m_currentBodyText.Font = new System.Drawing.Font("Ariel", 8.0f, System.Drawing.FontStyle.Regular);
            m_currentBodyText.WordBreak = true;

            int offsetY = m_currentBodyText.Location.Y + 5;
            
            m_listLabels = new TextLabel[10];
            for (int i = 0; i < m_listLabels.Length; i++)
            {
                m_listLabels[i] = new TextLabel();
                m_listLabels[i].ClientSize = new System.Drawing.Size(250, 14);
                m_listLabels[i].Location = new System.Drawing.Point(m_currentBodyText.Location.X, offsetY + i * m_listLabels[i].ClientSize.Height);
                m_listLabels[i].ForeColor = System.Drawing.Color.FromArgb(37, 64, 71);
                m_listLabels[i].Font = new System.Drawing.Font("Ariel", 10.0f, System.Drawing.FontStyle.Regular);
                m_listLabels[i].Visible = false;
                m_ciaForm.ChildWidgets.Add(m_listLabels[i]);
            }

            m_scrollbars = new Scrollbar[10];
            for (int i = 0; i < m_scrollbars.Length; i++)
            {
                m_scrollbars[i] = new Scrollbar();
                m_scrollbars[i].ClientSize = new System.Drawing.Size(150, 7);
                m_scrollbars[i].Location = new System.Drawing.Point(m_currentBodyText.Location.X + 265, m_listLabels[i].Location.Y + 2);
                m_scrollbars[i].ForeColor = System.Drawing.Color.DarkOrange;
                m_scrollbars[i].Value = 0.0f;
                m_scrollbars[i].Visible = false;
                m_ciaForm.ChildWidgets.Add(m_scrollbars[i]);
            }

            m_ciaForm.ChildWidgets.Add(m_countryNameLabel);
            m_ciaForm.ChildWidgets.Add(m_currentCategoryLabel);
            m_ciaForm.ChildWidgets.Add(m_currentBodyText);

            m_ciaForm.Visible = false;
            DrawArgs.NewRootWidget.ChildWidgets.Add(m_ciaForm);
            DrawArgs.ParentControl.Resize += new EventHandler(ParentControl_Resize);
        }