免费网站建设福州移动电子商务网站建设研究

web/2025/9/26 22:18:13/文章来源:
免费网站建设福州,移动电子商务网站建设研究,wordpress网站前端,哈尔滨市建设工程交易网WPF里面虽然很多形式上跟Winform一样#xff0c;但是控件的使用上面还是会有很多诧异。RichTextBox就是一个例子#xff0c;是的#xff0c;在WPF里面对这个控件可以做很多Winform很难做的效果出来。比如在对RichTextBox插入图片#xff0c;winform时代除了用复制粘贴这种借…WPF里面虽然很多形式上跟Winform一样但是控件的使用上面还是会有很多诧异。RichTextBox就是一个例子是的在WPF里面对这个控件可以做很多Winform很难做的效果出来。比如在对RichTextBox插入图片winform时代除了用复制粘贴这种借助剪贴板的差劲方法之外就是要重写和自定义RichTextBox控件了。这就需要高超的编程能力了。但在WPF里面只需要加几个代码就能搞定了。在XAML里面添加图片到RichTextBox可以如下所示        RichTextBox HorizontalAlignmentLeft Margin90,12,0,0 NamerichTextBox1            RichTextBox.Document                FlowDocument FocusableTrue LineHeight5                    Paragraph x:Namegara                                              文字区域                        Image SourceD:\1342892_10.jpg FocusableTrue Height50 StretchUniform /                                               文字区域                                               Run Text文字区域文字区域/Run                        Run Text文字区域/Run                    /Paragraph                    Paragraph x:Namegara1                                              Run Text文字区域/Run                        Run Text文字区域/Run                    /Paragraph                                   /FlowDocument            /RichTextBox.Document        /RichTextBox 这样就往控件里面添加了图片了。备注FlowDocument里面的LineHeight 属性是文字段落的间距。默认间距很大所以这里调整一下 当然这样未必能够完全满足要求因为有时候我们需要在程序运行的时候点击按钮选取图片进行添加。代码如下private void AddJPG_Click(object sender, RoutedEventArgs e)        {            string filepath ;            string filename ;            OpenFileDialog openfilejpg new OpenFileDialog();            openfilejpg.Filter jpg图片(*.jpg)|*.jpg|gif图片(*.gif)|*.gif;            openfilejpg.FilterIndex 0;            openfilejpg.RestoreDirectory true;            openfilejpg.Multiselect false;            if (openfilejpg.ShowDialog() true)            {                filepath openfilejpg.FileName;                Image img new Image();                BitmapImage bImg new BitmapImage();                               img.IsEnabled true;                               bImg.BeginInit();                bImg.UriSource new Uri(filepath, UriKind.Relative);                bImg.EndInit();                img.Source bImg;                 //MessageBox.Show(bImg.Width.ToString() , bImg.Height.ToString());                /* 调整图片大小                if (bImg.Height 100 || bImg.Width 100)                {                    img.Height bImg.Height * 0.2;                    img.Width bImg.Width * 0.2;                }*/                img.Stretch Stretch.Uniform;  //图片缩放模式                new InlineUIContainer(img, richTextBox1.Selection.Start); //插入图片到选定位置            }        }这样就插入了一张图片到RichTextBox里了是不是很简单呢 原文在此http://blogs.msdn.com/jfoscoding/archive/2006/01/14/512825.aspx 这里仅整理出其中的知识点1. 取得已被选中的内容(1)使用 RichTextBox.Document.Selection属性(2)访问RichTextBox.Document.Blocks属性的“blocks”中的Text2. 在XAML中增加内容给RichTextBox:RichTextBox IsSpellCheckEnabledTrue   FlowDocument        Paragraph!-- 这里加上你的内容 --          This is a richTextBox. I can BoldBold/Bold, ItalicItalicize/Italic, HyperlinkHyperlink stuff/Hyperlink right in my document.        /Paragraph   /FlowDocument/RichTextBox3. 缩短段间距,类似BR,而不是P方法是使用Style定义段间距:    RichTextBox        RichTextBox.Resources          Style TargetType{x:Type Paragraph}            Setter PropertyMargin Value0/          /Style        /RichTextBox.Resources        FlowDocument          Paragraph            This is my first paragraph... see how there is...          /Paragraph          Paragraph            a no space anymore between it and the second paragraph?          /Paragraph        /FlowDocument      /RichTextBox4. 从文件中读出纯文本文件后放进RichTextBox或直接将文本放进RichTextBox中:private void LoadTextFile(RichTextBox richTextBox, string filename){    richTextBox.Document.Blocks.Clear();    using (StreamReader streamReader File.OpenText(filename)) {           Paragraph paragraph new Paragraph();           paragraph.Text streamReader.ReadToEnd();           richTextBox.Document.Blocks.Add(paragraph);    }}private void LoadText(RichTextBox richTextBox, string txtContent){    richTextBox.Document.Blocks.Clear();    Paragraph paragraph new Paragraph();    paragraph.Text  txtContent;    richTextBox.Document.Blocks.Add(paragraph);}5. 取得指定RichTextBox的内容private string GetText(RichTextBox richTextBox) {        TextRange textRange new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);        return textRange.Text;}6. 将RTF (rich text format)放到RichTextBox中private static void LoadRTF(string rtf, RichTextBox richTextBox)        {            if (string.IsNullOrEmpty(rtf)) {                throw new ArgumentNullException();            }            TextRange textRange new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);            using (MemoryStream rtfMemoryStream new MemoryStream()) {                using (StreamWriter rtfStreamWriter new StreamWriter(rtfMemoryStream)) {                    rtfStreamWriter.Write(rtf);                    rtfStreamWriter.Flush();                    rtfMemoryStream.Seek(0, SeekOrigin.Begin);//Load the MemoryStream into TextRange ranging from start to end of RichTextBox.                    textRange.Load(rtfMemoryStream, DataFormats.Rtf);                }            }        }7. 将文件中的内容加载为RichTextBox的内容        private static void LoadFile(string filename, RichTextBox richTextBox)        {            if (string.IsNullOrEmpty(filename)) {                throw new ArgumentNullException();            }            if (!File.Exists(filename)) {                throw new FileNotFoundException();            }            using (FileStream stream File.OpenRead(filename)) {                TextRange documentTextRange new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);                string dataFormat DataFormats.Text;                string ext System.IO.Path.GetExtension(filename);                if (String.Compare(ext, .xaml,true) 0) {                    dataFormat DataFormats.Xaml;                }                else if (String.Compare(ext, .rtf, true) 0) {                    dataFormat DataFormats.Rtf;                }                documentTextRange.Load(stream, dataFormat);            }                }8. 将RichTextBox的内容保存为文件        private static void SaveFile(string filename, RichTextBox richTextBox)        {            if (string.IsNullOrEmpty(filename)) {                throw new ArgumentNullException();            }            using (FileStream stream File.OpenWrite(filename)) {                TextRange documentTextRange new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);                string dataFormat DataFormats.Text;                string ext System.IO.Path.GetExtension(filename);                if (String.Compare(ext, .xaml, true) 0) {                    dataFormat DataFormats.Xaml;                }                else if (String.Compare(ext, .rtf, true) 0) {                    dataFormat DataFormats.Rtf;                }                documentTextRange.Save(stream, dataFormat);            }        }9. 做个简单的编辑器  !-- Window1.xaml --  DockPanel    Menu DockPanel.DockTop      MenuItem Header_File        MenuItem Header_Open File ClickOnOpenFile/        MenuItem Header_Save ClickOnSaveFile/        Separator/        MenuItem HeaderE_xit ClickOnExit/      /MenuItem          /Menu    RichTextBox NamerichTextBox1/RichTextBox       /DockPanel        // Window1.xaml.cs        private void OnExit(object sender, EventArgs e) {            this.Close();        }        private void OnOpenFile(object sender, EventArgs e) {            Microsoft.Win32.OpenFileDialog ofd new Microsoft.Win32.OpenFileDialog();            ofd.Filter Text Files (*.txt; *.xaml; *.rtf)|*.txt;*.xaml;*.rtf;            ofd.Multiselect false;            if (ofd.ShowDialog() true) {                LoadFile(ofd.SafeFileName, richTextBox1);            }        }        private void OnSaveFile(object sender, EventArgs e) {            Microsoft.Win32.SaveFileDialog sfd new Microsoft.Win32.SaveFileDialog();            sfd.Filter Text Files (*.txt; *.xaml; *.rtf)|*.txt;*.xaml;*.rtf;            if (sfd.ShowDialog() true) {                SaveFile(sfd.SafeFileName, richTextBox1);            }        }心中时常装有一盘人生的大棋,天作棋盘,星作棋子,在斗转星移中,只有不断地搏击人生,人生才有意义,生命才能彰显光辉,才能收获一分永恒。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/82414.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

陕西省建设厅特种工报名网站可以做伦铜的网站

题目:http://www.51nod.com/onlineJudge/questionCode.html#!problemId1250 仔细思考dp。 第一问,考虑已知 i-1 个数有多少种方案。再放入一个数,它是最大的且在最后面,所以它的位置不同的话,就是不同的方案。它在特定…

访问公司网站公司会知道吗网页设计手机软件

正题 题意 一条长m线&#xff0c;有n条长度不同的线段&#xff0c;查询x到x1有多少条线 解题思路 标记直接覆盖颜色数&#xff0c;然后找到那个点&#xff0c;之后向上到根节点把所有叠加的线统计 代码 #include<cstdio> #include<cstring> using namespace s…

微信如何建立网站做网站的公司重庆

案例分享&#xff1a;作为全球领导者&#xff0c;该财富100强公司以扩大其在移动技术领域的领导力和影响力为使命&#xff0c;该领域是其行业中增长最快的细分市场。公司有超过2,100名工程师、设计师和利益相关者通过使用Jama Connect加速产品开发。 成果概述&#xff1a; •…

网站标准宽度app运营策划

1. T9 输入法的中文字典数据 网上可以找到 T9 输入法的中文字典数据&#xff0c;但是通常有两个问题&#xff1a; 采用 GPL 协议&#xff0c;不太适合加入 AWTK。 只支持单个汉字的输入&#xff0c;不支持词组的输入。 经过考虑之后&#xff0c;决定自己生成 T9 输入法的中…

公司建设网站费用怎么记账志迅东莞网站建设

在大型项目中&#xff0c;Spring Events提供了一种有效的方式来解耦不同的模块&#xff0c;使得系统更加灵活和可扩展。Spring Events基于发布/订阅模式&#xff0c;允许应用的不同部分之间进行通信&#xff0c;而无需直接调用对方的代码。这种方式特别适合于处理那些不需要即时…

微信网站模板源码下载在网上做贸易哪个网站好

线程的概念 前言&#xff1a; 一个程序运行起来&#xff0c;就会对应一个进程&#xff0c;例如&#xff0c;启动一个 Java 程序&#xff0c;就会创建一个 Java 进程。进程也被称为系统分配资源的基本单位。 一个进程可以包含一个线程&#xff0c;也可以包含多个线程&#xff…

外贸汽车配件做那个网站凡氪官网

1 什么是Servlet Servlet是Server Applet的简称&#xff0c;是用Java编写的是运行在 Web 服务器上的程序&#xff0c;它是作为来自 Web 浏览器或其他 HTTP 客户端的请求和 HTTP 服务器上的数据库或应用程序之间的中间层。使用 Servlet&#xff0c;可以收集来自网页表单的用户输…

做个简单网站大概多少钱wordpress 顶部高度

Solus Linux 是一个独立的 Linux 发行版&#xff0c;它以简单易用和现代化的用户体验而著称。Solus Linux 使用的包管理器是 eopkg&#xff0c;它具有以下优势和特点&#xff1a; 用户友好的界面&#xff1a;eopkg 提供了一个简洁直观的命令行界面&#xff0c;使得用户可以轻松…

建设局网站信息发布规定在线制作网站免费

Oracle Receivable 是功能完备地应收款管理系统&#xff0c;它能够有效地管理客户、发票和收帐过程&#xff0c;因此是财务模块的重要组成部分&#xff0c;是财务系统中较为核心的模块之一。对于一个公司来说&#xff0c;是否能够与客户保持良好的跟踪&#xff0c;及时收取应收…

免费建网站网址活动网页怎么做

全世界只有3.14 % 的人关注了爆炸吧知识人们常说中国地图的形状像一只雄鸡&#xff0c;但具体到每一个省区则并没有一个明确的说法。看看下面这一套省区地图对应的有趣的想象&#xff0c;你觉得像还是不像&#xff1f;★安徽有人说安徽像一只斜倒挂着的蝙蝠&#xff0c;你能看出…

漂亮购物网站欣赏正规网站优化哪个公司好

时钟配置 我们使用s3c2440&#xff0c;主频12M&#xff0c;查看用户手册 通过锁相环抬升到400MHZ&#xff0c;分成三条通路&#xff0c;通过HHDIVN和PDIVN配置频率比&#xff0c;这个频率比配置手册已经给出。 配置MPLL主频400Mhz&#xff0c; 通过这个公式算出MPLL s、p、m都…

在线响应式网站成都网站设计服务商

使用方法:替换 易语言 LIB目录下的黑月支持库 记得备份 去掉代码长度过少不能编译的限制.(比如空代码) 优化编译出来的文件体积大小.(exe貌似没问题,dll貌似也没问题,就是dll对体积的优化不会太多) 体积减少了N倍...不解释,不解释,高手懂得... 转载于:https://blog.51cto.com…

江苏建设通网站建站之星模板的使用

static void Main(string[] args){dynamic point new {x 15,y 10};DrwaPoint(point);System.Console.Read();}static void DrwaPoint(dynamic point) >System.Console.WriteLine($"x:{point.x},y:{point.y}");

海淘网站入口网站建设评估体系

三层交换机下的VLAN划分&#xff0c;本身就已经做到了隔离&#xff0c;无法通信&#xff0c;VLAN的作用是可以隔离冲突域和广播域。那么&#xff0c;同一交换机不同VLAN如何隔离呢&#xff1f;接下来我们就跟随飞畅科技的小编一起来详细了解下吧&#xff01; 什么是VLAN&#…

网站规划应遵循的原则有哪些家装设计师电话

问题描述如下&#xff1a; 有 三个源文件&#xff0c;A.h、B.cpp、C.cpp。 A.h是头文件&#xff0c;其中声明了三个变量a1、a2、 a3。 B.cpp是A.h中所声明的类的实现源代码&#xff0c;C.cpp是主程序文件。B.cpp和C.cpp中均包含头文件 A.h。 在编译时&#xff0c;编译能够通…

做公司网站解析网站建设的大公司好

.net core 实现基于 JSON 的实现多语言Intro上次我们提到了&#xff0c;微软默认提供基于资源文件的多语言本地化&#xff0c;个人感觉使用起来不是太方便&#xff0c;没有 json 看起来直观&#xff0c;于是动手造了一个轮子&#xff0c; dotnet core 基于 json 的本地化组件Ge…

建设网站的主要流程房地产销售话术

11-09 周四 CNN 卷积神经网络 时间版本修改人描述2023年11月9日09:38:12V0.1宋全恒新建文档 简介 学习一下CNN&#xff0c;卷积神经网络。使用的视频课程。视觉相关的任务&#xff1a; 人脸识别 卷积网络与传统网络的区别&#xff1a; <img altimage-20231109094400591 s…

新沂网站优化百度地图推广怎么收费标准

《嵌入式工程师自我修养/C语言》系列——程序的编译、链接过程分析&#xff08;简洁浓缩版&#xff09;&#xff01; 一、程序的编译1.1 预编译指令 pragma1.2 编译过程概述1.3 符号表和重定位表 二、程序的链接2.1 分段组装2.2 符号决议2.2.1 强符号与弱符号2.2.2 GNU编译器的…

福建省建设干部培训中心网站首页可以做装修效果图的网站

公司之前开发一个网盘系统, 可以上传文件, 打包压缩下载文件, 但是在处理大文件的时候, 服务器遇到了性能问题, 主要是这个项目是单机部署.......(离谱), 然后带宽只有100M, 现在用户比之前多很多, 然后所有人的压缩下载请求都给到这一台服务器了, 比如多个人下载的时候带宽问…