コード例 #1
0
        public TrackViewer()
        {
            int w = (600 / 2) - 12 - 6, h = 400 - 12 - 11;

            listView = new ObjectListView
            {
                FullRowSelect      = true,
                HeaderStyle        = ColumnHeaderStyle.Nonclickable,
                HideSelection      = false,
                Location           = new Point(12, 12),
                MultiSelect        = false,
                RowFormatter       = RowColorer,
                ShowGroups         = false,
                Size               = new Size(w, h),
                UseFiltering       = true,
                UseFilterIndicator = true
            };
            OLVColumn c1, c2, c3, c4;

            c1 = new OLVColumn(Strings.TrackViewerEvent, "Command.Label");
            c2 = new OLVColumn(Strings.TrackViewerArguments, "Command.Arguments")
            {
                UseFiltering = false
            };
            c3 = new OLVColumn(Strings.TrackViewerOffset, "Offset")
            {
                AspectToStringFormat = "0x{0:X}", UseFiltering = false
            };
            c4 = new OLVColumn(Strings.TrackViewerTicks, "Ticks")
            {
                AspectGetter = (o) => string.Join(", ", ((SongEvent)o).Ticks), UseFiltering = false
            };
            c1.Width     = c2.Width = c3.Width = 72;
            c4.Width     = 47;
            c1.Hideable  = c2.Hideable = c3.Hideable = c4.Hideable = false;
            c1.TextAlign = c2.TextAlign = c3.TextAlign = c4.TextAlign = HorizontalAlignment.Center;
            listView.AllColumns.AddRange(new OLVColumn[] { c1, c2, c3, c4 });
            listView.RebuildColumns();
            listView.ItemActivate += ListView_ItemActivate;

            var panel1 = new ThemedPanel {
                Location = new Point(306, 12), Size = new Size(w, h)
            };

            tracksBox = new ComboBox
            {
                Enabled  = false,
                Location = new Point(4, 4),
                Size     = new Size(100, 21)
            };
            tracksBox.SelectedIndexChanged += (o, e) => LoadTrack(tracksBox.SelectedIndex);
            panel1.Controls.AddRange(new Control[] { tracksBox });

            ClientSize = new Size(600, 400);
            Controls.AddRange(new Control[] { listView, panel1 });
            FormBorderStyle = FormBorderStyle.FixedDialog;
            MaximizeBox     = false;
            Text            = $"{Utils.ProgramName} ― {Strings.TrackViewerTitle}";

            UpdateTracks();
        }
