我有 Windows表单应用程序。表单上有2个标准控件linklabel
和reportviewer
。 reportViewer
控件上显示的数据有时会很长,并且可能会进行一些滚动以保留所有数据以供阅读。这是正常情况。
但我需要简单的功能,当用户向上或向下滚动时,linkLabel
应该依赖滚动值向上或向下移动,同步reportViewer
内容。 LinkLabel位置必须相对固定reportViewer
包含InitializeComponent方法:
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HRCard));
this.reportViewer1 = new Microsoft.Reporting.WinForms.ReportViewer();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.SuspendLayout();
//
// reportViewer1
//
this.reportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.reportViewer1.LocalReport.ReportEmbeddedResource = "Kadr_Azerenerji.Report1.rdlc";
this.reportViewer1.Location = new System.Drawing.Point(0, 0);
this.reportViewer1.Name = "reportViewer1";
this.reportViewer1.Size = new System.Drawing.Size(1020, 730);
this.reportViewer1.TabIndex = 0;
this.reportViewer1.RenderingComplete += new Microsoft.Reporting.WinForms.RenderingCompleteEventHandler(this.reportViewer1_RenderingComplete);
this.reportViewer1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.reportViewer1_Scroll);
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(160, 314);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(45, 15);
this.linkLabel1.TabIndex = 2;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "Diplom";
this.linkLabel1.Visible = false;
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// HRCard
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1020, 730);
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.reportViewer1);
this.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "HRCard";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Azərenerji Kadr";
this.TransparencyKey = System.Drawing.Color.LavenderBlush;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HRCard_FormClosing);
this.Load += new System.EventHandler(this.HRCard_Load);
this.Scroll += new System.Windows.Forms.ScrollEventHandler(this.HRCard_Scroll);
this.ResumeLayout(false);
this.PerformLayout();
我该怎么做?