コード例 #1
0
ファイル: UserControl1.cs プロジェクト: maysam/ParsLogPlot
 private void sendtoback(VerbHoster.Verb v)
 {
     if (myc != null)
     {
         int i = 0;
         myCollection m = new myCollection();
         m.Add(this);
         for (i = 0; i < myc.Count ; i++)
             if (myc[i] != this)
                 m.Add(myc[i]);
         myc.Clear();
         for (i = 0; i < m.Count ; i++)
             myc.Add(m[i]);
     }
     if (mypic != null)
         mypic.Refresh();
 }
コード例 #2
0
ファイル: UserControl1.cs プロジェクト: maysam/ParsLogPlot
 public void sethostinfo(PictureBox pic, myCollection col)
 {
     myc = col;
     mypic = pic;
 }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: maysam/ParsLogPlot
 private void p_Paint(object sender, PaintEventArgs e)
 {
     String ta = ((PictureBox)sender).Tag.ToString();
     int c = Convert.ToInt32(ta);
     Rectangle rec = p[c].ClientRectangle;
     Color col = headerbox.BackColor; //ContainerControl.DefaultBackColor;
     col = Color.Red;
     col = Color.FromArgb(Math.Max(0, col.R - 5), Math.Max(0, col.G - 5), Math.Max(0, col.B - 5));
     if (c == ID)
     {
         e.Graphics.DrawRectangle(new Pen(Color.Pink, 3), rec);
         e.Graphics.DrawRectangle(new Pen(Color.Red, 1), rec);
         col = Color.LightPink;
         rec.Inflate(-1, -1);
         e.Graphics.DrawRectangle(new Pen(Color.Pink, 1), rec);
     }
     else
     {
         rec.Inflate(-1, -1);
         e.Graphics.DrawRectangle(new Pen(Color.Pink, 1), rec);
         rec.Inflate(1, 1);
         rec.Offset(-1, -1);
         e.Graphics.DrawRectangle(new Pen(Color.Red, 1), rec);
         col = Color.Salmon;
     }
     e.Graphics.FillRectangle(new SolidBrush(col), rec);
     //            e.Graphics.DrawString(u[c].Name + "(" + u[c].redrawcount.ToString() + ")", new Font(FontFamily.GenericSansSerif, 8), Brushes.Black, 10f, 10f);
     string header = "null " + c.ToString();
     if (u[c] != null)
     {
         header = u[c].Name;
         if (u[c].Type == ColumnType.ScaleBar)
         {
             if (((ScaleBarColumn)u[c]).Measure == MEASURE.Foot)
                 header += "(f)";
             else
                 header += "(m)";
         }
     }
     int i = 20;
     Font _f = new Font(FontFamily.GenericSansSerif, i);
     Size s = TextRenderer.MeasureText(header, _f);
     while (((s.Width > rec.Width) | (s.Height > rec.Height)) & i > 7)
     {
         i--;
         _f = new Font(FontFamily.GenericSansSerif, i);
         s = TextRenderer.MeasureText(header, _f, new Size(p[c].ClientRectangle.Width, p[c].ClientRectangle.Height));
     }
     int x = (rec.Width - s.Width) / 2;
     int y = (rec.Height - s.Height) / 2;
     e.Graphics.DrawString(header, _f, Brushes.Black, new RectangleF(0, 0, p[c].ClientRectangle.Width, p[c].ClientRectangle.Height));
 }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: maysam/ParsLogPlot
        private void toolStripComboBox2_Click(object sender, EventArgs e)
        {
            switch (toolStripComboBox2.SelectedIndex)
            {
                case 0:
                    splitContainer1.Panel2Collapsed = false;
                    toolStrip1.Visible = true;
                    splitContainer2.Panel2Collapsed = false;
                    splitContainer3.Panel2Collapsed = true;
                    splitContainer4.Panel1Collapsed = false;
                    splitContainer4.Panel2Collapsed = true;
                    break;
                case 1:
                    splitContainer1.Panel2Collapsed = false;
                    toolStrip1.Visible = true;
                    splitContainer2.Panel2Collapsed = false;
                    splitContainer3.Panel2Collapsed = true;
                    splitContainer4.Panel1Collapsed = true;
                    splitContainer4.Panel2Collapsed = false;
                    break;
                case 2:
                    splitContainer1.Panel2Collapsed = false;
                    toolStrip1.Visible = true;
                    splitContainer2.Panel2Collapsed = false;
                    splitContainer3.Panel2Collapsed = true;
                    splitContainer4.Panel1Collapsed = false;
                    splitContainer4.Panel2Collapsed = false;
                    break;
                case 3:
                    if (infooter)
                        footer = userControl11.collection;
                    userControl11.collection = header;
                    infooter = false;
                    inheader = true;

                    splitContainer1.Panel2Collapsed = true;
                    toolStrip1.Visible = false;
                    splitContainer2.Panel2Collapsed = true;
                    splitContainer3.Panel2Collapsed = false;
                    break;
                case 4:
                    if (inheader)
                        header = userControl11.collection;
                    userControl11.collection = footer;
                    inheader = false;
                    infooter = true;

                    splitContainer1.Panel2Collapsed = true;
                    toolStrip1.Visible = false;
                    splitContainer2.Panel2Collapsed = true;
                    splitContainer3.Panel2Collapsed = false;
                    break;
            }
        }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: maysam/ParsLogPlot
        private void initializingthread_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                this.messageTableAdapter.Fill(this.logplotDataSet1.message);
                this.configurationTableAdapter.Fill(this.logplotDataSet1.configuration);
                this.fossilTableAdapter.Fill(this.logplotDataSet1.fossil);
                this.seaTableAdapter.Fill(this.logplotDataSet1.sea);
                this.tadpoleTableAdapter.Fill(this.logplotDataSet1.tadpole);
                this.wellTableAdapter.Fill(this.logplotDataSet1.well);
                this.percentTableAdapter.Fill(this.logplotDataSet1.percent);

                this.lithologyTableAdapter.Fill(this.logplotDataSet1.lithology);
                this.crossplotTableAdapter.Fill(this.logplotDataSet1.crossplot);
                this.bitmapTableAdapter.Fill(this.logplotDataSet1.bitmap);
                this.textTableAdapter.Fill(this.logplotDataSet1.text);
                this.symbolTableAdapter.Fill(this.logplotDataSet1.symbol);
                this.horizontalTableAdapter.Fill(this.logplotDataSet1.horizontal);
                this.fillTableAdapter.Fill(this.logplotDataSet1.fill);
                this.curveTableAdapter.Fill(this.logplotDataSet1.curve);
                this.entityTableAdapter.Fill(this.logplotDataSet1.entity);
                this.histogramTableAdapter.Fill(this.logplotDataSet1.histogram);
            }
            catch
            {
            }
            bs[0] = entitylithologyBindingSource;
            bs[1] = entitylithologyBindingSource;
            bs[2] = null;
            bs[3] = entitycurveBindingSource;
            bs[4] = entitycrossplotBindingSource;
            bs[5] = entitypercentBindingSource;
            bs[6] = entityhistogramBindingSource;
            bs[7] = entityhistogramBindingSource;
            bs[8] = entitytextBindingSource;
            bs[9] = entitytextBindingSource;
            bs[10] = entitysymbolBindingSource;
            bs[11] = entityfillBindingSource;
            bs[12] = entitybitmapBindingSource;
            bs[13] = entitywellBindingSource;
            bs[14] = null;
            bs[15] = null;
            bs[16] = entitytadpoleBindingSource;
            bs[17] = null;
            bs[18] = entityfossilBindingSource;
            bs[19] = entityseaBindingSource;

            dataGridView1.AutoGenerateColumns = true;
            count = -1;
            logplotDataSet1.entityDataTable dt = entityTableAdapter.GetData();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                try
                {
                    logplotDataSet1.entityRow dr = (logplotDataSet1.entityRow)dt.Rows[i];
                    if (dr.savedata == "")
                        continue;
                    count++;
                    p[count] = CreateHeader(count, 0);
                    XmlSerializer serializer = new XmlSerializer(getType((ColumnType)dr.type));
                    MemoryStream ms = new MemoryStream();
                    byte[] bys = new byte[dr.savedata.Length];
                    ASCIIEncoding a = new ASCIIEncoding();
                    bys = a.GetBytes(dr.savedata);
                    ms.Write(bys, 0, dr.savedata.Length);
                    ms.Position = 0;
                    object o = serializer.Deserialize(ms);
                    switch (dr.type)
                    {
                        case (short)ColumnType.Histogram:
                            u[count] = (HistogramColumn)o;
                            break;
                        case (short)ColumnType.Curve:
                            u[count] = (CurveColumn)o;
                            break;
                        case (short)ColumnType.Tadpole:
                            u[count] = (TadpoleColumn)o;
                            break;
                        case (short)ColumnType.Bitmap:
                            u[count] = (BitmapColumn)o;
                            break;
                        case (short)ColumnType.CrossPlotCurve:
                            u[count] = (CrossPlotCurveColumn)o;
                            break;
                        case (short)ColumnType.LithologyPattern:
                            u[count] = (LithologyColumn)o;
                            break;
                        case (short)ColumnType.Percent:
                            u[count] = (PercentColumn)o;
                            break;
                        case (short)ColumnType.ScaleBar:
                            u[count] = (ScaleBarColumn)o;
                            break;
                        case (short)ColumnType.Symbol:
                            u[count] = (SymbolColumn)o;
                            break;
                        default:
                            u[count] = (Column)o;
                            break;
                    }
                    if (u[count] == null)
                        u[count] = getColumn((ColumnType)dr.type);
                    ms.Position = 0;
                    u[count].entity = dr.id;
                    u[count].lds = logplotDataSet1;
                    u[count].position = count;
                    dr.column = i;
                    dr.name = u[count].Name;
                    p[i].SetBounds(u[i].Left, 0, u[i].Width, 0, BoundsSpecified.X | BoundsSpecified.Width);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);

                }
            }
            for (int i = 0; i <= count; i++)
                if (u[i] != null)
                    if (u[i] is LithologyColumn)
                    {
                        LithologyColumn lc = (LithologyColumn)u[i];
                        lc.cc = null;
                        for (int j = 0; j < count; j++)
                            if (u[j] is CurveColumn)
                                if (lc.ProfileCurve.Equals(u[j].Name))
                                {
                                    lc.cc = (CurveColumn)u[j];
                                    break;
                                }
                    }
            try
            {
                TOP = Int32.Parse(((logplotDataSet1.configurationRow)logplotDataSet1.configuration.Rows[0]).value);
                BASE = Int32.Parse(((logplotDataSet1.configurationRow)logplotDataSet1.configuration.Rows[1]).value);
                WIDTH = Int32.Parse(((logplotDataSet1.configurationRow)logplotDataSet1.configuration.Rows[2]).value);
                AUTHOR = ((logplotDataSet1.configurationRow)logplotDataSet1.configuration.Rows[3]).value;

                XmlSerializer ser = new XmlSerializer(typeof(myCollection));
                string abc;
                TextReader reader;
                try
                {
                    abc = ((logplotDataSet1.configurationRow)logplotDataSet1.configuration.Rows[4]).value;
                    reader = new StringReader(abc);
                    header = (myCollection)ser.Deserialize(reader);
                    foreach (myobject o in header)
                        o.unselect();
                }
                catch { }
                try
                {
                    abc = ((logplotDataSet1.configurationRow)logplotDataSet1.configuration.Rows[5]).value;
                    reader = new StringReader(abc);

                    footer = (myCollection)ser.Deserialize(reader);
                    foreach (myobject o in footer)
                        o.unselect();
                }
                catch { }

                Calibration = Convert.ToInt32(((logplotDataSet1.configurationRow)logplotDataSet1.configuration.Rows[6]).value);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }