📄 190structuredlg.cpp
字号:
// 190structureDlg.cpp : implementation file
//
#include "stdafx.h"
#include "190structure.h"
#include "190structureDlg.h"
#include "math.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
void Gauss(double a[], int n, double b[]);
void SolveEdge1();
void SolveEdge2();
void SolveEdge3();
void SolveEdge4();
struct element
{
int series;
int locolorder;
double length;
double toughness;
double js;
double jd;
double bs;
double bd;
double leftmoment;
double leftforce;
double rightmoment;
double rightforce;
double localk[7][7];
int location[7];
}ELEMENT[31];
int NUMBER; //总跨数
int NOWSEQUENCE=1; //当前序号
int EDGECONDITION; //边界条件
static double K[31][31]; //未经修正的整体刚度矩阵
int POINTORDER[31]; //结点编码
static double FP[31]; //固端约束力
static double P[31]; //等效结点荷载
static double AG[31]; //结点转角
static double KS[963];
char SEQUENCE[50]; //给序号编辑框
char INPUTRESULT[3000]; //给输入结果编辑框
char OUTPUTANGLE[3000];
char a[10]="第";
char b[10]="单元";
char c[10]=" ";
char d[10]="长度(m):";
char e[30]="抗弯刚度EI(kN*m):";
char f1[40]="集中荷载(位置:m))";
char f2[40]="(大小:kN/m):";
char g1[40]="均布荷载(截止位置:m):)";
char g2[40]="(大小:kN/m):";
char h[10]="\n";
char i[30]="结点转角位移:";
char j[40]="单元杆端弯矩(kN*m):";
char k[40]="单元杆端剪力(kN):";
char l[40]="结点转角(rad)";
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMy190structureDlg dialog
CMy190structureDlg::CMy190structureDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMy190structureDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMy190structureDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMy190structureDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMy190structureDlg)
DDX_Control(pDX, IDC_4NEXTPOINT_BUTTON, m_4NextpointButton);
DDX_Control(pDX, IDC_3NOMODIFY_BUTTON2, m_3NomodifyButton);
DDX_Control(pDX, IDC_6DETAIL_BUTTON, m_6DetailButton);
DDX_Control(pDX, IDC_2JD_EDIT, m_2JdEdit);
DDX_Control(pDX, IDC_3MODIFY_BUTTON, m_3ModifyButton);
DDX_Control(pDX, IDC_3FINISH_BUTTON, m_3FinishButton);
DDX_Control(pDX, IDC_6DESIGNER_BUTTON, m_5DesignerButton);
DDX_Control(pDX, IDC_6EXIT_BUTTON, m_6ExitButton);
DDX_Control(pDX, IDC_6NEW_BUTTON, m_6NewButton);
DDX_Control(pDX, IDC_6SOLVE_BUTTON, m_6SolveButton);
DDX_Control(pDX, IDC_6TOPIC_BUTTON, m_6TopicButton);
DDX_Control(pDX, IDC_4CODE_EDIT, m_4CodeEdit);
DDX_Control(pDX, IDC_3SEQUENCE_EDIT, m_3SequenceEdit);
DDX_Control(pDX, IDC_2TOUGH_EDIT, m_2ToughEdit);
DDX_Control(pDX, IDC_7CELL_EDIT, m_7CellEdit);
DDX_Control(pDX, IDC_5RESULT_EDIT, m_5ResultEdit);
DDX_Control(pDX, IDC_7JUNCTION_EDIT, m_7JunctionEdit);
DDX_Control(pDX, IDC_2SEQUENCE_EDIT, m_2SequenceEdit);
DDX_Control(pDX, IDC_2LENGTH_EDIT, m_2LengthEdit);
DDX_Control(pDX, IDC_2NEXT_BUTTON, m_2NextButton);
DDX_Control(pDX, IDC_2JS_EDIT, m_2JsEdit);
DDX_Control(pDX, IDC_2FINISH_BUTTON, m_2FinishButton);
DDX_Control(pDX, IDC_2CELL_EDIT, m_2CellEdit);
DDX_Control(pDX, IDC_2BS_EDIT, m_2BsEdit);
DDX_Control(pDX, IDC_2BD_EDIT, m_2BdEdit);
DDX_Control(pDX, IDC_1LJ_RADIO, m_1LjRadio);
DDX_Control(pDX, IDC_1FINISH_BUTTON, m_1FinishButton);
DDX_Control(pDX, IDC_1CHANGE_BUTTON, m_1ChangeButton);
DDX_Control(pDX, IDC_1RJ_RADIO, m_1RjRadio);
DDX_Control(pDX, IDC_1NUMBER_EDIT, m_1NumberEdit);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMy190structureDlg, CDialog)
//{{AFX_MSG_MAP(CMy190structureDlg)
ON_WM_SYSCOMMAND()
ON_WM_DESTROY()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_6TOPIC_BUTTON, On6topicButton)
ON_BN_CLICKED(IDC_6DETAIL_BUTTON, On6detailButton)
ON_BN_CLICKED(IDC_6DESIGNER_BUTTON, On6designerButton)
ON_BN_CLICKED(IDC_6EXIT_BUTTON, On6exitButton)
ON_BN_CLICKED(IDC_6NEW_BUTTON, On6newButton)
ON_COMMAND(IDC_0DESIGNER_MENU, On0designerMenu)
ON_COMMAND(IDC_0EXIT_MENU, On0exitMenu)
ON_COMMAND(IDC_0TOPIC_MENU, On0topicMenu)
ON_COMMAND(IDC_0DETAIL_MENU, On0detailMenu)
ON_COMMAND(IDC_0NEW_MENU, On0newMenu)
ON_BN_CLICKED(IDC_1FINISH_BUTTON, On1finishButton)
ON_BN_CLICKED(IDC_1CHANGE_BUTTON, On1changeButton)
ON_BN_CLICKED(IDC_2NEXT_BUTTON, On2nextButton)
ON_BN_CLICKED(IDC_2FINISH_BUTTON, On2finishButton)
ON_BN_CLICKED(IDC_3NOMODIFY_BUTTON2, On3nomodifyButton2)
ON_BN_CLICKED(IDC_4NEXTPOINT_BUTTON, On4nextpointButton)
ON_BN_CLICKED(IDC_6SOLVE_BUTTON, On6solveButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMy190structureDlg message handlers
BOOL CMy190structureDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
//
NOWSEQUENCE=1;
m_1NumberEdit.SetSel(0,-1);
m_1NumberEdit.ReplaceSel("");
m_1NumberEdit.EnableWindow(TRUE);
m_1FinishButton.EnableWindow(TRUE);
//
GetDlgItem(IDC_1LJ_RADIO)->EnableWindow(TRUE);
GetDlgItem(IDC_1LG_RADIO)->EnableWindow(TRUE);
GetDlgItem(IDC_1RJ_RADIO)->EnableWindow(TRUE);
GetDlgItem(IDC_1RG_RADIO)->EnableWindow(TRUE);
CheckRadioButton(IDC_1LJ_RADIO,IDC_1LG_RADIO,IDC_1LJ_RADIO);
CheckRadioButton(IDC_1RJ_RADIO,IDC_1RG_RADIO,IDC_1RG_RADIO);
m_1ChangeButton.EnableWindow(FALSE);
m_2FinishButton.EnableWindow(FALSE);
m_2NextButton.EnableWindow(FALSE);
m_3ModifyButton.EnableWindow(FALSE);
m_3NomodifyButton.EnableWindow(FALSE);
m_3FinishButton.EnableWindow(FALSE);
m_4NextpointButton.EnableWindow(FALSE);
m_6SolveButton.EnableWindow(FALSE);
//2cell part
m_2CellEdit.SetSel(0,-1);
m_2CellEdit.ReplaceSel("");
m_2CellEdit.EnableWindow(FALSE);
//
m_2LengthEdit.SetSel(0,-1);
m_2LengthEdit.ReplaceSel("");
m_2LengthEdit.EnableWindow(FALSE);
//
m_2ToughEdit.SetSel(0,-1);
m_2ToughEdit.ReplaceSel("");
m_2ToughEdit.EnableWindow(FALSE);
//
m_2JsEdit.SetSel(0,-1);
m_2JsEdit.ReplaceSel("0");
m_2JsEdit.EnableWindow(FALSE);
//
m_2JdEdit.SetSel(0,-1);
m_2JdEdit.ReplaceSel("0");
m_2JdEdit.EnableWindow(FALSE);
//
m_2BsEdit.SetSel(0,-1);
m_2BsEdit.ReplaceSel("0");
m_2BsEdit.EnableWindow(FALSE);
//
m_2BdEdit.SetSel(0,-1);
m_2BdEdit.ReplaceSel("0");
m_2BdEdit.EnableWindow(FALSE);
//
m_2SequenceEdit.SetSel(0,-1);
m_2SequenceEdit.ReplaceSel("");
m_2SequenceEdit.EnableWindow(FALSE);
//
m_3SequenceEdit.SetSel(0,-1);
m_3SequenceEdit.ReplaceSel("");
m_3SequenceEdit.EnableWindow(FALSE);
//
m_4CodeEdit.SetSel(0,-1);
m_4CodeEdit.ReplaceSel("");
m_4CodeEdit.EnableWindow(FALSE);
//
m_2SequenceEdit.SetSel(0,-1);
m_2SequenceEdit.ReplaceSel("");
m_2SequenceEdit.EnableWindow(FALSE);
//
m_5ResultEdit.SetSel(0,-1);
m_5ResultEdit.ReplaceSel("");
m_5ResultEdit.EnableWindow(TRUE);
return TRUE; // return TRUE unless you set the focus to a control
}
void CMy190structureDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
void CMy190structureDlg::OnDestroy()
{
WinHelp(0L, HELP_QUIT);
CDialog::OnDestroy();
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CMy190structureDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMy190structureDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CMy190structureDlg::On6topicButton()
{
// TODO: Add your control notification handler code here
MessageBox("本程序可以求解连续梁的结构力学问题,采用矩阵位移法。");
}
void CMy190structureDlg::On6detailButton()
{
// TODO: Add your control notification handler code here
MessageBox("1.在输入结点编码时,请在输入每个结点的编码后,回车以输入下一个。\n2.请参考控件提示依次输入数据。\n\n 谢谢!");
}
void CMy190structureDlg::On6designerButton()
{
// TODO: Add your control notification handler code here
MessageBox(" 设计者:霍轶力 \n 土木工程系, 结03 班,000190\n 联系方式 : 23#519, 6277 7322\n Email: huoyili1@163.net\n\n 谢 谢!");
}
void CMy190structureDlg::On6exitButton()
{
// TODO: Add your control notification handler code here
OnOK();
}
void CMy190structureDlg::On6newButton()
{
// TODO: Add your control notification handler code here
OnInitDialog();
}
void CMy190structureDlg::On0designerMenu()
{
// TODO: Add your command handler code here
On6designerButton();
}
void CMy190structureDlg::On0exitMenu()
{
// TODO: Add your command handler code here
OnOK();
}
void CMy190structureDlg::On0topicMenu()
{
// TODO: Add your command handler code here
On6topicButton();
}
void CMy190structureDlg::On0detailMenu()
{
// TODO: Add your command handler code here
On6detailButton();
}
void CMy190structureDlg::On0newMenu()
{
// TODO: Add your command handler code here
OnInitDialog();
}
void CMy190structureDlg::On1finishButton()
{
// TODO: Add your control notification handler code here
//获取 单选按钮内容
// 激活 控件
m_1ChangeButton.EnableWindow(TRUE);
m_2NextButton.EnableWindow(TRUE);
m_2CellEdit.EnableWindow(TRUE);
m_2LengthEdit.EnableWindow(TRUE);
m_2ToughEdit.EnableWindow(TRUE);
m_2BsEdit.EnableWindow(TRUE);
m_2BdEdit.EnableWindow(TRUE);
m_2JsEdit.EnableWindow(TRUE);
m_2JdEdit.EnableWindow(TRUE);
m_1NumberEdit.EnableWindow(FALSE);
m_1FinishButton.EnableWindow(FALSE);
GetDlgItem(IDC_1LJ_RADIO)->EnableWindow(FALSE);
GetDlgItem(IDC_1LG_RADIO)->EnableWindow(FALSE);
GetDlgItem(IDC_1RJ_RADIO)->EnableWindow(FALSE);
GetDlgItem(IDC_1RG_RADIO)->EnableWindow(FALSE);
//
char temp[20]; //中间使用字符存储单元
char *stop; //字符转换专用
//写 当前跨数
_ltoa(NOWSEQUENCE,temp,20);
strcpy(SEQUENCE,temp);
//写 ---
char temp1[20]="--";
strcat(SEQUENCE,temp1);
//写 总跨数
int nMax;
nMax=m_1NumberEdit.LineLength()+1;
m_1NumberEdit.GetWindowText(temp,nMax);
strcat(SEQUENCE,temp);
NUMBER=strtol(temp,&stop,10);
//显示
m_2SequenceEdit.SetSel(0,-1);
m_2SequenceEdit.ReplaceSel(SEQUENCE);
//
int LRadio,RRadio;
LRadio=GetCheckedRadioButton(IDC_1LJ_RADIO,IDC_1LG_RADIO);
RRadio=GetCheckedRadioButton(IDC_1RJ_RADIO,IDC_1RG_RADIO);
if(LRadio==IDC_1LJ_RADIO&&RRadio==IDC_1RJ_RADIO)
{
EDGECONDITION=1;
strcpy(INPUTRESULT,"边界条件:左侧铰支,右侧铰支\n");
}
if(LRadio==IDC_1LJ_RADIO&&RRadio==IDC_1RG_RADIO)
{
EDGECONDITION=2;
strcpy(INPUTRESULT,"边界条件:左侧铰支,右侧固支\n");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -