⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trackbar.txt

📁 c#写的改变trackbar大小
💻 TXT
字号:
	sd_sunjing@126.com;sd_sunjing@163.com;sd_sunjing@qq.com;sunsteven888@gmail.com;sun_jing@21cn.com



医学波形格式编码


医学波形格式编码规则MFER的解析和实现
张立东 段会龙
浙江大学生物医学工程与仪器科学学院教育部生物医学工程重点实验室,浙江杭州31002



trackBar1


public int ToInt(double pf1, double pf2)
        {
            int it=(int)(pf1/pf2);
            if (pf1 / pf2 - it > 0.5)
                it = it + 1;
            return it;
        }
 private void trackBar1_Scroll(object sender, EventArgs e)
        {
            
            this.label1.Text = "温度的上限:" + this.trackBar1.Value.ToString();
            if (this.trackBar1.Value < this.trackBar2.Value)
            {
                this.trackBar2.Value = this.trackBar1.Value;
                this.label2.Text = this.trackBar2.Value.ToString();
            } 
            Graphics g = this.CreateGraphics();   //两个都要画,最后画两则之间的
            SolidBrush sb = new SolidBrush(Color.Blue);
            g.FillRectangle(sb, 0,7, 279, 4);
            
            //调色板IronTable1[255 ]对应最低温度TMin,IronTable1[0]对应最高温度TMax,这里假设TMin=0,TMax=100,f=100.0/256要算的
            //图像温度TTmax,TTmin,这里假设TTmax=79.6,TTmin=16.4
           /* double TTmax=79.6,TTmin=16.4;
            //double f=(TTmax-TTmin )/256;
            double tmax=Convert.ToDouble(this .trackBar1 .Value );//tmax,tmin是用户调节的最高,低温度
            double tmin = Convert.ToDouble(this .trackBar2 .Value );
            double f = (tmax - tmin) / 256;
            int[,] colortable = new int[256,3];   //为了保留原调色板的值新建一个数组
            for (int i = 0; i < 256; i++)
            {
                colortable[i, 0] = IronTable1[i, 0];
                colortable[i, 1] = IronTable1[i, 1];
                colortable[i, 2] = IronTable1[i, 2];
            }
            if (tmax < TTmax&tmax >TTmin )
            {
                int t = 256 - ToInt((tmax - TTmin), f);
                for (int i = 0; i < t; i++)
                {
                    colortable[i, 0] = colortable[0, 0];
                    colortable[i, 1] = colortable[0,1];
                    colortable[i, 2] = colortable[0, 2];
                }
            }
            if (tmax > TTmax)
            {
                int t = 256 - ToInt((tmax - TTmin), f);
                for (int i = 0; i < t; i++)
                {
                    colortable[i, 0] = colortable[t-1, 0];
                    colortable[i, 1] = colortable[t-1, 1];
                    colortable[i, 2] = colortable[t-1, 2];
                }
            }
            if (tmin < TTmin)
            {
                int t = ToInt(TTmin - tmin, f);
                if (t > 256)  
                    t = 256;
                for (int i = 0; i < t; i++)
                {
                    colortable[255 - i, 0] = colortable[255, 0];
                    colortable[255 - i, 1] = colortable[255, 1];
                    colortable[255 - i,2] = colortable[255, 2];
                }
            }
            if (tmin >TTmin&tmin <TTmax )
            {
                int t = ToInt(TTmin - tmin, f);
                
                for (int i = 0; i < t; i++)
                {
                    colortable[255 - i, 0] = colortable[256-t, 0];
                    colortable[255 - i, 1] = colortable[256-t, 1];
                    colortable[255 - i, 2] = colortable[256-t, 2];
                }
            }
            Bitmap nbitmap = (Bitmap)this.pictureBox1.Image;//新图像
            ColorPalette pal = this.pictureBox1.Image.Palette;
            for (int i = 0; i < 256; i++)
            {
                pal.Entries[i] = Color.FromArgb(colortable[i, 0], colortable[i, 1], colortable[i, 2]);
            }
            nbitmap.Palette = pal;
            this.pictureBox1.Image = nbitmap;
           // this.pictureBox1.Refresh();
            this.pictureBox3.Refresh();
            Graphics g = this.pictureBox3.CreateGraphics();
            Pen pen = new Pen(Color.Red , 2);
            g.DrawLine(pen, 7, 0, 7,200);*/
           
          
        }

        private void trackBar2_Scroll(object sender, EventArgs e)
        {
            this.label2.Text = "温度的下限:" + this.trackBar2.Value.ToString();        //滑块的移动取值与显示
            if (this.trackBar2.Value > this.trackBar1.Value)
            {
                this.trackBar1.Value = this.trackBar2.Value;
                this.label1.Text = this.trackBar1.Value.ToString();
            }
            
            double TTmax = 79.6, TTmin = 16.4;
            //double f = (TTmax - TTmin) / 256;
            double tmax=Convert.ToDouble(this .trackBar1 .Value );//tmax,tmin是用户调节的最高,低温度
            double tmin=Convert.ToDouble(this.trackBar2 .Value );
            double f=(tmax -tmin )/256;
           // ColorPalette pal = this.pictureBox1.Image.Palette;
           // for (double t = tmin; t < tmax;t=t+f )
           // {
              // t+273.3
 
            //}
            int[,] colortable = new int[256, 3];   //为了保留原调色板的值新建一个数组
            for (int i = 0; i < 256; i++)
            {
                colortable[i, 0] = IronTable1[i, 0];
                colortable[i, 1] = IronTable1[i, 1];
                colortable[i, 2] = IronTable1[i, 2];
            }
            if (tmax < TTmax&tmax >TTmin )
            {
                int t = 256 - ToInt((tmax - TTmin), f);
                
                for (int i = 0; i < t; i++)
                {
                    colortable[i, 0] = colortable[0, 0];
                    colortable[i, 1] = colortable[0, 1];
                    colortable[i, 2] = colortable[0, 2];
                }
            }
            if (tmax > TTmax)
            {
                int t = 256 - ToInt((tmax - TTmin), f);
                
                for (int i = 0; i < t; i++)
                {
                    colortable[i, 0] = colortable[t, 0];
                    colortable[i, 1] = colortable[t, 1];
                    colortable[i, 2] = colortable[t, 2];
                }
            }
            if (tmin < TTmin)
            {
                int t = ToInt(TTmin - tmin, f);
                
                for (int i = 0; i < t; i++)
                {
                    colortable[255 - i, 0] = colortable[255, 0];
                    colortable[255 - i, 1] = colortable[255, 1];
                    colortable[255 - i, 2] = colortable[255, 2];
                }
            }
            if (tmin > TTmin&tmin <TTmax )
            {
                int t = ToInt(TTmin - tmin, f);
                
                for (int i = 0; i < t; i++)
                {
                    colortable[255 - i, 0] = colortable[256 - t, 0];
                    colortable[255 - i, 1] = colortable[256 - t, 1];
                    colortable[255 - i, 2] = colortable[256 - t, 2];
                }
            }
            Bitmap nbitmap = (Bitmap)this.pictureBox1.Image;   //新建一个图像 
            ColorPalette pal = this.pictureBox1.Image.Palette;
           for (int i = 0; i < 256; i++)
           {
                pal.Entries[i] = Color.FromArgb(colortable[i, 0], colortable[i, 1], colortable[i, 2]);
           }
            nbitmap.Palette = pal;
            this.pictureBox1.Image = nbitmap;             //图像重新显示
            this.pictureBox1.Refresh();
            this.pictureBox3.Refresh();
            Graphics g = this.pictureBox3.CreateGraphics();
            Pen pen = new Pen(Color.Green , 2);
            g.DrawLine(pen, 7, 0, 7, 150);
            
        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -