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

国家建设部官方网站赵宏彦怎么做网站教程

国家建设部官方网站赵宏彦,怎么做网站教程,wordpress付费主题破解版,东莞网站建设选高科技项目场景: 在 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.15wanjia.com/news/185358.html

相关文章:

  • 网站开发用什么写得比较好网站建设服务费属于什么科目
  • 应付网站软件服务怎么做分录盐城网站定制
  • 河南网站托管网站制作cms
  • 北京企业建站化工网站开发
  • 厦门市建设局综合业务平台网站网站 功能需求
  • 石景山网站建设设计公司郑州商城网站开发
  • 比较有名的网站建设平台网络营销方式分析
  • 网站安全制度体系的建设情况义县网站建设
  • 网站制作与维护费用建一个自己用的网站要多少钱
  • 广告图片网站小加工厂做网站
  • 做英文网站用什么源码国内做外单的网站有哪些
  • 手机网站管理系统网站建设捌金手指花总二七
  • 有批量做基因结构的网站吗公司网站怎么做简介
  • wordpress游戏网站自已建网站微信登录
  • 企业网站关于我们合肥做网站的公司百度
  • 企业建设网站的目的是页面设计包括哪些内容
  • 网站地图 制作工具企业网站的形式
  • 网站推广的一般流程是网页设计简图
  • 网站工程师招聘如何用wordpress建网站
  • 自助建个人网站哪个好wordpress 渗透框架
  • 定制跟模板网站有什么不一样ps做网站图片水印
  • 做的好的音乐网站新年电子贺卡免费制作软件app
  • 新兴街做网站公司住房公积金网站怎么做减员
  • 网站规划分析的好处网站上不去原因
  • 做网站用的字体影视自助建站系统源码
  • 温岭网站制作wordpress 无法选择数据库
  • 寻找集团网站建设软件开发相关文档
  • 网站建设工程师北京简网世纪科技有限公司
  • 小程序怎么做微网站链接公司简介万能模板
  • 保定网站建设报价域名价格查询