いつも大変お世話になっております。
また分かりにくい質問になってしまいます。
申し訳ございません。
picturebox1~4や別フォームのpictureboxから、graph.GLineという線を描くルーチンが呼び出されます。
「graph.GLine((float)Sx, (float)Sy, (float)Ex, (float)Ey);」は引数4つで設計しなければなりません。
描画先情報が含まれていると思われる、「PaintEventArgs e」は引数で渡せないこととなっております。
この場合、描画先を指定することはできますでしょうか?
お手数おかけして申し訳ございませんが、どなた様かご指導ご鞭撻の程よろしくお願い致します。
以下、プログラムソースとなります。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Collections;
using System.Drawing.Drawing2D;
namespace graph
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void pictureBox1_Paint(object sender, PaintEventArgs e) { float Sx=0; float Sy=0; float Ex=0; float Ey=0; Syokiti(ref Sx,ref Sy,ref Ex,ref Ey); graph.GLine((float)Sx, (float)Sy, (float)Ex, (float)Ey); } private void Syokiti( ref float _Sx, ref float _Sy, ref float _Ex, ref float _Ey) { _Sx = 10; _Sy = 10; _Ex = 100; _Ey = 100; } } class global { public static Pen PenData = new Pen(Color.White, 1); }
class graph
{
public static void GLine(float PtX1, float PtY1, float PtX2, float PtY2)
{
// Graphics g = // 書き込む場所を選択 PointF[] LinePoint = new PointF[2]; LinePoint[0] = new PointF(PtX1, PtY1); LinePoint[1] = new PointF(PtX2, PtY2); // g.DrawLine(global.PenData, LinePoint[0], LinePoint[1]); // エラー発生 } }
}
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/11/13 10:25
2015/11/13 10:32
2015/11/16 00:50