資源簡介
學習c#中,我一直試圖用簡單的方式去處理一些常見問題。
本例實現winform無邊框四周陰影方法是比較簡單的,無圖片、無窗口疊加等其他復雜代碼,就是api的調用,實現的是四邊,不是網上其他例子的2邊,也不需要圖片什么的。
自定義滾動條,在網上找了些例子,要么龐大、要么搞個安裝組件什么的。我要求簡單能用就行了,其他例子修改實在麻煩,就做了一個。實現挺簡單,就是panel或圖片什么的跟著鼠標走就行了,寫些鼠標滑輪事件、點擊事件什么的定位就行了。這里panel自己可以加背景圖或直接搞個圖就行了。為了演示清楚,有個C#自帶滾動條控件做對比,與自定義的同步。其他更詳細說明在我的博客http://www.cnblogs.com/qiaoke/p/6120102.html
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Runtime.InteropServices;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
namespace?customscroll
{
????public?partial?class?Form1?:?Form
????{
????????[DllImport(“Gdi32.dll“?EntryPoint?=?“CreateRoundRectRgn“)]
????????private?static?extern?IntPtr?CreateRoundRectRgn
????????????????????(
????????????????????????int?nLeftRect
????????????????????????int?nTopRect
????????????????????????int?nRightRect
????????????????????????int?nBottomRect
????????????????????????int?nWidthEllipse
????????????????????????int?nHeightEllipse
?????????????????????);
????????[DllImport(“dwmapi.dll“)]
??
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.?????43008??2016-12-03?12:54??customscroll\.vs\customscroll\v14\.suo
?????文件????????189??2016-11-30?19:57??customscroll\App.config
?????文件??????12800??2016-12-03?12:50??customscroll\bin\Debug\customscroll.exe
?????文件????????189??2016-11-30?19:57??customscroll\bin\Debug\customscroll.exe.config
?????文件??????26112??2016-12-03?12:50??customscroll\bin\Debug\customscroll.pdb
?????文件??????22696??2016-12-03?12:46??customscroll\bin\Debug\customscroll.vshost.exe
?????文件????????189??2016-11-30?19:57??customscroll\bin\Debug\customscroll.vshost.exe.config
?????文件????????490??2016-07-16?19:44??customscroll\bin\Debug\customscroll.vshost.exe.manifest
?????文件???????3922??2016-11-30?19:57??customscroll\customscroll.csproj
?????文件????????990??2016-11-30?19:57??customscroll\customscroll.sln
?????文件???????9986??2016-12-03?12:53??customscroll\Form1.cs
?????文件???????5424??2016-12-03?12:49??customscroll\Form1.Designer.cs
?????文件???????5817??2016-12-03?12:49??customscroll\Form1.resx
?????文件????????524??2016-11-30?19:57??customscroll\Program.cs
?????文件???????1332??2016-11-30?19:57??customscroll\Properties\AssemblyInfo.cs
?????文件???????2837??2016-11-30?19:57??customscroll\Properties\Resources.Designer.cs
?????文件???????5612??2016-11-30?19:57??customscroll\Properties\Resources.resx
?????文件???????1099??2016-11-30?19:57??customscroll\Properties\Settings.Designer.cs
?????文件????????249??2016-11-30?19:57??customscroll\Properties\Settings.settings
?????目錄??????????0??2016-11-30?19:57??customscroll\.vs\customscroll\v14
?????目錄??????????0??2016-11-30?19:57??customscroll\obj\Debug\TempPE
?????目錄??????????0??2016-11-30?19:57??customscroll\.vs\customscroll
?????目錄??????????0??2016-12-03?12:50??customscroll\bin\Debug
?????目錄??????????0??2016-12-03?12:54??customscroll\obj\Debug
????...D.H.?????????0??2016-11-30?19:57??customscroll\.vs
?????目錄??????????0??2016-11-30?19:57??customscroll\bin
?????目錄??????????0??2016-11-30?19:57??customscroll\obj
?????目錄??????????0??2016-11-30?19:57??customscroll\Properties
?????目錄??????????0??2016-12-03?12:53??customscroll
-----------?---------??----------?-----??----
............此處省略2個文件信息
- 上一篇:WPF 觸屏操作
- 下一篇:winform 圖片 全屏 自動播放
評論
共有 條評論