コード例 #2
0
 void InitializeComponent()
 {
     components         = new Container();
     button1            = new ThemedButton();
     richTextBoxMessage = new ThemedRichTextBox();
     FlexibleMessageBoxFormBindingSource = new BindingSource(components);
     panel1            = new ThemedPanel();
     pictureBoxForIcon = new PictureBox();
     button2           = new ThemedButton();
     button3           = new ThemedButton();
     ((ISupportInitialize)(FlexibleMessageBoxFormBindingSource)).BeginInit();
     panel1.SuspendLayout();
     ((ISupportInitialize)(pictureBoxForIcon)).BeginInit();
     SuspendLayout();
     //
     // button1
     //
     button1.Anchor                  = AnchorStyles.Bottom | AnchorStyles.Right;
     button1.AutoSize                = true;
     button1.DialogResult            = DialogResult.OK;
     button1.Location                = new Point(11, 67);
     button1.MinimumSize             = new Size(0, 24);
     button1.Name                    = "button1";
     button1.Size                    = new Size(75, 24);
     button1.TabIndex                = 2;
     button1.Text                    = "OK";
     button1.UseVisualStyleBackColor = true;
     button1.Visible                 = false;
     //
     // richTextBoxMessage
     //
     richTextBoxMessage.Anchor = (((AnchorStyles.Top | AnchorStyles.Bottom)
                                   | AnchorStyles.Left)
                                  | AnchorStyles.Right);
     richTextBoxMessage.BorderStyle = BorderStyle.None;
     richTextBoxMessage.DataBindings.Add(new Binding("Text", FlexibleMessageBoxFormBindingSource, "MessageText", true, DataSourceUpdateMode.OnPropertyChanged));
     richTextBoxMessage.Font         = new Font(Theme.Font.FontFamily, 9);
     richTextBoxMessage.Location     = new Point(50, 26);
     richTextBoxMessage.Margin       = new Padding(0);
     richTextBoxMessage.Name         = "richTextBoxMessage";
     richTextBoxMessage.ReadOnly     = true;
     richTextBoxMessage.ScrollBars   = RichTextBoxScrollBars.Vertical;
     richTextBoxMessage.Size         = new Size(200, 20);
     richTextBoxMessage.TabIndex     = 0;
     richTextBoxMessage.TabStop      = false;
     richTextBoxMessage.Text         = "<Message>";
     richTextBoxMessage.LinkClicked += new LinkClickedEventHandler(LinkClicked);
     //
     // panel1
     //
     panel1.Anchor = (((AnchorStyles.Top | AnchorStyles.Bottom)
                       | AnchorStyles.Left)
                      | AnchorStyles.Right);
     panel1.Controls.Add(pictureBoxForIcon);
     panel1.Controls.Add(richTextBoxMessage);
     panel1.Location = new Point(-3, -4);
     panel1.Name     = "panel1";
     panel1.Size     = new Size(268, 59);
     panel1.TabIndex = 1;
     //
     // pictureBoxForIcon
     //
     pictureBoxForIcon.BackColor = Color.Transparent;
     pictureBoxForIcon.Location  = new Point(15, 19);
     pictureBoxForIcon.Name      = "pictureBoxForIcon";
     pictureBoxForIcon.Size      = new Size(32, 32);
     pictureBoxForIcon.TabIndex  = 8;
     pictureBoxForIcon.TabStop   = false;
     //
     // button2
     //
     button2.Anchor                  = (AnchorStyles.Bottom | AnchorStyles.Right);
     button2.DialogResult            = DialogResult.OK;
     button2.Location                = new Point(92, 67);
     button2.MinimumSize             = new Size(0, 24);
     button2.Name                    = "button2";
     button2.Size                    = new Size(75, 24);
     button2.TabIndex                = 3;
     button2.Text                    = "OK";
     button2.UseVisualStyleBackColor = true;
     button2.Visible                 = false;
     //
     // button3
     //
     button3.Anchor                  = (AnchorStyles.Bottom | AnchorStyles.Right);
     button3.AutoSize                = true;
     button3.DialogResult            = DialogResult.OK;
     button3.Location                = new Point(173, 67);
     button3.MinimumSize             = new Size(0, 24);
     button3.Name                    = "button3";
     button3.Size                    = new Size(75, 24);
     button3.TabIndex                = 0;
     button3.Text                    = "OK";
     button3.UseVisualStyleBackColor = true;
     button3.Visible                 = false;
     //
     // FlexibleMessageBoxForm
     //
     AutoScaleDimensions = new SizeF(6F, 13F);
     AutoScaleMode       = AutoScaleMode.Font;
     ClientSize          = new Size(260, 102);
     Controls.Add(button3);
     Controls.Add(button2);
     Controls.Add(panel1);
     Controls.Add(button1);
     DataBindings.Add(new Binding("Text", FlexibleMessageBoxFormBindingSource, "CaptionText", true));
     Icon          = Properties.Resources.Icon;
     MaximizeBox   = false;
     MinimizeBox   = false;
     MinimumSize   = new Size(276, 140);
     Name          = "FlexibleMessageBoxForm";
     SizeGripStyle = SizeGripStyle.Show;
     StartPosition = FormStartPosition.CenterParent;
     Text          = "<Caption>";
     Shown        += new EventHandler(FlexibleMessageBoxForm_Shown);
     ((ISupportInitialize)(FlexibleMessageBoxFormBindingSource)).EndInit();
     panel1.ResumeLayout(false);
     ((ISupportInitialize)(pictureBoxForIcon)).EndInit();
     ResumeLayout(false);
     PerformLayout();
 }