当前位置: 首页 > wzjs >正文

asp网站转php企业网页设计教程

asp网站转php,企业网页设计教程,上海工作网站,网站建设主结构项目场景: 在 WinForms 中制作 无边框窗体(FormBorderStyle None)时,默认失去了窗口的标题栏与边框,因此也失去了通过鼠标拖动移动和调整大小的能力。本例子通过一个标题栏来拖动窗体,通过状态栏右下角的…

项目场景:

在 WinForms 中制作 无边框窗体(FormBorderStyle = None)时,默认失去了窗口的标题栏与边框,因此也失去了通过鼠标拖动移动和调整大小的能力。本例子通过一个标题栏来拖动窗体,通过状态栏右下角的地方来拖动来改变窗体大小。本例子创建了两个窗体。一个baseform用来放标题栏和状态栏。

问题描述

提示:这里描述项目中遇到的问题:

难点是我窗体上被标题栏和状态栏dock之后很难选中

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace WindowsFormsApp1
{public partial class Form1: Form{public Form1(){InitializeComponent();panel1.MouseMove += panel1_MouseMove;panel1.MouseDown += panel1_MouseDown;panel1.MouseUp += Panel1_MouseUp;panel2.MouseDown += PanelTitle_MouseDown;this.DoubleBuffered = true;}[DllImport("user32.dll")]public static extern bool ReleaseCapture();[DllImport("user32.dll")]public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);public const int WM_NCLBUTTONDOWN = 0xA1;public const int HTCAPTION = 0x2;private void PanelTitle_MouseDown(object sender, MouseEventArgs e){if (e.Button == MouseButtons.Left){ReleaseCapture();SendMessage(this.Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);}}private void Panel1_MouseUp(object sender, MouseEventArgs e){if (e.Button == MouseButtons.Left){this.Size = previousRect.Size;isResizing = false;}}private bool isResizing = false;private Point lastMousePos;private Size lastMouseSize;private Size NewMouseSize;private const int resizeArea = 15;private Rectangle previousRect;private void panel1_MouseMove(object sender, MouseEventArgs e){bool inBottomRight = e.X >= panel1.Width - resizeArea && e.Y >= panel1.Height - resizeArea;if (inBottomRight || isResizing)panel1.Cursor = Cursors.SizeNWSE;elsepanel1.Cursor = Cursors.Default;if (isResizing && e.Button == MouseButtons.Left){int dx = e.X - lastMousePos.X;int dy = e.Y - lastMousePos.Y;Size newSize = new Size(lastMouseSize.Width + dx,lastMouseSize.Height + dy);Rectangle newRect = new Rectangle(this.Location, newSize);previousRect = newRect;OnUpdateRichTextBox?.Invoke($" lastMousePos.X:{lastMousePos.X} lastMousePos.Y:{lastMousePos.Y} e.Y:{e.Y} e.X:{e.X}  dx:{dx}  dy:{dy}", Color.Black);}}private void panel1_MouseDown(object sender, MouseEventArgs e){if (e.Button == MouseButtons.Left &&e.X >= panel1.Width - resizeArea &&e.Y >= panel1.Height - resizeArea){lastMouseSize = this.Size;isResizing = true;lastMousePos = e.Location;}}public event Action<string , Color> OnUpdateRichTextBox;/// <summary>/// 改变richtextbox 当前插入行颜色/// </summary>/// <param name="rtBox"></param>/// <param name="addtext"></param>/// <param name="color"></param>/// <param name="IsaddNewLine"></parampublic void AppendTextColorful(RichTextBox rtBox, string addtext, Color color, bool IsaddNewLine = false){if (IsaddNewLine){addtext += Environment.NewLine;}try{if (rtBox.InvokeRequired){rtBox.Invoke(new Action(() =>{rtBox.ScrollToCaret();rtBox.SelectionStart = rtBox.TextLength;rtBox.SelectionLength = 0;rtBox.SelectionColor = color;rtBox.AppendText(DateTime.Now.ToString("yyyy:MM:dd HH:mm:ss:fff") + "  " + addtext + "\r\n");rtBox.SelectionColor = rtBox.ForeColor;if (rtBox.Lines.Length > 1000)rtBox.Clear();}));}else{rtBox.ScrollToCaret();rtBox.SelectionStart = rtBox.TextLength;rtBox.SelectionLength = 0;rtBox.SelectionColor = color;rtBox.AppendText(DateTime.Now.ToString("yyyy:MM:dd HH:mm:ss:fff") + addtext + "\r\n");rtBox.SelectionColor = rtBox.ForeColor;if (rtBox.Lines.Length > 1000)rtBox.Clear();}if (!Directory.Exists($"Log\\")){Directory.CreateDirectory($"Log\\");}//LoggerUtility.Instance.WriteLog(addtext, "normal");}catch (Exception ex){//LoggerUtility.Instance.WriteException(ex);}}}
}
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace WindowsFormsApp1
{class Class1:Form1{private RichTextBox richTextBox1;public Class1(){InitializeComponent();OnUpdateRichTextBox += UpdateTextBox1;}//RichTextBox richTextBox1;private void UpdateTextBox1(string str, Color clr){AppendTextColorful(richTextBox1, str, clr);}private void InitializeComponent(){this.richTextBox1 = new System.Windows.Forms.RichTextBox();this.SuspendLayout();// // richTextBox1// this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;this.richTextBox1.Location = new System.Drawing.Point(0, 57);this.richTextBox1.Name = "richTextBox1";this.richTextBox1.Size = new System.Drawing.Size(1232, 503);this.richTextBox1.TabIndex = 2;this.richTextBox1.Text = "";// // Class1// this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);this.ClientSize = new System.Drawing.Size(1232, 606);this.Controls.Add(this.richTextBox1);this.Name = "Class1";this.Controls.SetChildIndex(this.richTextBox1, 0);this.ResumeLayout(false);}}
}
http://www.dtcms.com/wzjs/608621.html

相关文章:

  • 在线单页网站制作苏州网站开发公司有哪些
  • 烟台莱山城市建设网站柳州网站网站建设
  • 网站建设拿什么框架长沙官网网站建设哪家好
  • 做微网站需要哪种公众号世界互联网峰会互联网之光
  • 道路建设去什么网站能看到建筑人才网证书
  • 中山网站建设备案旅游网站制作过程
  • 怎么把dw做的网站分享给别济南建设网站企业报价
  • 昆明城乡建设网站网站系统维护要多久
  • 虎扑的网站是用什么技术做的运营一个网站的成本
  • 网站对应不同域名亚马逊是做什么的
  • 青岛做网站青岛做网站app开发制作的措施
  • 网站开发fsdpjq外贸是做什么的经营范围
  • 利用angular做的网站网站默认样式表
  • 景安网站上传完还要怎么做小程序注册个人和企业有什么区别
  • 蓝色风格企业网站网店代运营网站
  • 贸易公司如何做英文网站舟山网站建设公司
  • 乐清网站制作公司有哪些测网站打开的速度的网址
  • 哪个行业该做网站但是没有做做的比较好的货运网站
  • 做app网站有哪些功能海曙网站建设网站
  • 某企业网站建设规划书用腾讯云怎么建设网站
  • phpcms 网站栏目云南建设局网站首页
  • 物流官方网站水利工程建设信息网站
  • 网站建设与管理 ppt模板团购网站建设怎么样
  • 做图片可以卖给那些网站烟台网站优化公司
  • 临沂做进销存网站wordpress百度实时推送
  • 重庆响应式网站建设找哪家网站建设 微信公众号运营
  • iphone手机网站建设做公司网站联系公司
  • 工信部网站手机备案查询陕西公共资源交易中心
  • 作为一个大学生网站 应该怎么做电视剧怎么做短视频网站
  • 阿里云建网站流程有没有免费建网站